6

I'm writing my thesis, and there's a overall file overall.tex together with several section files, which are \inputed in the overall.tex.

Could I write something in the section files to prevent them from being compiled, which will certainly fail, producing some unneeded aux files. In an other word, to prevent compiling the section file by mistake.

I'm using XeLaTeX and AuCTeX.

10
  • Welcome to TeX.sx! since you're using \input, there are two ways to avoid the processing of the section files: (1) comment out the reading in, i.e. %\input{...}; (2) at the beginning of the "unwanted" section file, insert \endinput as the first line. commenting out in the overall file may be easier to remember when you're under pressure, as it's more obvious. Commented Dec 11, 2012 at 13:17
  • @barbarabeeton I understand the question a bit different. I think the OP wants to prevent that he by mistake compiles one of the input files instead of the main document. Compiling an input file will certainly fail as it doesn't contain a preamble but produces a bunch of useless auxiliary files that have to be deleted afterwards. Commented Dec 11, 2012 at 13:21
  • @barbarabeeton I'm sorry for misleading you, but what I want is like @ Benedikt says.
    – Haocheng
    Commented Dec 11, 2012 at 13:24
  • @BenediktBauer -- i just tested what you suggest -- compiling a file without a preamble, the first line starting with \section{...}. it failed at once with the error ! Undefined control sequence. after killing it with x, i checked what files were present. no .aux file was created. so i think we need a clarification from the OP. Commented Dec 11, 2012 at 13:27
  • 1
    And what about using the %!TEX root = in the \include/\input files? It is useful and many TeX editors supports it.
    – m0nhawk
    Commented Dec 11, 2012 at 13:32

2 Answers 2

5

This question on StackOverflow solves my problem, which requires function supplied by AuCTeX: Emacs/AUCTex: run command on file that is not currently open.

The simplest way is M-x TeX-master-file-ask, which is suggested by @Chris Conway in the comment of 1.

2

After I read all the comments, including the information of Haocheng that he employs Emacs and AUCTeX, the answer probably is to give Emacs the information about "multifile documents", see here: http://www.gnu.org/software/auctex/manual/auctex/Multifile.html#Multifile

In short something like:

%%% Local Variables: ***
%%% mode:latex ***
%%% TeX-master: "thesis.tex"  ***
%%% End: ***

See here http://www.gnu.org/software/auctex/manual/reftex/Multifile-Documents.html as well.

2
  • 1
    Are you sure about the asterisks?
    – egreg
    Commented Dec 11, 2012 at 13:47
  • I took the whole example as it is from the documentation.
    – Keks Dose
    Commented Dec 12, 2012 at 9:32

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .