[texhax] table of contents with more than 99 entries

E. Krishnan ekmath at md5.vsnl.net.in
Wed Jul 30 21:11:46 CEST 2003


On Tue, 29 Jul 2003, Jan Chorowski wrote:

> I've got a problem with generation of a table of contents: 
> in the article class, I have about 120 different sections. 
> How can I tell latex, to reserve space for three digits for the 
> section number 
<snip>

Perhaps this may help: add the lines below to your preamble:

	\makeatletter
	\renewcommand*\l at section[2]{%
  	\ifnum \c at tocdepth >\z@
    	\addpenalty\@secpenalty
    	\addvspace{1.0em \@plus\p@}%
    	\setlength\@tempdima{2.5em}%
    	\begingroup
      	\parindent \z@ \rightskip \@pnumwidth
      	\parfillskip -\@pnumwidth
      	\leavevmode \bfseries
      	\advance\leftskip\@tempdima
      	\hskip -\leftskip
      	#1\nobreak\hfil \nobreak\hb at xt@\@pnumwidth{\hss #2}\par
    	\endgroup
  	\fi}
	\makeatother


It's a piece of code from the article.cls which deals with the 
formatting of the table of contents and I've just changed the dimension 
1.5em to 2.5em.	



-- 
Krishnan





More information about the texhax mailing list