I use AUCTeX. AUCTeX has inserted a comment at the end of my test4.tex file that reads:

%%% TeX-master: "test3"

What does it mean?

When I try to compile and pdf-print test4.tex, the document that gets opened is test3.pdf. Why?

  • 5
    It says “C-c C-c runs LaTeX on test3.tex instead of the file corresponding to the current buffer”. Useful if you are working on a subfile and want to compile the main document, instead. – egreg May 14 '17 at 10:04

The tex master tells emacs which document to pass to latex.

So you can have a section or even just a single equation in a file that is \input into your master document, and when you use C-c C-c or any other command that requires a full document, then the master document will be run.

  • Whenever I C-c C-c a new document, AUCTeX asks what the master document should be. If I understand you correctly, this means that I should normally choose the document that I am working on, right? – Evan Aad May 14 '17 at 10:08
  • @EvanAad it should default to that, ie if you just hit return it will do the right thing. – David Carlisle May 14 '17 at 10:15
  • OK. Here's something I don't understand. When I create a new .tex document it asks me to provide a master file, but it doesn't give me as a default the file that I'm creating; instead it gives as default the currently open .tex document. Is this how it's supposed to act? – Evan Aad May 14 '17 at 10:24
  • 1
    Your settings must be different as for single file documents I don't have the comment at all, but the behaviour you suggest isn't unreasonable if you think of a model where your master document is "thesis.tex" for 3 years but during that time you want to open many other files for individual sections. However this is emacs any behaviour is configurable if you don't like it;-) – David Carlisle May 14 '17 at 10:33
  • @EvanAad - You can customize TeX-master, check the documentation for options. – Arash Esbati May 14 '17 at 10:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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