TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a main LaTeX file that has multiple chapter files included using \input command. For compiling them in emacs/auctex, I have to open main LaTeX and ^C^C.

How can I compile the main LaTeX from a chapter file?


I don't know exactly what happened, but I had to use ^C _ to specify the master file.


share|improve this question
up vote 5 down vote accepted

Add at the end of each chapter file

%%% Local Variables: 
%%% mode: latex
%%% TeX-master: "THEMAINFILE"
%%% End: 

to point AUCTeX to the main file. Furthermore, (quoting the AUCTeX manual)

if you often use \include or \input, you should make AUCTeX aware of the multi-file document structure. You can do this by inserting (setq-default TeX-master nil) into your init file. Each time you open a new file, AUCTeX will then ask you for a master file.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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