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

I just started using org-mode and it looks amazing. The only problem that I still have is that when I write text in mathmode ($ ... $), it appears in the font color of the standard text.

So, I would like to do org-mode to identify the text in mathmode and be able to present it in a different color. Please note that I do not need to change the color of the actual equation, just the source text in org-mode.

Here is an example of how the text is currently presented

Ronner's article entitled "Moving a Disk Between Polygons" introduces a structure with which you can create a solution (path) for a given query in $ O (\ log n) + k $ time.

and how I would like to look

Ronner's article entitled "Moving a Disk Between Polygons" introduces a structure with which you can create a solution (path) for a given query in $ O (\ log n) + k $ time.

(Note that I prefer to display in some specified color ("red") and not a bold font.)

Thanks in advance, Cyril

+6
source share
1 answer

In Emacs version 24.4 and later, this is controlled by the variable org-highlight-latex-and-related :

Non-nil means the allocation of LaTeX-related syntax in the buffer. When not nil, the value must be a list containing any of the following characters:

  • `latex 'Highlight LaTeX fragments and environments.
  • `script 'Highlight the index and superscript.
  • `entity 'Select objects.

So something like

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

in your init should help. Such code is formatted according to the org-latex-and-related .

In earlier versions, the variable org-highlight-latex-fragments-and-specials , which is the simpler variable nil / non-nil:

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

In this case, the org-latex-and-export-specials facet is used.

+10
source

Source: https://habr.com/ru/post/981488/


All Articles