# How to compile/update parts of my document only, while still producing a complete document?

Context: When I write a large document, I write each chapter in a different file. All these subfiles are then included (using \include{<subfile name>}) in a main file to constitute my document.

When I work on a specific chapter, I use the \includeonly command to only compile this specific chapter (and thus speed-up the compilation).

\documentclass{scrbook}
\includeonly{%here, chap2 only will be compiled
%       chap1,
chap2,
%       chap3
}
\begin{document}
\include{chap1}
\include{chap2}
\include{chap3}
\end{document}


Problem: As made obvious by its name, the \includeonly command only includes listed subfiles in the compiled document. This makes that in my case, the document produced contains only one chapter.

However, I'd like to have all chapters included in the document produced.

Question: How to make LaTeX update only one chapter (shorter compiling time) while still producing a .pdf that contains every chapter (full document)?

Note: I want the "\updateonly" command to be versatile, i.e. to easily change the chapter(s) to be updated (or even recompile everything). I would also like to keep auxiliary data untouched (macro definition, cited references, hyperlinks [those from not updated chapters pointing on elements of the updated chapter might obviously be broken, though], acronyms, etc.)

• there is no standard way to do this. Jun 19, 2017 at 19:45
• You can have a separate document for each chapter and combine them into one document using pdfpages. Jun 19, 2017 at 20:22
• @MichaelFraiman Thank you. I imagined this solution - however, I don't find it "versatile" enough as is. I'm also not quite sure how I could generate one ToC and one Bibliography based on multiple separate documents... Jun 19, 2017 at 20:47
• @ebo do you need bibliography and toc mid-production? Jun 19, 2017 at 21:23
• ther was a long and somewhat fractious series of questions earlier in the year with someone asking questions while trying to implement a system like this, but all the questions were doomed to have unsatisfactory answers as the facility isn't really implementable. I'll see if I can find the link... Jun 19, 2017 at 22:11

• This is not completely true: \include can help. But when page numbers change, the document has to be fully typeset. Jun 19, 2017 at 21:04