3

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}

master file

test2.tex:

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


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

test2.tex

6
  • These are highlighted by default for me. What version of Emacs and AucTeX are you using? Can you post a minimal example .tex file?
    – Tyler
    Dec 2, 2016 at 20:56
  • @Tyler I've updated the question.
    – Timm
    Dec 2, 2016 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!
    – Tyler
    Dec 2, 2016 at 21:45
  • @Tyler Ups. Here it is.
    – Timm
    Dec 2, 2016 at 21:50
  • Ok, thanks. Why are you setting the mode to plain-tex?
    – Tyler
    Dec 2, 2016 at 21:57

1 Answer 1

3

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.

6
  • sorry, used the wrong TeX-master file name. Corrected.
    – Tyler
    Dec 2, 2016 at 22:11
  • AUCTeX does not try at all to guess the mode from the master file. Do you suggest it should?
    – giordano
    Dec 10, 2016 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.
    – Tyler
    Dec 10, 2016 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!
    – giordano
    Dec 10, 2016 at 16:50
  • 1
    This feature is now in AUCTeX. Thanks for pointing this out ;-)
    – giordano
    Dec 20, 2016 at 23:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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