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?
asked Dec 18, 2010 at 17:19 user1996 user1996Try the tocloft package with something like
\usepackage \renewcommand>
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

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.
381 2 2 gold badges 4 4 silver badges 18 18 bronze badges answered Dec 18, 2010 at 17:51 Brent.Longborough Brent.Longborough 28.2k 10 10 gold badges 90 90 silver badges 142 142 bronze badges I would prefer to stick with article for now, if this is possible. Thanks, anyway! Commented Dec 18, 2010 at 17:56You'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.
Commented Dec 18, 2010 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.
Commented Dec 22, 2018 at 10:22Thanks 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.