1

I need something similar to this post, that is the second line of the part should start directly at the left margin.

This is what I have tried:

\documentclass{memoir}

\setlength{\cftpartindent}{0em} 
\setlength{\cftpartnumwidth}{0em} 
\renewcommand{\cftpartaftersnumb}{\\}
\renewcommand*{\cftpartname}{Part\space}

\begin{document}
\tableofcontents*

\part{Test}

\end{document}

But for some reason the title on the second line is indented:

enter image description here

2

This is rather a fudge but it does seem to work for single line titles.

In your code change the redefinition of \cftaftersnumb according to the following, to be placed after your \cftpartname redefinition:

\newlength{\mylength}
\settowidth{\mylength}{\cftpartfont \cftpartname} % Space for Part text
\renewcommand{\cftpartaftersnumb}{\newline\mbox{\hspace{-\mylength}}}

This puts some negative space, corresponding to that used by the Part text, in front of the first line of the title to make it align with the left margin. To do so for all lines of a multi-line title would require significant work on the internals of memoir, which I am no longer up to.

  • Cool. Thanks. But why not assign \mylength to \cftpartnumwidth? This has the same effect here. (Well, actually I am getting a much more overfull hbox, but visually both solutions seem to be identical.) – Denis Mar 9 at 22:56

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.