Disable fontlock (syntax highlighting) for \newcommand

The solution is to override built-in fontification with what you want. You can do that using the font-latex-add-keywords function. For more information about the argument specification, see Fontification of macros in the AUCTeX manual.

To change fontification of the macros you mentioned, you can add this to your .emacs:

(defun my-font-latex-add-custom-keywords ()
  (eval-after-load "font-latex"
    '(font-latex-add-keywords '(("newenvironment" "*{[[")
                                ("renewenvironment" "*{[[")
                                ("newcommand" "*|{\\[[")
                                ("renewcommand" "*|{\\[[")
                                ("providecommand" "*|{\\[[")
                                ("fbox" "")
                                ("mbox" "")
                                ("sbox" ""))
                              'function)))

(add-hook 'LaTeX-mode-hook 'my-font-latex-add-custom-keywords)

Tags:

Emacs

Auctex