My Problems:

In latex major mode (not Latex major mode), syntax highlighting works okay for line 1, but not for line 2.

line 1 : my hypothesis is $a^2 + b^2 = c^2.$
line 2 : my hypothesis is \(a^2 + b^2 = c^2.\)

Also, I bizarrely get inconsistent results with syntax highlighting for multi-line inline math entries, like the following:

my hypothesis is $a^2 + b^2 
= c^2.$

My Questions:

  1. How do I get emacs' latex-major-mode-inline-math-syntax-highlighting to also recognize \(...\) entries?

  2. Why am I getting inconsistent results with multi-line inline math entries and how can I correct this?

My Research:

I am comfortable with latex-specific emacs initialization via

(add-hook 'latex-mode-hook
    (lambda ()

Also, I am comfortable creating and modifying my own syntax-table via

(setq my-syntax-table (make-syntax-table))
(modify-syntax-entry ?{ "(}" my-syntax-table)
(modify-syntax-entry ?} "){" my-syntax-table)

However, when I executed M-x describe-syntax while in the buffer of a latex file, I did not see any entries for $...$ grouping.

I did browse the similar questions list before posting, and found LaTeX highlighting: Dollar expressions across lines. Following lawlist' comment in that link, I did execute M-x find-variable RET tex-font-lock-keywords-1 RET and was presented with the daunting (defconst tex-font-lock-keywords-1 entry.

Regarding my 2nd question, I am just checking whether anyone has diagnosed/resolved this situation.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.