Multiple documents, multiple table of contents, in one file

To simplify the management of multiple books, I put all of them together into them together into one file, then used \cleardoublepage , \setcounter and a new titlepage environment to specify the beginning of the second document.

\documentclass \begin \begin This is the first title page. \end \tableofcontents \chapter \cleardoublepage \setcounter \begin This is the second title page. \end \tableofcontents \chapter \chapter \end
asked Dec 17, 2011 at 1:32 13.4k 24 24 gold badges 118 118 silver badges 221 221 bronze badges

LaTeX way of creating a table of contents is to write a line for each TOC entry into a file named \jobname.toc . (I.e. every time a \section or so is encountered.) The \tableofcontents macro basically (via the \@starttoc macro) reads in that file and clears it afterwards. Therefore, you can't "abuse" the \tableofcontents for your purpose.

Commented Dec 17, 2011 at 1:54

It might be a better solution to have them in different files and then join only the pdfs with the iad of the pdfpages package. PS. It's a pity that you deleted your question about "omitting" once-used counters: this is something many people might find useful, I was just about to start coding that;).

Commented Dec 17, 2011 at 2:00

The titletoc package, for example, would let you have multiple independent ToCs, but simply resetting the page counter will produce problems with hyperref (the typical pdfTeX warning (ext4): destination with the same identifier (name) has been already used, duplicate ignored warnings). It's better to work on different .tex files and possibly use xr or to use memoir (as suggested in another of your questions).

Commented Dec 17, 2011 at 2:12

Oh, sorry, I thought that question was not a good question because I found inparaenum does what I needed. Now, I see maybe others need that too. I have reposted the question.