Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Putting a leader of dots between chapter title and page number in table of contents

1,684 views
Skip to first unread message

Jan Rovny

unread,
May 20, 2011, 4:14:38 PM5/20/11
to
Hello,

I am trying to get a leader of dots going from my chapter titles to my
page number in the table of contents. (LaTeX normally produces these
leaders only for lower level headings like sections and subsections.)

I have tried the 'tocloft' package, but the commands for doing this do
not produce any results.

I would be grateful for a clearer suggestions of commands.

Many thanks,
Jan

Lars Madsen

unread,
May 20, 2011, 4:20:11 PM5/20/11
to

it would be helpful with a minimal example (compilable) example of what
you have tried

--
/daleif

DK-TUG president
memoir and mh bundle maintainer

GL

unread,
May 20, 2011, 4:47:15 PM5/20/11
to

With tocloft you have the \cftZleader command that puts the leaders
and \cftdotsep is the space between dots (\def\cftdotsep{\cftnodots}
removes the leaders by giving to \cftdotsep a huge value)

You then have to check the \cftsubsecleader (without /s/ weirdly)
command (for subsection):

\def\cftsubsecleaders{\cftdotfill\cftdotsep} normally

and check the value of \cftdotsep expressed in "mu" units without
the unit: for example \def\cftdotsep{5}

This should work... With interfaces:

\tocsetup{subsection/dotsep=5} does the job (the leader is automatically
set if dotsep is not \cftnodots) - at least for the next version...

Regards.

Peter Flynn

unread,
May 20, 2011, 5:19:11 PM5/20/11
to

Copy the definition of \l@chapter from your document class file, make it
a \renewcommand, and then substitute the definition of \dottedtocline
for the \hfil (adding a \normalfont to negate the bold):


\documentclass{report}
\makeatletter
\renewcommand*\l@chapter[2]{%
\ifnum \c@tocdepth >\m@ne
\addpenalty{-\@highpenalty}%
\vskip 1.0em \@plus\p@
\setlength\@tempdima{1.5em}%
\begingroup
\parindent \z@ \rightskip \@pnumwidth
\parfillskip -\@pnumwidth
\leavevmode \bfseries
\advance\leftskip\@tempdima
\hskip -\leftskip
#1\nobreak\leaders\hbox{\normalfont$\m@th
\mkern \@dotsep mu\hbox{.}\mkern \@dotsep
mu$}\hfill \nobreak\hb@xt@\@pnumwidth{\hss #2}\par
\penalty\@highpenalty
\endgroup
\fi}
\makeatother
\begin{document}
\tableofcontents
\chapter{foo}
Stuff
\section{bar}
More stuff
\end{document}

///Peter

freest...@gmail.com

unread,
Nov 24, 2014, 5:01:45 PM11/24/14
to
在 2011年5月20日星期五UTC-5下午4时19分11秒,peter写道:
I works well in my dissertation! Thanks for the sharing!

Shihai
0 new messages