我结合使用Emacs和AucTeX (运行Ubuntu10.04,如果有关系的话)。
如果点在任何数学环境中(即在$...$、$$...$$、begin{equation}...\end{equation}等中),是否有人知道是否有方法自动启用LaTeX数学模式(AucTeX的次要模式)?
我想有一个相对简单的答案,因为语法突出显示使用相同的标准来着色数学内容,但我找不到任何东西。
发布于 2010-08-12 18:53:23
如果andre-r的答案不能让你满意,这里有一些代码可以设置`在文本模式下自插入,并在数学模式下充当数学模式的前缀。LaTeX-math-mode必须关闭。
(defun LaTeX-maybe-math ()
"If in math mode, act as a prefix key for `LaTeX-math-keymap'.
Otherwise act as `self-insert-command'."
(interactive)
(if (texmathp)
(let* ((events (let ((overriding-local-map LaTeX-math-keymap))
(read-key-sequence "math: ")))
(binding (lookup-key LaTeX-math-keymap events)))
(call-interactively binding))
(call-interactively 'self-insert-command)))
(define-key LaTeX-mode-map "`" 'LaTeX-maybe-math)以下改进留作练习:
C-h或f1.,则按下未绑定键
发布于 2010-08-12 17:46:06
LaTeX-math-mode是“一种特殊的次要模式,用于输入包含许多数学符号的文本”。(对于那些不知道如何操作的人,您可以按`A,然后获取\For and。)所以我想如果你不想学数学的话,让它开着也没什么坏处。
因此,信息页面建议:
(add-hook 'LaTeX-mode-hook 'LaTeX-math-mode)我唯一的缺点是你必须按两次前缀:才能在LaTeX-math-abbrev-prefix中定制, at least that works with the standard prefix。
https://stackoverflow.com/questions/3465190
复制相似问题