13

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.

2 Answers 2

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.

1
  • Very nice addition. Just added it to my .emacs.
    – jon
    Aug 16, 2012 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.

1
  • 3
    Could you please share your highlight-regexp settings?
    – Somebody
    Nov 28, 2012 at 19:59

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .