[Tex/LaTex] Odd ToC spacing between item and page number

memoirspacingtable of contents

I'm facing a very odd issue with spacing in my table of contents. For the first 25-30 entries, there is a space between the entry and corresponding page number. Thereafter, the space disappears!

ToC Anomaly

See the line at Section 4.2 and onwards. There are no spacing or \cft commands in that chapter. In fact, if I remove chapters 3 and 4 entirely, the spacing is proper until the first 25 entries, then gets distorted again.

I checked the .toc file and couldn't find anything odd in it. For what it's worth, I'm using the memoir document class.

Any ideas on why this might be happening? I've played around with the various \cft commands to no avail.

Here are the \cft commands from my TeX file:

\renewcommand{\cftchapterfont}{\normalfont} 
\renewcommand{\cftsectionfont}{\itshape} 
\renewcommand{\cftchapterpagefont}{\normalfont} 
\renewcommand{\cftchapterpresnum}{\bfseries} 
\renewcommand{\cftchapterleader}{} 
\renewcommand{\cftsectionleader}{} 
\renewcommand{\cftchapterafterpnum}{\cftparfillskip} 
\renewcommand{\cftsectionafterpnum}{\cftparfillskip} 

Best Answer

the spacing has nothing to do with the number of entries in the toc, but in the number of digits in the page number.

in most document classes, there is a box of fixed width assigned for the page number.

it looks like you are using a class designed for a article of fewer than 100 pages in length, because as soon as the page number exceeds two digits, it fills the space available. to test this, you could artificially reset the page number as \setcounter{page}{999} and see what happens when it exceeds a thousand. depending on the definition, it will either extend to the right (with an overfull hbox warning in the log, and a black mark if you have applied the [draft] option to the \documentclass line), or overprint the end of the entry text to the left.

to fix this, it's probably easiest to use one of the packages intended for modification of the toc format, although i'd also take a look into the document class itself and consider increasing the capacity of the field that formats the page number to allow more digits. since in the format shown the page numbers are not flush right, perhaps simply adding a space of fixed width at the beginning of the page number and setting the number flush left to that space is what you want -- you didn't show any one-digit page numbers, so there's no clue as to what you prefer, other than an assurance that you do want some separation.

Related Question