# formatting section numbers with \hangsection in Memoir

I'd previously been renewing my section command in Memoir in order to style the section numbers by prefacing them with a symbol (§) and following them with a period:

\renewcommand{\thesection}{§ \arabic{section}.}


Werner has helpfully indicated in another post a way of putting the section numbers in the margin, getting rid of headings, and having the text body begin from the section numbers without any skip:

\hangsecnum
\counterwithout{section}{chapter}
\makeatletter
\newcommand{\hangsection}{%
\savebox{\@tempboxa}{\normalfont\ }%
\section{}\hspace*{-\wd\@tempboxa}%
}
\makeatother
\setaftersecskip{0pt}%


Could anyone indicate how to format the section numbers (e.g., with a symbol and a period) with such a new command? Many thanks.

-

You can modify the section number formatting function \setsecnumformat:

\setsecnumformat{\llap{\S\@nameuse{the#1}.\ }}


Here's a minimal example:

\documentclass{memoir}% http://ctan.org/pkg/memoir
\usepackage{lipsum}% http://ctan.org/pkg/lipsum
\hangsecnum
\counterwithout{section}{chapter}
\makeatletter
\setsecnumformat{\llap{\S\@nameuse{the#1}.\ }}
\newcommand{\hangsection}{%
\savebox{\@tempboxa}{\normalfont\ }%
\section{}\hspace*{-\wd\@tempboxa}%
}
\makeatother
\setaftersecskip{0pt}%
\begin{document}
\chapter{A chapter}
\hangsection\lipsum[1]
\hangsection\lipsum[2]
\end{document}


With XeLaTeX, you can use § instead of \S.

-
Many thanks, so helpful – camatkara Jun 26 '12 at 3:57