[Tex/LaTex] memoir: sections as chapters, reference numbering

memoirnumberingsectioningtable of contents

In the following example, I've hacked the numbering of sections in the memoir class so that I can use "sections" as "chapters". This makes them show up nicely in the table of contents. However, numbering for \label and \ref is off by one. Can this be fixed without massively revising my code?

\documentclass[article, a4paper, 12pt, oneside]{memoir}

\setlrmarginsandblock{23mm}{63mm}{*}
\setulmarginsandblock{23mm}{28mm}{*}
\setheadfoot{\onelineskip}{2\onelineskip}
\setheaderspaces{*}{1mm}{*}
\chapterstyle{plain}
\checkandfixthelayout

\setsecnumformat{\addtocounter{section}{-1} \addtocounter{chapter}{1}}

\renewcommand*\thesection{\arabic{chapter}}

\begin{document}

\tableofcontents

\section{Introduction} \label{beginning}
Beginning.  Just wait til you see the end, that's in Chapter \ref{end}.

\section{Conclusion} \label{end}
End.  Hopefully you read the beginning! (Chapter \ref{beginning})

\end{document}

Numbers appear differently http://metameso.org/~joe/tocref.png

Best Answer

There's no need to play with counters. If you have to "promote" only sections, the following will work:

\documentclass[article, a4paper, 12pt, oneside]{memoir}

\setlrmarginsandblock{23mm}{63mm}{*}
\setulmarginsandblock{23mm}{28mm}{*}
\setheadfoot{\onelineskip}{2\onelineskip}
\setheaderspaces{*}{1mm}{*}
% \chapterstyle{plain} % needed?
\checkandfixthelayout

\renewcommand{\thesection}{\arabic{section}}
\makeatletter
\let\l@section\l@chapter
\makeatother

\begin{document}

\tableofcontents

\section{Introduction} \label{beginning}
Beginning.  Just wait til you see the end, that's in Chapter \ref{end}.

\section{Conclusion} \label{end}
End.  Hopefully you read the beginning! (Chapter \ref{beginning})

\end{document}

If you have to promote also subsections, then

\renewcommand{\thesection}{\arabic{section}}
\renewcommand{\thesubsection}{\thesection.\arabic{subsection}}
\makeatletter
\let\l@subsection\l@section
\let\l@section\l@chapter
\makeatother

The strategy is to use for an entry in the table of contents the setting for the upper level (so we have to work from bottom up). The macro

\l@<sectional unit>

is responsible for typesetting the table of contents entry for that sectional unit.

enter image description here

Of course \tableofcontents* should be used, in order to avoid that the table of contents is listed in itself, which makes little sense anyway.

Related Question