# AucTeX - insert environment menu command

I have a big LaTeX project divided in many files; the \documentclass statement and the preamble are in the main file, that in turn includes many (~20) other files, one for every chapter. One of the statements in the main file is \usepackage{paralist}, in order to use the environment compactdesc.

Visiting the main file, in the AucTeX LaTeX -> Insert Environment menu, compactdesc is listed; and M-Enter inside the environment inserts an \item and asks for the label of that item.

Visiting one of the included file, the lack of a \usepackage causes no inclusion of the compactdesc environment in the LaTeX -> Insert Environment menu list; and I don't like that.

Giving the command M-x LaTeX-environment followed by compactdesc, inserts in the file a \begin{compactdesc}-\end{compactdesc} couple, but M-Enter does not ask for the item label - and I would like to be able to enter the labels for every \item added.

I have tried with the local variables at the end of the file, inserting the lines

% Local Variables:
% mode: latex
% TeX-master: master.tex
% ispell-local-dictionary: "italian"
% End:


(where master is the main TeX file); but still LaTeX -> Insert Environment does not know about compactdesc.

How can I do, to have both 1) the environment compactdesc available and 2) AucTeX knowing about items of that environment having a label?

Thank you in advance for any help.

• TeX-master-file must be a string, this is exactly the same problem as the one reported here: emacs.stackexchange.com/q/20007/620 A good practice is to add this line to the init file: (setq-default TeX-master nil) – giordano Feb 10 '16 at 12:05
• If you confirm your question is essentially answered by the link above we can mark this question as duplicate (the titles are really different, but I think the main problem is the same: wrong setting of TeX-master-file). – giordano Feb 10 '16 at 12:15
• BTW, thanks for your theory of errors book ;-) – giordano Feb 10 '16 at 12:18
• No, my question has not been answered. Putting the master file name between double quotes (in the local variables at the end of the file) does not add any compactenum entry in the list of environments. BTW, I have found mention of TeX-master in the manual, not of TeX-master-file; I tried with both version, with the same result. – Maurizio Loreti Feb 10 '16 at 13:44
• Thank you for remembering my book, the work of all my life; happy to hear that has been useful to somebody 8^) – Maurizio Loreti Feb 10 '16 at 13:47

I experimented a little bit more. I added to the master file the local variable (at the end of the file) %%% mode: latex — that did the trick (in addition to the %%% TeX-master: "master" local variable in the included files).
• No, I experimented a little bit more. I added to the master file the local variable (at the end of the file) %%% mode: latex - that did the trick (in addition to the %%% TeX-master: "master" local variable in the included files. End of the thread. – Maurizio Loreti Feb 10 '16 at 16:01
• So you had to specify the mode in your master file? If so, it's really strange: Emacs should be able to figure out the mode by itself, that line is just for more safety, but all .tex files are opened with AUCTeX, if installed, and it should be the case for you as well, otherwise you couldn't issue C-c C-n in your master file. – giordano Feb 10 '16 at 20:51