[Tex/LaTex] AUCTeX: How to add syntax highlighting for custom cite commands

auctexcitingeditors

I'm new to Emacs and AUCTeX and I want to have consistent syntax highlighting.

Besides the "normal" \cite command, I'm also using commands like \citeauthor or \Citeauthoror self defined commands like \cians{...} which have bibtex keys as arguments and are used to cite literature.

  • How can I change syntax coloring in AUCTeX so that those commands and their arguments have the same colors as the \cite command?

I'm sorry, I'm not very experienced with Emacs, so for me those customizations are very difficult, I tried and found the Font Latex User Keyword Classes, but I do not know how to apply them (if this should be the right solution).

Best Answer

As described in this answer to AUCTeX – new commands recognized as such you can fontify macros of choice by adding them to the variable font-latex-match-reference-keywords which is meant to list

Keywords for macros defining or related to references, like ‘\ref’.

Thus, to fontify the macros you mention add the following to your .emacs:

(setq font-latex-match-reference-keywords
  '(
    ("citeauthor" "[{")
    ("Citeauthor" "[{")
    ("cians" "[{")))