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 am working on a multi-chaptered document, tied together with a main tex file that pulls the chapters in via \include. To build the entire document, in its current draft form, can take upwards of 15-20 minutes, depending on the machine I am working on. I am wondering if there is a way that I could choose to typeset only one specific chapter at a time without having to restructure my whole setup. Any ideas?

share|improve this question
1  
Use \includeonly in the preamble. Done! –  xport Jan 6 '11 at 16:31
    
15-20 minutes!? That seems like an awfully long time. What's in this book? –  Seamus Jan 6 '11 at 16:37
    
Hah, about 7 gazillion figures. It seems to bog down most when I include the image-heavy chapters. –  mrdillon Jan 6 '11 at 17:01
3  
@mrdillion: you do not need to insert all the figures every time! If only text chnages are important use draft as optional argument for the documentclass or alternatively as option for \includegraphics for single big images and change it in a final run to final or simply delete the draft option. –  Herbert Jan 6 '11 at 17:06
    
I'd say it's a duplicate of this question, but the title of that question is not really helpful ... –  Hendrik Vogt Jan 7 '11 at 14:09

2 Answers 2

up vote 9 down vote accepted

If you are using \include for your chapters, then you can use \includeonly to include just specific chapters.

e.g.

\documentclass{book}
\includeonly{Chap2} % will cause just Chap 2 to be included
\begin{document}
\include{Chap1}
\include{Chap2}
\include{Chap3}

\end{document}
share|improve this answer
2  
or altenatively also \excludeonly which needs the package of the same name. –  Herbert Jan 6 '11 at 16:37

Include all chapters in the body using \include macro (to make cross references work properly) and specify the chapter to be rendered using \includeonly in the preamble.

Cross references will still work properly even thought you just render only one chapter.

\documentclass{book}
\includeonly{ch01}
\begin{document}
\include{ch01}
\include{ch02}
\include{ch03}
\end{document}
share|improve this answer
3  
You have to run at least one time all chapters to create the auxiliary files. –  Herbert Jan 6 '11 at 16:40

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.