# Inserting \S in front of section or chapter headings

I want to get the \S symbol in front of chapter/section/subsection headings in latex. (Similar to section headings in Munkres' Topology for example).

How do we do this as simply as possible so that it looks good, i.e. so that \S is the same size as the counter for the section heading and a similar font style?

• what document class are you using? (how you do this almost always depends on the class.) – barbara beeton Nov 22 '16 at 16:39
• With standard classes, you can use titlesec. – Bernard Nov 22 '16 at 16:40
• I'm using article at the moment. But may change to a different class later (either book or report). – vkan Nov 22 '16 at 16:40
• Hi Bernard, could you give more details on how to use this? Thanks – vkan Nov 22 '16 at 16:41
• @vkan: I assume you want this everywhere. In the titles, in the headers, in the ToC and in possible references to the sectional units, correct? – Werner Nov 22 '16 at 16:44

Here's a solution that doesn't require loading any (LaTeX) packages. It works by modifying the low-level LaTeX macro \@seccntformat. Comment out (or comment in) the various \newcommand instructions to suit your needs.

In the following screenshot, note that the subsubsection-level number is not prefixed with a paragraph symbol, §, because the associated \newcommand instruction is currently commented out.

\documentclass{article}

\makeatletter
%% See pp. 26f. of 'The LaTeX Companion,' 2nd. ed.
\def\@seccntformat#1{\@ifundefined{#1@cntformat}%
{\csname #1@cntformat\endcsname}}%   individual control
\makeatletter

\begin{document}
\section{A}
\subsection{AA}
\subsubsection{AAA}
\end{document}

• If you need all sectioning headers to be centered rather than typeset flush-left, as I believe is common when the § symbol is in use, I suggest you also issue the instructions \usepackage{sectsty} \allsectionsfont{\centering} in the preamble. – Mico Nov 22 '16 at 18:09

Here is a demo of how you can do that with titlesec. See details in the package documentation. For headers, you have the easy-to-use titlepspackage, anfd for the table of contents, titletoc, from the same bundle.

\documentclass[11pt, a4paper]{article}
\usepackage[utf8]{inputenc}%
\usepackage{fourier, erewhon}
\usepackage[svgnames]{xcolor}
\usepackage{titlesec}

\titleformat{\section}[block]{\filcenter\color{IndianRed}\scshape\bfseries\Large}{§\,\thesection.}{0.5em}{}
\titlespacing*{\section}{0pt}{8ex}{6ex}
\setcounter{section}{3}

\begin{document}

It was not a very difficult question to answer, as there was only one road through the wood, and the two finger-posts both pointed along it. ‘I’ll settle it,’ Alice said to herself, ‘when the road divides and they point different ways.’

But this did not seem likely to happen. She went on and on, a long way, but wherever the road divided there were sure to be two finger-posts pointing the same way, one marked ‘TO TWEEDLEDUM’S HOUSE’ and the other ‘TO THE HOUSE OF TWEEDLEDEE.’

‘I do believe,’ said Alice at last, ‘that they live in the same house! I wonder I never thought of that before--But I can’t stay there long. I’ll just call and say “how d’you do?” and ask them the way out of the wood. If I could only get to the Eighth Square before it gets dark!’ So she wandered on, talking to herself as she went, till, on turning a sharp corner, she came upon two fat little men, so suddenly that she could not help starting back, but in another moment she recovered herself, feeling sure that they must be.

\section{Tweedledum \& Tweedledee }

They were standing under a tree, each with an arm round the other’s neck, and Alice knew which was which in a moment, because one of them had ‘DUM’ embroidered on his collar, and the other ‘DEE.’ ‘I suppose they’ve each got “TWEEDLE” round at the back of the collar,’ she said to herself.

They stood so still that she quite forgot they were alive, and she was just looking round to see if the word “TWEEDLE” was written at the back of each collar, when she was startled by a voice coming from the one marked ‘DUM.’

‘If you think we’re wax-works,’ he said, ‘you ought to pay, you know. Wax-works weren’t made to be looked at for nothing, nohow!’

‘Contrariwise,’ added the one marked ‘DEE,’ ‘if you think we’re alive, you ought to speak.’\end{document}


• @Mico: Thanks Glad to see it's appreciated. More exactly, it's from Through the Looking Glass, and What Alice Found There. – Bernard Nov 22 '16 at 18:27