I would like to achieve table of contents with additional description for chapters/sections (see screenshot). What way would you go to achieve this? I'm wondering if it is possible to wrap the \chapter, \section etc. commands with custom taking 2 parameters. But how to generate the ToC then?

-

You can use \addcontentsline{toc}{<sec_unit>}{<text>} or directly \addtocontents{toc}{<text>} to enter text to the .toc file. The only issue is to indent to text correctly.

Below some code which uses the book class and its internal macros. Its adds ''info'' lines which use basically the same formatting macros as the sectioning lines (for identical indention), but avoid the '.... (page number)' part. If you really want to give \chapter etc. two arguments you can do something like

\let\Chapter\chapter \def\chapter#1#2{\Chapter{#1}\chapterinfo{#2}}


Here the code:

\documentclass{book}

\makeatletter
% Basically the same as for \l@section etc, just \@nodottedtocline instead of \@dottedtcline:
\newcommand*\l@chapterinfo{\@nodottedtocline{0}{0.0em}{1.5em}}
\newcommand*\l@sectioninfo{\@nodottedtocline{1}{1.5em}{2.3em}}
\newcommand*\l@subsectioninfo{\@nodottedtocline{2}{3.8em}{3.2em}}
\newcommand*\l@subsubsectioninfo{\@nodottedtocline{3}{7.0em}{4.1em}}
\newcommand*\l@paragraphinfo{\@nodottedtocline{4}{10em}{5em}}
\newcommand*\l@subparagraphinfo{\@nodottedtocline{5}{12em}{6em}}

% Copied from the book class macro \@dottedtocline. Removed the dots and page number
\def\@nodottedtocline#1#2#3#4#5{%
\ifnum #1>\c@tocdepth \else
\vskip \z@ \@plus.2\p@
{\leftskip #2\relax \rightskip \@tocrmarg \parfillskip -\rightskip
\parindent #2\relax\@afterindenttrue
\interlinepenalty\@M
\leavevmode
\@tempdima #3\relax
{#4}\nobreak
\leaders\hbox{$\m@th \mkern \@dotsep mu\hbox{\,}\mkern \@dotsep mu$}\hfill
\nobreak
\hb@xt@\@pnumwidth{\hfil\normalfont \normalcolor }%
\par}%
\fi}

\makeatother

\def\chapterinfo#1{%
\noexpand\numberline{}#1}%
}
\def\sectioninfo#1{%
\noexpand\numberline{}#1}%
}
\def\subsectioninfo#1{%
\noexpand\numberline{}#1}%
}
% same for subsubsection, etc. ...

\begin{document}
\tableofcontents

\chapter{AAA}
\chapterinfo{A very long text, a very long text, a very long text, a very long text, a very long text, a very long text, a very long text, a very long text}

\section{aaa}
\sectioninfo{A very long text, a very long text, a very long text, a very long text, a very long text, a very long text, a very long text, a very long text}

\subsection{1111}
\subsectioninfo{A very long text, a very long text, a very long text, a very long text, a very long text, a very long text, a very long text, a very long text}

\end{document}


Result:

If this is required by more people I would be ready to make a small package out of it. I could try to also support the koma script or other classes.

-
thank you, Martin – Jakub Feb 4 '11 at 7:04
Sharrer : Thank you as well. For long books or proceedings, I find this kind of commented toc very user-friendly. – ogerard May 2 '11 at 8:21
Martin, did you ever got around into making this a package? – Jörg May 14 '14 at 8:41
Inserting this into a customized book class, I get a page number on the first page ii, any ideas what to look for off the cuff? Thanks. – PatrickT May 11 at 13:47