3

This question already has an answer here:

I have a large document that contains many different chapters which reference each other. The body of the main latex file looks something like:

\maketitle
\tableofcontents

\include{chapter1}
\include{chapter2}
...
\include{chapter10}

I wish to create several documents that only contain selected chapters (i.e. chapters 3 and 8). These chapters should be numbered the same as they are in the main document so the nice latex auto-numbering is less than helpful in this case. I know I can use \setcounterdepth to make sure the chapters are numbered as I wish so that's not a problem. However, once I am no longer including a chapter, latex doesn't know where to point the reference to.

Is there any solution where the compiler looks at all of the files but only actually includes some in the compiled document?

I also want only the included chapters to be in the TOC. Not sure if that would complicate the problem at hand.

marked as duplicate by Werner sectioning Dec 18 '15 at 4:37

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • The first part of your question can easily be achieved by using, for example, \includeonly{lions,zerbras} Note that this assumes that the necessary .aux files are already in place. You can read further details in How to create individual chapter PDFs The part of your question related to the toc is quite tricky. – cmhughes Nov 9 '13 at 22:18