0

I've put

(setq org-highlight-latex-and-related '(latex script entities))

in my emacs config and yet $..$ that contain more than one symbol aren't highlighted properly:

How to fix?

EDIT: This still does not work for me as of org-version 9.4.

5
  • Works for me with org-mode 9.1.13 (9.1.13-elpaplus). – Tobias May 23 '19 at 9:59
  • Evaluating org-version yields 9.2.1 for me. – George May 23 '19 at 15:54
  • 1
    Did you try $2+2=4$ without spaces? The notable thing is that LaTeX fragment delimiter $ are symmetrical unlike \( or \[. So they have to scan the full expression. Maybe the spaces split the expression. – Tobias May 23 '19 at 16:01
  • Both $2 + 2 = 4$ and $2+2=4$ don't highlight, but single characters like $2$ do highlight. Very strange behavior. – George May 23 '19 at 16:12
  • Did you try with emacs -Q and maybe M-x package-initialize? – Tobias May 23 '19 at 16:44
0

Actually, I experience the same behaviour, even if I choose native highlight instead of latex. It seems that it gets confused because in org-mode you can insert even currency such as $3500 and .12$. So it's difficult to distinguish whether and expression is indeed a latex expression or if it's a text inside two monetary values.

If you are using latex I suggest to use the \( \) notation, that's why I've never noticed this before.

If you want to dive deep to resolve the issue you can have a look at the function org-inside-LaTeX-fragment-p and the variable org-latex-regexps defined in org.el. Unfortunately it's very complex.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.