I am using the `amsbook.cls' file together with the command

\newcommand\Dotfill{\leavevmode\cleaders\hb@[email protected]{\hss.\hss}\hfill\kern\z@}

to create dots within the sections level of the table of contents (TOC). The `amsbook.cls' file is modified accordingly with (please note the comments)

\ifnum #1>\c@tocdepth
\par \addpenalty\@secpenalty\addvspace{#2}%
\begingroup \hyphenpenalty\@M
  \@tempdima\csname r@tocindent\number#1\endcsname\relax
\parindent\z@ \leftskip#3\relax \advance\leftskip\@tempdima\relax
\rightskip\@pnumwidth plus4em \parfillskip-\@pnumwidth
#5\leavevmode\hskip-\@tempdima #6\nobreak\relax
% \hfil\hbox to\@pnumwidth{\@tocpagenum{#7}}\par % <-- we commented this line out
\ifnum#1<\c@tocdepth\hfill\else\Dotfill\fi\hbox to\@pnumwidth{\@tocpagenum{#7}}\par % <-- and, instead, use this line to allow for dots in the TOC

However, the dots are aligned to the left rather than to the right (see the picture below). How do I align the dots on the right side next to page numbers?

enter image description here

  • Welcome to TeX.SE!
    – Mensch
    Nov 4, 2022 at 16:58
  • it always helps if you provide a test file, but try \leaders the dots will then all be lined up. Nov 4, 2022 at 17:30
  • @DavidCarlisle ... Thank you!
    – User129599
    Nov 4, 2022 at 18:26

1 Answer 1


\cleaders makes unaligned, centred dots. If you use \leaders (or the standard latex \@dottedtocline) the dots on each line will be at the same horizontal positions as the other lines

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .