TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Adding additional highlighted keywords in Emacs+AUCTeX messes up conventional highlighting. My code:

(defvar my-new-face (make-face 'my-new-face))
(defvar my-another-new-face (make-face 'my-another-new-face))
(set-face-background 'my-new-face "Aquamarine")
(set-face-foreground 'my-new-face "Black")
(set-face-background 'my-another-new-face "Plum")
(set-face-foreground 'my-another-new-face "Black")

'(("\\\\quad" 1 my-new-face prepend)
 ("\\\\label" 1 my-another-new-face prepend)))

Any suggestions how can I overcome this. Adding user keyword classes in Auctex customization menu doesn't highlight them in math-mode.

share|improve this question

The code provided is "almost" OK: the error is that there are no subexpressions in the regular expressions for \quad and \label, so its an error to refer to subexpression 1: one should either use subexpression 0, i.e. the full regular expression, or define a subexpression. More explicitly:

 '(("\\\\quad" 0 my-new-face prepend)
  ("\\\\label" 0 my-another-new-face prepend)))
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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