Two independent TOCs
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
\renewcommand\contentsname{Table of Contents}% if a change of the default "Contents" name is required
\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}}
You can use the etoc package.
\documentclass{scrartcl}
\usepackage{etoc}
\begin{document}
\tableofcontents
\section{A Regular Section}
\subsection{First subsection}
\subsubsection{Subsubsection one one}
\subsubsection{Subsubsection one two}
\appendix
\etocsettocdepth.toc{section}% will be obeyed by main TOC
\section{A Long Appendix (with its own TOC)}
\etocignoretoctocdepth % of course, if we want to see something in local TOC...
\etocsettocstyle{\subsection*{\contentsname}}{}
\localtableofcontents
\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}
\etocsettocdepth.toc{subsubsection}% will be obeyed by main TOC
\section{A short appendix}
\subsection{First subsection in short appendix}
\subsubsection{First subsubsection in short appendix}
\end{document}
Observe that the indents of the local TOC (as in the other answer) are as if the material was printed as part of the main TOC. To modify this, various ways, one of the most accessible being via using tocloft
which allows easily modify such indents.