# Two independent TOCs

I wonder if there is any way to achive two independent TOCs. For example I write a document and have my regular \tableofcontents right after my titlepage. For some reason I have a long appendix and one part of this appendix is really long with several subsections and subsubsections.

Is there a way to create my regular \tableofcontents (without the many subsections and subsubsections of the one appendix section) plus a special TOC just for those subsecions and subsubsections I skipped in my regular TOC?

The first part would be easy with \subsection*{...} but how to let them appear in the second TOC?

I'm aware of the minitoc package, but this needs all subsections to appear in my regular TOC.

I'm using MikTeX with pdfLaTeX and the scrartcl class if that is an important information. I'm a LaTeX user for many years but here my knowledge comes to an end. I searched for some time but wasn't able to find anything regarding this issue.

I hope my question is understandable, if not I'm happy to explain in more detail.

-

You could use the titletoc package; another option could be the minitoc package. Here's an example using titletoc:

\documentclass{scrartcl}
\usepackage{titletoc}

\begin{document}

\startcontents
\printcontents{ }{1}{}

\section{A Regular Section}
\subsection{First subsection}
\subsubsection{Subsubsection one one}
\subsubsection{Subsubsection one two}

\appendix

\section{A Long Appendix}
\stopcontents

\startcontents[sections]
\printcontents[sections]{ }{2}{}

\subsection{First subsection in Appendix}
\subsubsection{Subsubsection one one in Appendix}
\subsubsection{Subsubsection one two in Appendix}

\subsection{Second subsection in Appendix}
\subsubsection{Subsubsection two one in Appendix}
\subsubsection{Subsubsection two two in Appendix}
\stopcontents[sections]

\resumecontents
\section{A short appendix}
\subsection{First subsection in short appendix}
\subsubsection{First subsubsection in short appendix}

\end{document}


Using the optional argument for \startcoontents, \printcontents, and \stopcontents you can control the inner table of contents, allowing you to resume the global ToC.

The third mandatory argument of \printcontents can be used to produce headings for the ToCs, so, for example, for he general ToC one could use

\startcontents
\printcontents{ }{1}{\section*{\contentsname}}


and for the partial ToC (although perhaps this partial ToC doesn't require an explicit heading) you could say something like

\startcontents[sections]
\renewcommand\contentsname{Table of my Long Appendix}
\printcontents[sections]{ }{2}{\subsection*{\hspace*{1.2em}\contentsname}}

-
Wow... never expected such a quick answer. I just tried it, it just looks like what I was thinking of! Marvelous! –  S.H. Mar 21 '12 at 22:51
I integrated this solution in my document but another question appeared. How to integrate further appendix sections (after the long appendix) in the first TOC? My very long appendix is not the last section. I found \resumecontents but it seems not to work with nested \startcontents ... \stopcontents –  S.H. Mar 22 '12 at 11:26
@S.H.: please see my updated answer. –  Gonzalo Medina Mar 22 '12 at 12:15
Thank you Gonzalo, works like a charm! –  S.H. Mar 22 '12 at 15:23
While working with it now on a daily basis just one little question appeared. How to add for each TOC a different name. The first TOC would be "Table of Contents" as the second TOC should be "Table of My Long Appendix". Using \printcontents[Table of Contents]{}{1}{} created some errors and I tried to name the different TOCs accordingly with \startcontents[Table of Contents], but this resulted in this error: Missing number, treated as zero. –  S.H. Mar 29 '12 at 10:45