4

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: http://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
  • Sorry, my mistake: TeX-master. After you apply the change, you have to revert the buffer, use C-c C-n for that – giordano Feb 10 '16 at 14:06
  • ... I did that. I also quitted and restarted emacs, and added to .emacs the lines (setq-default TeX-master nil), (setq TeX-parse-self t) and (setq TeX-auto-save t). If it matters, I have AucTeX 11.88, emacs 24.5 (macports), OS X 10.11.3 . – Maurizio Loreti Feb 10 '16 at 14:16
  • As said in my answer to the linked question, the path to the master file should be without extension ;-) The best way yo set the master file is using C-c _, which is run by default on a new *TeX file when TeX-master defaults to nil. From now on, you'll be asked for the master file every time you create a new file and you won't for sure make mistakes – giordano Feb 10 '16 at 14:25
  • I have read and understood your answer; and the master file name was without extension. I confirm that your suggestions do not work. – Maurizio Loreti Feb 10 '16 at 14:44
  • Try issuing C-c C-n in your master file, and then restart Emacs. – giordano Feb 10 '16 at 14:54

1 Answers1

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. – 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
  • Please don't add "thank you" as an answer. Instead, accept the answer that you found most helpful. - From Review – Drew Apr 11 '16 at 05:53
  • @Drew It's hard to accept an answer when there is none! – Gilles 'SO- stop being evil' Apr 11 '16 at 08: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. – Gilles 'SO- stop being evil' Apr 11 '16 at 08:19
  • @Gilles: Uh, that text in my comment was put there automatically by SE. Before you edited this answer it was only a "thank you" - not an answer, and I chose that reason, among the available possibilities, when voting to close it as a low-quality answer. – Drew Apr 11 '16 at 14:12