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.

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

\documentclass{book}
\begin{document}
    \begin{titlepage}
        This is the first title page.
    \end{titlepage}
    \tableofcontents
    \chapter{This chapter should appear in the first title page}

    \cleardoublepage
    \setcounter{page}{1}
    \begin{titlepage}
        This is the second title page.
    \end{titlepage}
    \tableofcontents
    \chapter{This chapter should appear in the first second page}
    \chapter{This chapter should also appear in the first second page}
\end{document}

However, the first tableofcontents loads displays all chapters and the second tableofcontents shows no chapters.

  • Is \cleardoublepage and \setcounter{page}{1} the proper way to reset the document?
  • How can I have more than one table of contents within the same file?
share|improve this question
    
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. –  5gon12eder Dec 17 '11 at 1:54
1  
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;). –  mbork Dec 17 '11 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{page.4}) 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). –  Gonzalo Medina Dec 17 '11 at 2:12
1  
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. –  Village Dec 17 '11 at 2:12

1 Answer 1

up vote 6 down vote accepted

The titletoc package provides the tools that you want using \startlist{toc} and \printlist{toc}.

See Section 7.4 of the documentation for more details- a complete MWE follows.

\documentclass{book}
\usepackage{titletoc}

\begin{document}

\begin{titlepage}
        This is the first title page.
\end{titlepage}

\startlist{toc}
\printlist{toc}{}{\section*{My first toc}}
\chapter{This chapter should appear in the first title page}

\cleardoublepage
\setcounter{page}{1}
\begin{titlepage}
       This is the second title page.
\end{titlepage}

\startlist{toc}
\printlist{toc}{}{\section*{My second toc}}

\chapter{This chapter should appear in the first second page}
\chapter{This chapter should also appear in the first second page}

\end{document}
share|improve this answer

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.