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)

  • You don't need to mark every edit with 'edit:', especially not small ones ;-). Using LaTeX is the default here anyway, so you don't need to mention that. – Martin Scharrer May 5 '11 at 10:01
  • Is the other document also a LaTeX document which is able to produce a ToC by itself? – Martin Scharrer May 5 '11 at 10:02
  • Well yes, but my point is that that it could be anything, I just need to be able to insert its structure using the TOC look – MP0 May 5 '11 at 12:22

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


\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*:

\section*{Some other ToC}
\contentsline {chapter}{\numberline {1}Chapter text}{1}{}
\contentsline {section}{\numberline {1.1}Section text}{1}{}
\contentsline {subsubsection}{Subsubsection text}{8}{}
| improve this answer | |
  • I guess this could fit in a minipage environment ? – MP0 May 5 '11 at 13:29
  • 1
    @EEva: Yes, see my updated answer. – Martin Scharrer May 5 '11 at 13:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.