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 am writing a large document with several chapters and I would like to work on each chapter separately. In my main.tex I include the chapters either like




I think \include is preferable if I want things to be referenced and cited correctly? but doing it the \include way latex main.tex I don't get any dvi output whereas with \input things compile fine to dvi. What's going wrong here?

I would then like to use \includeonly (or \excludeonly ) to work on individual sections of the document whilst maintaining the referencing etc.

thanks for any help.

share|improve this question
I don't know if this is related to your problem, but I think you could remove the file extensions. Otherwise, perhaps a minimal working example (MWE) would help. – Corentin Dec 14 '12 at 11:23
I believe you should use \include at the level of a control file calling files for your chapters. On a related note, I found that \include is problematic inside a \chapter. So \input is also handy. – apexofservice Dec 14 '12 at 11:26
@Corentin good catch: I missed that in my answer. – David Carlisle Dec 14 '12 at 11:26
@fpghost You might want to look at When should I use \input vs. \include?, which looks quite similar to this question. – Joseph Wright Dec 14 '12 at 11:29
@Corentin that fixed it, thanks a lot – fpghost Dec 14 '12 at 11:35
up vote 27 down vote accepted

Cross referencing and citation should work fine with \input. input is more or less invisible to the TeX processing, it just allows you to split up the file into smaller units for ease of editing.

If you do not use \includeonly then \include{file} is more or less the same as \clearpage\input{file}\clearpage so like \input but with forced page breaks. Since your chapter head probably forces a page break anyway this means that switching between \input and \include should not affect output.

If you use \include then you can use \includeonly to speed up processing by just typesetting specified chapters. Note however that it will use old aux files for the other chapters to get the numbering more or less correct. Thus you should occasionally (and initially) process the file without \includeonly so that all chapters are processed and usable aux files are generated for each chapter.

As noted by @Corentin in the comment, in the case of \include it is important that you use the file name without .tex at the end: \include{file1} not \include{file1.tex}.

share|improve this answer
Is it worth noting that \include is mainly for chapters? – Joseph Wright Dec 14 '12 at 11:28
@JosephWright Well if your style also has sections within chapters starting a new page, it's fine to use include for sections as well. It is the page break rather than the sectioning depth that is important. – David Carlisle Dec 14 '12 at 11:31

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.