Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

I have just started using org-mode and it looks awesome. The only issue that I have so far is that when I write a text in mathmode ($...$) it appears in the standard-text font color.

So, I would like to make org-mode to identify the mathmode text and be able to present it in some other color. Note that I don't 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

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.

and how I would like it to look

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.

(Note that I would prefer to display in some given color, e.g. red, and not bold face.)

like image 750
kirilsolo Avatar asked Jan 24 '15 13:01

kirilsolo


People also ask

How to color the math symbols in latex?

- TeX - LaTeX Stack Exchange How to color math symbols? One can use the command such as extcolor [rgb] {1.00,0.00,0.00} {boundary} to color the word "boundary" in a document. How to color the math symbols in $$? For example, can one turn $C^ {2}$ into red in LaTeX?

Can you change the font in math mode?

Mathematical fonts In mathematical mode as well as in text mode, you can change the typeface as needed. For instance, it's customary to represent real numbers with a blackboard bold font, or topological spaces with calligraphic font. This article shows several fonts for use in math mode.

What font do you use for math in MS Word?

Mathematical fonts. In mathematical mode as well as in text mode, you can change the typeface as needed. For instance, it's customary to represent real numbers with a blackboard bold font, or topological spaces with calligraphic font.

How to color the word boundary in latex?

One can use the command such as extcolor [rgb] {1.00,0.00,0.00} {boundary} to color the word "boundary" in a document. How to color the math symbols in $$? For example, can one turn $C^ {2}$ into red in LaTeX? extcolor from the xcolor package also works in mathmode, even if the name says otherwise. You can also use $ \color {<color>} C^2 $.


1 Answers

In Emacs version 24.4 and later, this is controlled via the variable 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.

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 face org-latex-and-related.

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

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

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

like image 167
Chris Avatar answered Oct 21 '22 12:10

Chris