29

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?

Real Dreams
  • 8,298
  • 12
  • 56
  • 78

2 Answers2

50

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}
9

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}
yannisl
  • 117,160