6

I am running into some formatting trouble with memoir and the \part commands. In the table of contents, as the number of parts add up, the space between the part number, i.e. "III" and the part heading, i.e. "Background", gets smaller.

Is there a way of adding a constant space there, so that each part title are separated from the part number by the same amount? Here's an MWE showing the problem.

\documentclass{memoir}

\begin{document}

    \tableofcontents

    \part{Background}

    \chapter{The problem}

    \chapter{Risk assessment}

    \part{Theory and principles}

    \chapter{Inductively coupled plasma mass spectrometry}

    \chapter{Inductively coupled plasma optical emission spectrometry}

    \chapter{X-ray diffraction}

    \chapter{Ion chromatography}

    \part{Thesis}

    \chapter{Introduction}

    \chapter{Methodology}

    \chapter{Results}

    \chapter{Discussion}

    \chapter{Conclusion}


\end{document}

enter image description here

  • It's possible to do this with tocloft – user31729 Nov 4 '14 at 11:24
  • Add \renewcommand\partnumberlinebox[2]{#2\hspace{1em}} to your preamble and replace 1em with the distance of your coosing. – DG' Nov 4 '14 at 11:55
  • Or adjust the width of the box so the part titles also line up as the chapter titles does on DG''s example. – daleif Nov 4 '14 at 13:27
8

The memoir manual says on page 156 that

the \book, \part and \chapter numbers are typeset inside a box of certain fixed withs

In order to get a fixed width after the part number, we have to get rid of the box and insert some whitespace (1em in this example) after the number. We do so by renewing \partnumberlinebox:

\renewcommand\partnumberlinebox[2]{#2\hspace{1em}}

Now the MWE looks like this:

\documentclass{memoir}
\renewcommand\partnumberlinebox[2]{#2\hspace{1em}} % <-- Adds 1em whitespace between part number and title

\begin{document}

    \tableofcontents

    \part{Background}

    \chapter{The problem}

    \chapter{Risk assessment}

    \part{Theory and principles}

    \chapter{Inductively coupled plasma mass spectrometry}

    \chapter{Inductively coupled plasma optical emission spectrometry}

    \chapter{X-ray diffraction}

    \chapter{Ion chromatography}

    \part{Thesis}

    \chapter{Introduction}

    \chapter{Methodology}

    \chapter{Results}

    \chapter{Discussion}

    \chapter{Conclusion}


\end{document}

MWE

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.