views:

1130

answers:

6

I'd like to use LaTeX's \tableofcontents command (or some equivalent) to automatically generate a table of contents, but I'd also like to add a sentence or two to each line in the table of contents that describes what the referenced section is about. How can I do this?

+2  A: 

Try

\addcontentsline{toc}{section}{sample text}
Oliver Michels
+1  A: 

I expect you can brute force and ignorance something using addcontentsline. eg:

\addcontentsline{toc}{section}{text}

however, this will conflict with automagically generated lines if you don't use the starred versions of sections it refers to.

Anything more clean will require messing about with the relevant macros....unless I'm missing something.

simon
+2  A: 

Follwoing Oliver and simon's advice:

You could redefine the sectioning commands to take a second (possibly optional) argument, and use that to build your argument to \addtocontentsline, and then involk the cooresponding section* command.

dmckee
Thanks! Using your method, I can make it look like this:http://i43.tinypic.com/34jcaat.png -- not perfect, since it would be preferable if the page numbers and dots were in line with the headings, but much better than no annotations!
Andreas
+3  A: 

The tocloft package and its \cftchapterprecistoc command solved my problem.

Andreas
The memoir class also provides this functionality (since it's by the same author)
Will Robertson
A: 

Does anybody know how to eliminate de name of a section or subsection in the table of contents? I have proved *\section{name of the section} but this eliminates de number od the section in the document and I don't want this happen.

Any ideas?

Thanks!

A: 

I would change the {section} part to {subsection}.

\addcontentsline{toc}{subsection}{sample text}
Selinap