Highlighting LaTeX in Emacs

Contents

Using the Right Stuff

If you use emacs and LaTeX and syntax highlighting used to work but doesn't and you want it back, all you need to do is fix your ~/.emacs file. It probably specifies the old-fashioned way, now broken and unsupported.

If you have something like

(if window-system (require 'hilit-LaTeX))
(setq hilit-AmSLaTeX-commands t)

either delete it or comment it out (the comment character in emacs lisp is semi-colon) and replace it with

(if window-system (require 'font-latex))
(setq font-lock-maximum-decoration t)

Syntax highlighting will now work.

But when you start up emacs on a LaTeX file there is no highlighting. Each time you start emacs, you must select the first item on the Options menu, which is Syntax Highlighting (Global Font Lock mode). Then you see the highlighting.

Fooling Around with Colors

As the documentation for font-latex.el --- LaTeX fontification for Font Lock mode says

Okay, so you hate the colours I picked. How do you change them you ask?

Here's what follows in my words with a little more detail.

By the way, in order to be a Unix knowledgeable user you have to know about .Xdefaults and xrdb. This is the standard way to modify the defaults of graphical programs (anything that makes a window). The newer KDE and Gnome stuff use different, mouse and menus, ways to modify their defaults. But .Xdefaults and xrdb it the only thing that works on all graphical programs and the only way to modify the defaults of older programs like xdvi.


Author: Charles Geyer. Comments or corrections gratefully accepted.