0

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

\documentclass[a4paper,12pt,twoside]{amsbook}
\DeclareRobustCommand{\SkipTocEntry}[4]{}
\makeatletter
\newcommand\Dotfill{\leavevmode\cleaders\hb@[email protected]{\hss.\hss}\hfill\kern\z@}
\makeatother
...

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)

\def\@toclevel{0}
\def\@tocline#1#2#3#4#5#6#7{\relax
\ifnum #1>\c@tocdepth
\else
\par \addpenalty\@secpenalty\addvspace{#2}%
\begingroup \hyphenpenalty\@M
\@ifempty{#4}{%
  \@tempdima\csname r@tocindent\number#1\endcsname\relax
}{%
  \@tempdima#4\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
\nobreak
\endgroup
\fi}

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

3
  • 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

0

\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 .