今天的简单问题–我希望答案也同样简单。

在TextMate中,我习惯于使用键盘快捷方式将当前环境或命令更改为已加星标的版本。 Emacs / AUCTeX中有类似的东西吗?

最佳答案

by Kilian Foth所述,您可以编写一个函数来修改环境:

(defun LaTeX-star-environment ()
  "Convert the current environment to its starred version."
  (interactive)
  ;; Add a star to the current environment.
  (LaTeX-modify-environment (concat (LaTeX-current-environment) "*")))

如果您重复此命令,此功能将继续在当前环境中添加星星(*)。

如果您想让一个函数对当前环境进行加星标(如果尚未对其加星标),而对它取消加星标,则可以使用以下函数:

(defun LaTeX-star-environment-dwim ()
  "Convert between the starred and the not starred version of the current environment."
  (interactive)
  ;; If the current environment is starred.
  (if (string-match "\*$" (LaTeX-current-environment))
      ;; Remove the star from the current environment.
      (LaTeX-modify-environment (substring (LaTeX-current-environment) 0 -1))
    ;; Else add a star to the current environment.
    (LaTeX-modify-environment (concat (LaTeX-current-environment) "*"))))

您可以通过将任一函数包含在.emacs中并分别执行M-x LaTeX-star-environmentLaTeX-star-environment-dwim或将函数绑定(bind)到键来使用这两个函数。

关于emacs - 在AUCTeX中插入加星标的环境或命令,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/10531115/

10-11 02:14