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).

    \includeonly{%here, chap2 only will be compiled
%       chap1,
%       chap3

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.)

  • 3
    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...
    – ebosi
    Jun 19, 2017 at 20:47
  • @ebo do you need bibliography and toc mid-production? Jun 19, 2017 at 21:23
  • 1
    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

1 Answer 1


Just think that adding a page in a chapter changes all page numbers... adding a figure may change table of figures and extend it to a new page... a citation may change the order of all citations... So, you can not do what you ask for. LaTeX supposed to be clever typesetting system because it uses every letter to decide what to do with rhe whole document.

  • I am aware that not updating some chapters of my document would mean these chapter (namely page numbers, hyperlinks, toc, etc.) not up-to-date anymore. I also know that updating these information basically means recompiling those chapters (what I'd like to avoid). I'm thus rather focusing on including the content of these chapters in the produced document. That is, trading a large (and potentially frequent) compilation time against a bit of not up-to-date minor information. (Note that each chapter starts on a new (right) page, what would things a bit easier.)
    – ebosi
    Jun 19, 2017 at 20:53
  • This is not completely true: \include can help. But when page numbers change, the document has to be fully typeset.
    – egreg
    Jun 19, 2017 at 21:04
  • Yes... it starts in a new page... but it could need a new empy page before and different numbers for every page... LaTeX can not know that you don't care about the wrong numbers... the extra pages etc... It has to give an updated document using the changes it sees ... I can understand your point... but this is something that not needed to almost anybody (than you)... everybody can work with the only updated chapter or with the whole book... The functionality you ask for is too complicated for what offers... May be a script could do that... but not LaTeX... LaTeX has to be more "correct"
    – koleygr
    Jun 19, 2017 at 21:06
  • Just think that the numbers of the equations could be all defferent... etc... LaTeX has to do a serious job... and can not decide that you don't need serious job for the moment...
    – koleygr
    Jun 19, 2017 at 21:08
  • 1
    (Disclaimer: I voted for this question not to be deleted.) @koleygr I'd say that the one who flagged your answer (I don't thinks it's Henri) might have thought your answer rather looks like a comment than an elaborated answer. You might want to highlight your point at the beginning of your answer. The automatic comment from review is a bit 'raw', and it might be difficult not to take it personally though - I totally understand.
    – ebosi
    Jun 19, 2017 at 22:27

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .