Debian Codegraph @

texmf-dist/doc/latex/etoc/etocsnippet-21.tex

raw
1 %% LaTeX2e file `etocsnippet-21.tex'
2 %% generated by the `filecontentshere' environment
3 %% from source `etoc' on 2026/05/05.
4 %%
5 \makeatletter
6 \newcommand*\TOCcompute@numwidths [2]{% #1=empty/"local", #2=minimal indent
7 \begingroup
8 \def\TOCnumwidthB {0pt}%
9 \def\TOCnumwidthC {0pt}%
10 \def\TOCnumwidthD {0pt}%
11 \def\TOCnumwidthE {0pt}%
12 \def\TOCnumwidthF {0pt}%
13 \def\TOCnumwidthG {0pt}%
14 \etocsetlinestyle{part}{}{}{}{}%
15 \etocsetlinestyle{chapter}{}
16 {\setbox0\hbox{\bfseries\etocthenumber\kern#2}}
17 {\ifdim\wd0>\TOCnumwidthB\edef\TOCnumwidthB{\the\wd0}\fi}{}%
18 \etocsetlinestyle{section}{}
19 {\setbox0\hbox{\bfseries\etocthenumber\kern#2}}
20 {\ifdim\wd0>\TOCnumwidthC\edef\TOCnumwidthC{\the\wd0}\fi}{}%
21 \etocsetlinestyle{subsection}{}
22 {\setbox0\hbox{\etocthenumber\kern#2}}
23 {\ifdim\wd0>\TOCnumwidthD\edef\TOCnumwidthD{\the\wd0}\fi}{}%
24 \etocsetlinestyle{subsubsection}{}
25 {\setbox0\hbox{\etocthenumber\kern#2}}
26 {\ifdim\wd0>\TOCnumwidthE\edef\TOCnumwidthE{\the\wd0}\fi}{}%
27 \etocsetlinestyle{paragraph}{}
28 {\setbox0\hbox{\etocthenumber\kern#2}}
29 {\ifdim\wd0>\TOCnumwidthF\edef\TOCnumwidthF{\the\wd0}\fi}{}%
30 \etocsetlinestyle{subparagraph}{}
31 {\setbox0\hbox{\etocthenumber\kern#2}}
32 {\ifdim\wd0>\TOCnumwidthG\edef\TOCnumwidthG{\the\wd0}\fi}{}%
33 %
34 \etocsettocstyle
35 {}
36 {\global\let\TOCnumwidthB\TOCnumwidthB
37 \global\let\TOCnumwidthC\TOCnumwidthC
38 \global\let\TOCnumwidthD\TOCnumwidthD
39 \global\let\TOCnumwidthE\TOCnumwidthE
40 \global\let\TOCnumwidthF\TOCnumwidthF
41 \global\let\TOCnumwidthG\TOCnumwidthG
42 }% make the found maximal widths have global scope
43 \etocnopar
44 \csname #1tableofcontents\endcsname
45 \typeout{Next TOCs will use \TOCnumwidthB\space for chapter number width}%
46 \typeout{Next TOCs will use \TOCnumwidthC\space for section number width}%
47 \typeout{Next TOCs will use \TOCnumwidthD\space for subsection number width}%
48 \typeout{Next TOCs will use \TOCnumwidthE\space for subsubsection number width}%
49 \typeout{Next TOCs will use \TOCnumwidthF\space for paragraph number width}%
50 \typeout{Next TOCs will use \TOCnumwidthG\space for subparagraph number width}%
51 \endgroup % matches \begingroup at start of definition
52 }%
53 \newcommand*\TOCcomputenumwidths [1][0.5em]{%
54 \TOCcompute@numwidths {}{#1}%
55 }%
56 \newcommand*\TOCcomputelocalnumwidths [1][0.5em]{%
57 \TOCcompute@numwidths {local}{#1}%
58 }%
59 \makeatother