[Tex/LaTex] Extra table of content in the document

table of contents

How could I produce an extra table of content ?

I want to add a TOC describing the content of another document, is that possible in a simple way ? I know I could write the style and everything but I'd like something à la minipage with new sections in it.

(edit: I use LaTeX)

Best Answer

The ToC is generated by a set of \contentsline macros which are written into a .toc file by the sectioning macros. You can use that macro to produce your own ToC. If your other document is also a LaTeX document than you could use its .toc file as a base.

The format of \contentsline (with hyperref loaded) is:

\contentsline {<type>}{<content, may include \numberline>}{<page>}{<label>}

Example:

\contentsline {chapter}{\numberline {1}Chapter text}{1}{chapter.1}
\contentsline {section}{\numberline {1.1}Section text}{1}{section.1}
\contentsline {subsubsection}{Subsubsection text}{8}{section*.3}

You might not need to provide anything for the labels because that ToC will most likely not be hyperlinked.

If you want that ToC to be smaller than normal put it into a \scalebox{<factor>}{<content>} and scale it down. If you place it inside a {minipage}{<width>} environment it will be drawn with this given width. You need to add the ToC heading by yourself using \chapter* or better \section*:

\begin{minipage}{8cm}
\section*{Some other ToC}
\contentsline {chapter}{\numberline {1}Chapter text}{1}{}
\contentsline {section}{\numberline {1.1}Section text}{1}{}
\contentsline {subsubsection}{Subsubsection text}{8}{}
\end{minipage}
Related Question