I'd like sections in the table of contents to have not only the number, but also the symbol § before them. How can I make it?

-

Here's one option using the tocloft package:

\documentclass{report}
\usepackage{tocloft}

\renewcommand\cftsecpresnum{\S}

\begin{document}

\tableofcontents
\chapter{Test Chapter}
\section{Test Section One}
\section{Test Section Two}
\section{Test Section Three}
\section{Test Section Fout}

\end{document}


-

Sections are special in the article document class and treated differently from subsections and lower-level sectional units in the ToC. As such, a patch (using etoolbox) of \l@section to insert § is sufficient:

\documentclass{article}
\usepackage{etoolbox}% http://ctan.org/pkg/etoolbox
\makeatletter
\patchcmd{\l@section}% <cmd>
{#1}% <search>
{\S#1}% <replace>
{}{}% <search><replace>
\makeatother
\begin{document}
\tableofcontents
\section{A section}
\end{document}


The patch inserts \S before the first argument (#1) of \l@section. The first argument contains the number and name of the section.

For the report document class, the following patch does something similar, noting that sections at level 1:

\documentclass{report}
\usepackage{etoolbox}% http://ctan.org/pkg/etoolbox
\makeatletter
\patchcmd{\@dottedtocline}% <cmd>
{#4}% <search>
{\ifnum#1=1\S\fi#4}% <replace>
{}{}% <search><replace>
\makeatother
\begin{document}
\tableofcontents
\chapter{A chapter}
\section{A section}
\end{document}

-
Thank you for your help! I'm using the report class for a small book and this patch doesn't work with it. Am I using sectioning wrong? –  Alvar Mar 16 '13 at 23:50
@HarishKumar Thank you, that worked! –  Alvar Mar 17 '13 at 0:08