Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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?

share|improve this question

2 Answers 2

up vote 15 down vote accepted

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

share|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

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.

share|improve this answer
    
I would prefer to stick with article for now, if this is possible. Thanks, anyway! –  user1996 Dec 18 '10 at 17:56
    
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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.