6

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.

1 Answer 1

7

You can modify the section number formatting function \setsecnumformat:

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

Here's a minimal example:

enter image description here

\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.

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .