组织模式下的 LaTeX 数学模式 ($...$) 字体颜色

LaTeX math mode ($...$) font color in org mode

我刚开始使用 org-mode,它看起来棒极了。到目前为止,我遇到的唯一问题是,当我在数学模式 ($...$) 中编写文本时,它以标准文本字体颜色显示。

所以,我想制作 org-mode 来识别 mathmode 文本并能够以其他颜色显示它。请注意,我不需要更改实际方程式的颜色,只需更改 org-mode 中的源文本。

这是文本当前呈现方式的示例

A paper by Rohnert, titled "Moving a disc between polygons" introduces a structure using which one can generate a solution (path) for a given query in $O(\log n) + k$ time.

以及我希望它看起来如何

A paper by Rohnert, titled "Moving a disc between polygons" introduces a structure using which one can generate a solution (path) for a given query in $O(\log n) + k$ time.

(请注意,我更愿意以某些给定的颜色显示,例如红色,而不是粗体。)

在 Emacs 24.4 及更高版本中,这是通过变量 org-highlight-latex-and-related:

控制的

Non-nil means highlight LaTeX related syntax in the buffer. When non nil, the value should be a list containing any of the following symbols:

  • `latex' Highlight LaTeX snippets and environments.
  • `script' Highlight subscript and superscript.
  • `entities' Highlight entities.

所以像

(eval-after-load 'org
  '(setf org-highlight-latex-and-related '(latex)))

在您的 init 中应该有所帮助。这样的代码按照人脸格式化org-latex-and-related.

在早期版本中,变量org-highlight-latex-fragments-and-specials,这是一个更简单的nil/非nil变量:

(eval-after-load 'org
  '(setf org-highlight-latex-fragments-and-specials t))

在这种情况下,使用面org-latex-and-export-specials