20

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?

21

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

|improve this answer|||||
  • \cftchapleader is undefined. – user1996 Dec 18 '10 at 17:56
  • @an_ant Sorry, fixed it with \cftsecleader. – chl Dec 18 '10 at 17:59
  • 1
    It doesn't do it. – user1996 Dec 18 '10 at 18:00
  • @an_ant It works for me :( I added instructions on how I did it. – chl Dec 18 '10 at 18:07
  • I'm sorry. It did the job! I knew it was tocloft but just wasn't able to search for it know. Thanks! – user1996 Dec 18 '10 at 18:11
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.

|improve this answer|||||
  • 1
    I would prefer to stick with article for now, if this is possible. Thanks, anyway! – user1996 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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy