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.

Possible Duplicate:
Changing the TOC style of an Article document-class

When I use \tableofcontents, It uses ... as a filler between title and page number for subsections, How I can force it to fill space between title of sections and page numbers as well?

share|improve this question

marked as duplicate by Werner, Stephan Lehmke, Marco Daniel, lockstep, egreg May 1 '12 at 12:21

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

2 Answers 2

up vote 12 down vote accepted

I had a confusion :- Whether you want dots or you don't. If you don't, this is a solution you can use tocloft with \renewcommand{\cftdot}{}.

\documentclass[11pt]{report}
\usepackage{tocloft}
% ----------------------------------------------------------------
\begin{document}

\renewcommand{\cftdot}{} %empty {} for no dots. you can have any symbol inside. For example put {\ensuremath{\ast}} and see what happens.
\tableofcontents

\chapter{one}

\section{one}

\end{document}

If you want dots even for chapters and parts this will help you.

\documentclass[11pt]{report}
\usepackage{tocloft}
\renewcommand{\cftpartleader}{\cftdotfill{\cftdotsep}} % for parts
\renewcommand{\cftchapleader}{\cftdotfill{\cftdotsep}} % for chapters
%\renewcommand{\cftsecleader}{\cftdotfill{\cftdotsep}} % for sections, if you really want! (It is default in report and book class (So you may not need it).
% ----------------------------------------------------------------
\begin{document}
\tableofcontents    
\part{Part one}
\chapter{Chapter one}    
\section{Section one}
\subsection{subsection one}    
\end{document}
share|improve this answer

If you want to remove the dots you can use,

  \renewcommand\@dotsep{1000}

This sets the separation of the dots to a high figure and they vanish. (The LaTeX default figure is 4.5). Since the command includes an \@ you will have to enclose it within \makeatletter .... \makeatother.

To add dots in the section for the article class, you need to redefine the \l@section command:

\documentclass{article}
\makeatletter
\renewcommand*\l@section{\@dottedtocline{1}{1.5em}{2.3em}}
\makeatother
\begin{document}
\tableofcontents
\section{test}
\end{document}
share|improve this answer
3  
I think the question was meant the other way round: How to get dots also for sections :-) –  Stephan Lehmke May 1 '12 at 5:15
    
Thanks, But above comment is correct! –  PHPst May 1 '12 at 5:39
    
B@Reza: But for sections dotfill will work without doing any thing. You are not getting it? –  Harish Kumar May 1 '12 at 5:43
    
@Reza The dots for sections come for free:) in the standard classes. What class are you using? –  Yiannis Lazarides May 1 '12 at 5:48
1  
@StephanLehmke Thanks:) Had some more coffee and posted a MWE to do this. –  Yiannis Lazarides May 1 '12 at 6:45

Not the answer you're looking for? Browse other questions tagged or ask your own question.