Since I'm writing a .cls file to implement a given standard, I have to rewrite commands like
\l@section
and \@dottedtocline
. This makes using packages like tocstyle a bit more complicated.My idea to solve the problem was to get the width of the longest number and use it for every entry, for example:
Code: Select all
\renewcommand*{\l@section}[2]{\begingroup\bfseries\settowidth{\seclen}{<width of longest section number>}\@dottedtocline{1}{0em}{\seclen}{\textbf{#1}}{\textbf{#2}}\endgroup%}
I could set
\seclen
to a larger value, but then the spacing on most cases (where there are less than 10 chapters/sections) would be way too large.I tried to find where
\l@section
is called so that I could send the section number as parameter to it, but I couldn't find it.Any help is much appreciated.