12

I'm using Emacs with AUCTeX to do all my LaTeX. When it comes to syntax highlighting it seems that all mathematics is by default just orange. Do you know of a mode or package that adds some more fine grained syntax highlighting? For example all commands (\foo), matching braces, sub- and superscripts, etc. should get a different color.

5

I enabled brace matching within math environments with mic-paren.el, it also offers some customization, just have a look in the header of the file. Well, it doesn't provide a solution for the other syntax highlighting features you mentioned, but it's a start. I found brace matching extremely helpful already.

  • Very nice addition. Just added it to my .emacs. – jon Aug 16 '12 at 14:07
1

I have the same problem and couldn't find the proper answer. However at the moment I am using highlight-regexp in my LaTeX-mode to highlight syntax in math mode and everywhere else :). Also you could use default font-lock

(add-hook 'TeX-mode-hook
 (lambda ()
    (font-lock-add-keywords nil
        '(("\\\\alpha" 0 font-lock-warning-face t)))))

However sometimes it messes up conditional AUCTeX highlighting. For example, when I use my own defined face.

  • 2
    Could you please share your highlight-regexp settings? – Somebody Nov 28 '12 at 19:59

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.