# Name a section in Latex TOC (add subtitle to contentsline)

I have my Latex document (documentclass is article) which consists of several \sections and \subsections.

The \tableofcontents command generates my TOC as I want (in this case: hyperreffed, with page number, with dots etc.), but for the sections, I would like to add a "section subtitle".

As an example: my current TOC looks like

1 Layout
1.1 Main Window
1.2 Footer
2.1 Basic structure
2.2 Overview page


Now I want to add a subtitle to every section, which I expected to work like \section{Layout}{this section describes the layout}, which appearently doesn't work.

What I want:

1 Layout - this section describes the layout
1.1 Main Window
1.2 Footer
2 Navigation - here you will get information on foobar
2.1 Basic structure
2.2 Overview page

-
one way to accomplish this is to suppress the automatically created section entry and replace it. this was addressed in my answer to this question, although the reason for doing so was different. however, it shouldn't be too difficult to adapt that answer to do what you want. – barbara beeton May 15 '12 at 13:00

If the "subtitle" attributes are to be the same from those of the title, and you want the information to appear right after the title, you can use the optional argument of the sectional units:

\documentclass{article}

\begin{document}

\tableofcontents

\section[Layout -- This section describes the layout]{Layout}
\subsection{Main Window}
\subsection{Footer}
\subsection{Basic structure}
\subsection{Overview page}

\end{document}


As tohecz mentions in a comment this will also add this subtitle to the header marks.

Another sometimes used format is to write this "subtitle" right below the title for the sectional unit. The following code shows one way to achieve this; the idea is to define a new command \sectionsubtitle which writes the information to the ToC, immitating the way section entries are typeset, but suppressing the sectional and page numbering, and the leading dots; additionally, with this approach the subtitles won't be added to the head marks:

\documentclass{article}
\usepackage{etoolbox}

\makeatletter
\let\@nodottedtocline\@dottedtocline
\patchcmd{\@nodottedtocline}{\hbox{.}}{\hbox{}}{}{}
\patchcmd{\@nodottedtocline}{\normalcolor #5}{\normalcolor}{}{}
\newcommand*\l@sectionsubtitle{\@nodottedtocline{1}{0em}{1.5em}}
\makeatother

\def\sectionsubtitle#1{%
}

\begin{document}

\tableofcontents

\section{Layout}
\sectionsubtitle{This section describes the layout}
\subsection{Main Window}
\subsection{Footer}