Generating just the Table of Contents

999 views
Skip to first unread message

neo

unread,
Mar 12, 2006, 6:36:43 PM3/12/06
to LaTeX Users Group
Hi there,
How can I generate just the table of contents in a latex file, i.e. I
would like the compiled pdf file to just include the table of contents
and not the contents of the chapters ?
Thanks in advance, neo

Jörg

unread,
Mar 22, 2006, 5:37:40 AM3/22/06
to LaTeX Users Group
Hello neo

one possibility could be:
0. remove the \tableofcontents in your tex.file
1. create a new file named "tabofcon.tex" with consist only of the line

\tableofcontents

2. include the file in your texfile by
\include{tabofcon}
at the place of your original \tableofcontents
3. compile all twice, so the pdf should be in the original shape
4. insert before\begin{document}
\includeonly{tabofcon}

then the pdf should only consists of your table of contents.

However I am not sure whether it really works with pdflatex, but with
"normal" Latex it works.

Cheers

Jörg

Martin

unread,
Mar 22, 2006, 11:58:25 AM3/22/06
to LaTeX Users Group

In case you have a main document and includes the parts by
\include{file.tex}, then by \includeonly{} you can obtain that only the
parts which are in the main document will be compiled.

main.tex
======
...
\includeonly{}

\include{chapter1}
\include{chapter2}
\include{chapter3}

\tableofcontents

When you compile this file first with the line \includeonly{} commented
and then, when the toc is created appropriately also with this line,
the resulting file will include only table of contents with the same
page numbers as in the original file.

I guess there's no difference whether you use latex or pdflatex (I've
tried this with latex only.)

Martin

neo

unread,
Mar 30, 2006, 4:32:53 PM3/30/06
to LaTeX Users Group
Guys thanks very much to both of you, will try both. Thanks, Tolga

Reply all
Reply to author
Forward
0 new messages