3

Suppose a book has only 4 chapters. Suppose each chapter has a ridiculously large number of sections, say, 100. A table of contents with depth=0 for this book will take only 1 page, whereas a table of contents with depth=1 will run to 20 pages.

For such a book, it would be great to have 2 consecutive tables of contents: the first would refer to chapters only, and the second would break down chapters into sections.

How could I do this?

In the following example, the second TOC gets blank.

\documentclass{book}
\begin{document}

\setcounter{tocdepth}{0}
\tableofcontents

\setcounter{tocdepth}{1}
\tableofcontents

\chapter{One}
\section{a} \section{b} \section{c} \section{d} \section{e}
\chapter{Two}
\section{a} \section{b} \section{c} \section{d} \section{e}
\chapter{Three}
\section{a} \section{b} \section{c} \section{d} \section{e}
\chapter{Four}
\section{a} \section{b} \section{c} \section{d} \section{e}

\end{document}
3

package shorttoc

\documentclass{book}
\usepackage{shorttoc}
\begin{document}
\shorttableofcontents{\contentsname}{0}

\setcounter{tocdepth}{1}
\tableofcontents



\chapter{One}
\section{a} \section{b} \section{c} \section{d} \section{e}
\chapter{Two}
\section{a} \section{b} \section{c} \section{d} \section{e}
\chapter{Three}
\section{a} \section{b} \section{c} \section{d} \section{e}
\chapter{Four}
\section{a} \section{b} \section{c} \section{d} \section{e}

\end{document}

you can use \shorttoc{\contentsname}{0}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.