# How can I create 2 TOCs: one short one and one comprehensive one with LyX?

I have a document (class = Book (Standard Class with Extra Font Sizes)) with many sections, subsections, and subsubsections. Therefore, I would like a "summary" TOC with only Part and Chapter shown. Then after that, I would like a comprehensive TOC with all the subsubsections shown. How can I do this? I have tried:

\setcounter{tocdepth}{0}
TOC
\setcounter{tocdepth}{4}
TOC


But the second TOC is blank in the resulting pdf...

• if you add \usepackage{etoc} to your preamble (assuming you use one of the standard classes), it should work. – user4686 Jan 20 '16 at 21:31
• @jfbu, you should formalize this as an answer. I actually prefer it to the existing answer because I don't have to change the class. – CephBirk Jan 21 '16 at 13:45

With the standard or KOMA classes you can add \usepackage{etoc} to the preamble, and then it is possible to use multiple times \tableofcontents command.

The code sample advocates \etocsetnexttocdepth{chapter} (for example), rather than \setcounter{tocdepth}{0}, for the reason that hyperref package takes into account the value of tocdepth to decide about what to put in its bookmarks. With the command \etocsetnexttocdepth{foo} you don't have to worry about after effects of changing tocdepth at it has only a one-shot impact.

\documentclass{book}
\usepackage{etoc}
\begin{document}
%\setcounter{tocdepth}{0}
% or use alternatively \etocsettocdepth, or:
\etocsetnexttocdepth{chapter}% not finer than chapters
\tableofcontents

%\setcounter{tocdepth}{4}
\etocsetnexttocdepth{paragraph}% all the way down to paragraphs
\renewcommand{\contentsname}{Detailed contents}
\tableofcontents

\part{ONE}
\chapter{Test chapter one}
\section{Section one one}
\subsection{Subsection one one one}
\subsubsection{Subsubsection one one one one}
\paragraph{Hello} At least I can speak.
\subsection{Subsection one  one two}
\section{Section one two}
\subsection{Subsection one two one}
\subsection{Subsection one  two two}

\chapter{Test chapter two}
\section{Section two one}
\subsection{Subsection two one one}
\subsection{Subsection two one two}
\section{Section two two}
\subsection{Subsection two two one}
\subsection{Subsection two  two two}
\section{Section two three}

\part{TWO}
\chapter{Test chapter three}
\section{Section three one}
\subsection{Subsection three one one}
\subsection{Subsection three one two}

\chapter{Test chapter four}
\section{Section four one}
\subsection{Subsection four one one}
\subsection{Subsection four one two}
\subsection{Subsection four one three}
\section{Section four two}
\subsection{Subsection four two one}
\subsection{Subsection four two two}
\subsection{Subsection four two three}
\end{document}


and then

If you used the memoir class (which includes extra font sizes) instead of the book class then you can do something like this:

\documentclass[...]{memoir}
...
\renewcommand*{\contentsname}{Short contents}
\setcounter{tocdepth}{0}% chapters and above
\tableofcontents
% clearpage
\renewcommand*{\contentsname}{Contents}
\setcounter{tocdepth}{2}% subsections and above
\tableofcontents


memoir doesn't discard the ToC data after the first use so you can have as many ToCs as you like positioned where you want them.