4 May 2003 BenFrantzDale   » (Journeyer)

I finally figured out how to get a LaTeX table of contents to look the way I want, with no dot leaders and with the page numbers just to the right of the section titles.

\renewcommand*\l@part[2]{%
  \ifnum \c@tocdepth >-2\relax
    \addpenalty{-\@highpenalty}%
    \addvspace{2.25em \@plus\p@}%
    \setlength\@tempdima{3em}%
    \begingroup
      \parindent \z@ \rightskip \@pnumwidth
      \parfillskip -\@pnumwidth
      {\leavevmode
       \large \bfseries #1~~\hb@xt@\@pnumwidth{\hss #2}\hfill}\par
       \nobreak
         \global\@nobreaktrue
         \everypar{\global\@nobreakfalse\everypar{}}%
    \endgroup
  \fi}
\renewcommand*\l@chapter[2]{%
  \ifnum \c@tocdepth >\m@ne
    \addpenalty{-\@highpenalty}%
    \vskip 1.0em \@plus\p@
    \setlength\@tempdima{1.5em}%
    \begingroup
      \parindent \z@ \rightskip \@pnumwidth
      \parfillskip -\@pnumwidth
      \leavevmode \bfseries
      \advance\leftskip\@tempdima
      \hskip -\leftskip
      \mbox{#1}\nobreak\nobreak\hb@xt@\@pnumwidth{\hss #2}\par
      \penalty\@highpenalty
    \endgroup
  \fi}
\renewcommand*\l@section{\@tocline{1}{1.5em}{2.3em}}
\renewcommand*\l@subsection{\@tocline{2}{3.8em}{3.2em}}
\renewcommand*\l@subsubsection{\@tocline{3}{7.0em}{4.1em}}
\renewcommand*\l@paragraph{\@tocline{4}{10em}{5em}}
\renewcommand*\l@subparagraph{\@tocline{5}{12em}{6em}}

\setcounter{tocdepth}{1} % Only show sections and higher \def\@tocline#1#2#3#4#5{% \ifnum #1>\c@tocdepth \else \vskip \z@ \@plus.2\p@ {\leftskip #2\relax \rightskip \@tocrmarg \parfillskip -\rightskip \parindent #2\relax\@afterindenttrue \interlinepenalty\@M \leavevmode \@tempdima #3\relax \advance\leftskip \@tempdima \null\nobreak\hskip -\leftskip \mbox{#4}~~#5\hfill \hfill\par}% \fi} \makeatother

Latest blog entries     Older blog entries

New Advogato Features

New HTML Parser: The long-awaited libxml2 based HTML parser code is live. It needs further work but already handles most markup better than the original parser.

Keep up with the latest Advogato features by reading the Advogato status blog.

If you're a C programmer with some spare time, take a look at the mod_virgule project page and help us with one of the tasks on the ToDo list!