26

I want to add dots that would fill the space from section/subsection name to the page number in TOC. How do I do that?

2 Answers2

28

Try the tocloft package with something like

\usepackage{tocloft}
\renewcommand{\cftsecleader}{\cftdotfill{\cftdotsep}}

in case you're using the article class (See the package documentation for other classes).

As an illustration, let's try it with the sample2e.tex file; following pdflatex sample2e (two times), we got

alt text

chl
  • 8,890
5

One way of doing this is to use the memoir class, where this is the default behaviour.

Memoir incorporates an extensive set of functions borged from other useful packages; I use it as my day-to-day general-purpose style for almost everything except presentations.

  • 1
    I would prefer to stick with article for now, if this is possible. Thanks, anyway! –  Dec 18 '10 at 17:56
  • 1
    You're welcome. Memoir is a bit daunting at first, but once you've taken the plunge, you've got more-or-less everything you'll commonly need in one manual. – Brent.Longborough Dec 18 '10 at 18:18
  • @Saphar Koshet Thank you for correcting this. My original intenion (now destroyed by linkrot) was to go directly to the PDF manual, but the new URL looks a lot less brittle, so I'm happy to leave it as you have corrected. – Brent.Longborough Dec 22 '18 at 10:22
  • Thanks for the note. "Whole" page or just the manual was an internal debate, and those who find your work on this will benefit from this added discussion. Good idea. Link to 2018 Dec 12 manual. – Saphar Koshet Dec 22 '18 at 23:47