Is there a way to make a single page table of contents in this style
Introduction ..................................... 1
Next Point ....................................... 2
Without generating it from a LaTex-Document? I printed a bundle of scripts for programming classes that are not written in latex but i want to have a clean table of contents with a custom of the pages.
Thank you.
Best Answer
The lines of the table of contents are generated using
\contentsline
. You can also call this macro yourself to create a toc manually. The general syntax isand if you want these entries to be numbered you should insert
\numberline{<section number>}
at the start of the second argument. To use thechapter
level heading you need to use a document class that supports it (likebook
orreport
).Here is an example. I'm numbering only half of the sections to illustrate how this works and what the result looks like.
Here is a version that takes care of the section numbers automatically.
In a document class with actual chapters,
\tocchapter
could be implemented in the same way.If you need to customise the appearance of the toc you can use either
titletoc
ortocloft
.For instance, if you don't want the to be in boldface and you want them to come with (the dots), you could add the following to your preamble:
If you only use section level headings, this would match the appearance described in your question.
Remark:
\contentsline
takes an additional argument ifhyperref
is loaded (the target for the hyperlink). If someone reading this wants to incorporate the above in a document that useshyperref
, you should add an additional{}
after{<page>}
.