Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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.

share|improve this question
    
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. –  barbara beeton Dec 11 '12 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. –  Benedikt Bauer Dec 11 '12 at 13:21
    
@barbarabeeton I'm sorry for misleading you, but what I want is like @ Benedikt says. –  Haocheng Dec 11 '12 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. –  barbara beeton Dec 11 '12 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 Dec 11 '12 at 13:32
show 5 more comments

2 Answers

up vote 5 down vote accepted

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.

share|improve this answer
add comment

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.

share|improve this answer
1  
Are you sure about the asterisks? –  egreg Dec 11 '12 at 13:47
    
I took the whole example as it is from the documentation. –  Keks Dose Dec 12 '12 at 9:32
add comment

Your Answer

 
discard

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.