Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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)

share|improve this question
    
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 –  EEva May 5 '11 at 12:22

1 Answer 1

up vote 2 down vote accepted

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}
share|improve this answer
    
I guess this could fit in a minipage environment ? –  EEva May 5 '11 at 13:29
1  
@EEva: Yes, see my updated answer. –  Martin Scharrer May 5 '11 at 13:42

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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