Andreas
Andreas

Reputation: 51

Annotated Table of Contents in LaTeX

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?

Upvotes: 2

Views: 2517

Answers (5)

riza
riza

Reputation: 17134

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

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

Upvotes: 0

Andreas
Andreas

Reputation: 51

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

Upvotes: 3

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.

Upvotes: 2

simon
simon

Reputation: 7032

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.

Upvotes: 1

Oliver Michels
Oliver Michels

Reputation: 2917

Try

\addcontentsline{toc}{section}{sample text}

Upvotes: 2

Related Questions