I am writing a long document with many chapters. They are all included from a root document using \input{chapterX.tex} etc. Compiling everything takes pretty long.

As a workaround to make compilation faster, I typically comment out most \input commands and include only the chapter I'm currently working on. But that's a bad method because then the references to chapters that are not currently included won't work, and the table of contents is almost empty.

I'm wondering if there is a method that does precompilation? Ideally, it would detect that, while I am working on chapter1.tex, nothing in chapter2.tex etc. has changed, and reuse the results from previous compilation runs.

Is that possible? It would be like separate compilation units in languages like C.

up vote 29 down vote accepted

You can't precompile chapters, but you can use the \includeonly mechanism to ensure that your cross-references and page numbers stay correct while choosing to only include parts of your source.

  • Great, that's pretty much what I wanted. Thanks! – Frank Aug 18 '10 at 19:49

Extending Joseph's answer a bit: This mean that you use \include and not \input for including the desired chapters. See here for example usage.

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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