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.

alt text

I am using \tableofcontents to create TOC in my document. however it is appearing as shown in the image. As the numbers increase the gap between the number and text is reducing.

Thanks for your help Aku

share|improve this question

2 Answers 2

up vote 13 down vote accepted

You can use the tocloftpackage, e.g.

\documentclass{book}
\usepackage{tocloft}
\setlength{\cftchapnumwidth}{3em}
\begin{document}
\tableofcontents
\chapter{Lorem}
\setcounter{chapter}{9}
\chapter{Ipsum}
\setcounter{chapter}{99}
\chapter{Dolor}
\end{document}

The lengt \cftXnumwidth defines how wide the space for the number of X should be, where X is part (for \part), chap (for \ \chapter), sec (for \section) etc. See the tocloft manual for a complete list. Set this length to fit your needs.

share|improve this answer

You can use a package or simply redefine the section level command as follows:

\documentclass[11pt]{article} 
\makeatletter
\def\l@section{\@dottedtocline{1}{1em}{2em}}
\makeatother
\usepackage{index}
\makeindex

\begin{document}
\tableofcontents

\section{One}
\section{Two}
\section{Three}
\end{document}

In the \def\l@section{\@dottedtocline{1}{1em}{2em}} change the 2em to suit. Here is the format of the \@dottedtocline{<level>}{<indent>}{<numwidth>}{<title>}{<page>}.

share|improve this answer
    
I used your trick because tocloft completely remove all format of the toc. But with your command chapter in the toc are no longer written in bold. How can I fix this ? Maybe it is due to the fact that chapter is not a dotted toc line ? –  Ger Sep 3 '12 at 10:14

Your Answer

 
discard

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

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