# AUCTeX problem when splitting documents

I have a problem using AUCTeX style files when a document is broken into a main file and a preamble. For instance, say my preamble is contained in the following file preamble.tex:

% --------- preamble.tex begins here -----------
\documentclass{article}
\usepackage{csquotes}
\usepackage{tcolorbox}
% --------- preamble.tex ends here -----------


And my document document.tex is this one:

% --------- document.tex begins here -----------
\input{preamble.tex}
\begin{document}
Lorem ipsum...
\end{document}
%%% Local Variables:
%%% mode: latex
%%% TeX-master: "preamble"
%%% End:
% --------- document.tex ends here -----------


The problem is that AUCTeX doesn't know that I am using csquotes and tcolorbox packages, and thus it doesn't load the corresponding style files. Note I have included the TeX-master instruction.

(Of course, if I join the two files in one, AUCTeX is aware of my packages and everything works just fine.)

How can I fix this?

Thanks.

• I think I already answered you in the AUCTeX mailing list. – giordano Sep 7 '16 at 1:25

Issue C-u C-c C-n (or from menu LaTeXMultifile/ParsingReset AUCTeX) in preamble.tex's and then in document.tex's buffer, in this order.
Please note that the TeX-master-file variable is wrongly set. It refers to the main file, the file you actually compile, which is document.tex. In document.tex you should set to t, and in preamble.tex to "document".