1

I am using a custom table of contents style, but when I get to high page numbers (>100) the gap between the title and the page number gets very small. Does anyone know how to fix that? It seems like it is simply right aligned, whereas I would like it to be left aligned with a gap between text and title.

enter image description here

MWE: \documentclass[openany]{memoir}

\usepackage{lipsum}

\renewcommand{\cftpartfont}{\large}
\renewcommand{\cftpartleader}{}
\renewcommand{\cftpartafterpnum}{\cftparfillskip}
\cftsetindents{part}{0em}{0em}
\renewcommand{\partnumberline}[1]{}
\cftpagenumbersoff{part}

\renewcommand{\cftchapterfont}{\normalsize}
\renewcommand{\cftchapterpagefont}{\normalsize}
\renewcommand{\cftchapterpresnum}{\bfseries}
\renewcommand{\cftchapterleader}{}
\renewcommand{\cftchapterafterpnum}{\cftparfillskip}

\begin{document}

    \chapter*{Acknowledgements}
    \lipsum[1]

    \tableofcontents*

    \chapter{Introduction}
    \lipsum[1]

    \chapter{Background}
    \lipsum[1]

    \addtocounter{page}{100}    

    \chapter{Conclusion}
    \lipsum[1]

\end{document}
  • Although this looks horrible to my eyes, you can change your \renewcommand{\cftchapterleader}{} to \renewcommand{\cftchapterleader}{\hspace{10pt}}. If this is really what you want. – nox Jul 4 '18 at 16:29
  • Well, the typical TOC where the page number is all the way on the left on the page does not really make sense. At least I never look at a TOC and think "I wonder what chapter starts on page 49?". Having the page number directly after the chapter title conforms better to the function of the TOC, which is figure out the structure of the text and allows for skipping ahead to some parts of the text. – maero21 Jul 4 '18 at 16:44
1

This seems to do it:

\renewcommand*{\cftchapterformatpnum}[1]{%
  \cftchapterformatpnumhook{#1}%
  {\quad\cftchapterpagefont #1}
}

As also mentioned in this answer: Making ToC page numbers flushleft, and not flush right

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.