I'm typesetting a book with memoir class and in this book the parts have to be centred in the table of contents (TOC). Thanks to Center parts in toc with tocloft I got this working as long as the part name isn't longer than one line. But if it is longer, the second line is not centred. Here is a working example:



\renewcommand{\partnumberline}[1]{\hfil\hspace\@tocrmarg Teil #1:~}

\part{It works with one liners}
\part{But it does not work with those: That is only a test nothing more, please do not read it}
\Blindtext \Blindtext \Blindtext

enter image description here

What could I do to get all lines centred?


The easiest solution might be to not use the memoir interface at all!

Instead go straight to the source and recode it. Here I have removed all the code that normally makes space for the page number and the left indentation etc.

\renewcommand{\partnumberline}[1]{Teil #1:~}
  \ifnum \c@tocdepth >-2\relax
        \cftpartfont #1
|improve this answer|||||

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.