So setzen Sie das *gleiche* Inhaltsverzeichnis zweimal: einmal mit Tiefe 0 und dann mit Tiefe 1

So setzen Sie das *gleiche* Inhaltsverzeichnis zweimal: einmal mit Tiefe 0 und dann mit Tiefe 1

Angenommen, ein Buch hat nur 4 Kapitel. Angenommen, jedes Kapitel hat eine absurd große Anzahl von Abschnitten, sagen wir 100. Ein Inhaltsverzeichnis mit Tiefe=0 für dieses Buch umfasst nur 1 Seite, während ein Inhaltsverzeichnis mit Tiefe=1 20 Seiten umfasst.

Für ein solches Buch wäre es großartig, zwei aufeinanderfolgende Inhaltsverzeichnisse zu haben: Das erste würde sich nur auf die Kapitel beziehen und das zweite würde die Kapitel in Abschnitte unterteilen.

Wie könnte ich das tun?

Im folgenden Beispiel wird das zweite Inhaltsverzeichnis leer gelassen.

\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}

Antwort1

Paketshorttoc

\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}

Sie können verwenden\shorttoc{\contentsname}{0}

verwandte Informationen