# AUCTeX: Turn on syntax highlighting for natbib commmands under BibLaTeX

I'm using natbib commands like \citep and \citealt under BibLaTeX thanks to the option natbib=true. Yet AUCTeX won't highlight them the way it highlights, for example, \cite (or \parencite, which is the BibLaTeX equivalent of \citep).

I'm using AUCTeX 11.89.7 on Emacs 24.5.1 (i686-pc-mingw32).

How can I change this?

Update:

Only files other than the master file seem to be affected.

master file (test.tex):

\documentclass{article}

\usepackage[natbib=true]{biblatex}

\begin{document}

\cite{}
\parencite{}
\citep{}
\citealt{}

\input{test2.tex}

\end{document}


test2.tex:

\cite{}
\parencite{}
\citep{}
\citealt{}

%%% Local Variables:
%%% mode: plain-tex
%%% TeX-master: "test"
%%% End:


• These are highlighted by default for me. What version of Emacs and AucTeX are you using? Can you post a minimal example .tex file? Dec 2 '16 at 20:56
• @Tyler I've updated the question.
– Timm
Dec 2 '16 at 21:29
• Thanks. It would be nice to post the text of your files as well as the screenshots, so we don't have to retype it! Dec 2 '16 at 21:45
• @Tyler Ups. Here it is.
– Timm
Dec 2 '16 at 21:50
• Ok, thanks. Why are you setting the mode to plain-tex? Dec 2 '16 at 21:57

This looks like a bug to me. You added the link to the master file to your file-local variables via C-c _, as you should. And as you note in the comments, this automatically inserted the mode: plain-tex line. This isn't what you want though, as the master file is in LaTeX mode. If you manually change your file-local variables to the following, it should work:

 %%% Local Variables:
%%% mode: LaTeX
%%% TeX-master: "test"
%%% End:


You may need to reparse the file first (C-c C-n).

PS. To be clear, the bug here is getting the wrong mode variable set by C-c _. Everything else seems to work as expected.

• sorry, used the wrong TeX-master file name. Corrected. Dec 2 '16 at 22:11
• AUCTeX does not try at all to guess the mode from the master file. Do you suggest it should? Dec 10 '16 at 13:21
• @giordano yes! I think the usual case is for multifile documents to combine files of the same type, so it would be least surprising to the user if the default behaviour respected this. The current question is a good example of this. Dec 10 '16 at 16:44
• We'd need to visit the master file before storing the local variables to the new file. Currently this isn't done, but I think I'll do it. Thank you! Dec 10 '16 at 16:50
• This feature is now in AUCTeX. Thanks for pointing this out ;-) Dec 20 '16 at 23:00