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, 2016 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, 2016 at 12:15
  • BTW, thanks for your theory of errors book ;-)
    – giordano
    Feb 10, 2016 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. Feb 10, 2016 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^) Feb 10, 2016 at 13:47

1 Answer 1


Well, the last suggestion did the magic... So I have to download the master file first and the included file second? No problem. Thank you, giordano, for your suggestions and your tolerance.

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. Feb 10, 2016 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, 2016 at 20:51
  • Please don't add "thank you" as an answer. Instead, accept the answer that you found most helpful. - From Review
    – Drew
    Apr 11, 2016 at 5:53
  • @Drew It's hard to accept an answer when there is none! Apr 11, 2016 at 8:17
  • Which “last suggestion” are you talking about? I don't understand why you mention downloading here — what's being downloaded? Please make your answer self-contained. Comments may be removed at any time. Apr 11, 2016 at 8:19

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.