summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/latex/etoc/etocsnippet-21.tex
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/doc/latex/etoc/etocsnippet-21.tex')
-rw-r--r--Master/texmf-dist/doc/latex/etoc/etocsnippet-21.tex72
1 files changed, 56 insertions, 16 deletions
diff --git a/Master/texmf-dist/doc/latex/etoc/etocsnippet-21.tex b/Master/texmf-dist/doc/latex/etoc/etocsnippet-21.tex
index 5827d81d277..717cf57c94f 100644
--- a/Master/texmf-dist/doc/latex/etoc/etocsnippet-21.tex
+++ b/Master/texmf-dist/doc/latex/etoc/etocsnippet-21.tex
@@ -1,19 +1,59 @@
%% LaTeX2e file `etocsnippet-21.tex'
%% generated by the `filecontentshere' environment
-%% from source `etoc' on 2023/01/21.
+%% from source `etoc' on 2023/03/02.
%%
-\etocsettocdepth {subsubsection} % set the initial tocdepth
-\etocdefaultlines % use the package default line styles. At this early stage in
- % the document they had not yet been modified by \etocsetstyle
- % commands, so \etoctoclines could have been used, too.
-\etocmarkboth\contentsname
-\etocmulticolstyle[1] % one-column display
- {\pdfbookmark[1]{Table of contents}{MAINTOC}% create a bookmark in the pdf
- \noindent\bfseries\Large
- \leaders\hrule height1pt\hfill
- \MakeUppercase{Table of Contents}}
-\begingroup % use a group to limit the scope of the
- \etocsetlevel{subsection}{3} % subsection level change.
- \etocsetlevel{subsubsection}{4} % anything > tocdepth=3.
- \tableofcontents \label{toc:main}
-\endgroup
+\makeatletter
+\newcommand*\TOCcompute@numwidths [2]{% #1=empty/"local", #2=minimal indent
+ \begingroup
+ \def\TOCnumwidthB {0pt}%
+ \def\TOCnumwidthC {0pt}%
+ \def\TOCnumwidthD {0pt}%
+ \def\TOCnumwidthE {0pt}%
+ \def\TOCnumwidthF {0pt}%
+ \def\TOCnumwidthG {0pt}%
+ \etocsetstyle{part}{}{}{}{}%
+ \etocsetstyle{chapter}{}
+ {\setbox0\hbox{\bfseries\etocthenumber\kern#2}}
+ {\ifdim\wd0>\TOCnumwidthB\edef\TOCnumwidthB{\the\wd0}\fi}{}%
+ \etocsetstyle{section}{}
+ {\setbox0\hbox{\bfseries\etocthenumber\kern#2}}
+ {\ifdim\wd0>\TOCnumwidthC\edef\TOCnumwidthC{\the\wd0}\fi}{}%
+ \etocsetstyle{subsection}{}
+ {\setbox0\hbox{\etocthenumber\kern#2}}
+ {\ifdim\wd0>\TOCnumwidthD\edef\TOCnumwidthD{\the\wd0}\fi}{}%
+ \etocsetstyle{subsubsection}{}
+ {\setbox0\hbox{\etocthenumber\kern#2}}
+ {\ifdim\wd0>\TOCnumwidthE\edef\TOCnumwidthE{\the\wd0}\fi}{}%
+ \etocsetstyle{paragraph}{}
+ {\setbox0\hbox{\etocthenumber\kern#2}}
+ {\ifdim\wd0>\TOCnumwidthF\edef\TOCnumwidthF{\the\wd0}\fi}{}%
+ \etocsetstyle{subparagraph}{}
+ {\setbox0\hbox{\etocthenumber\kern#2}}
+ {\ifdim\wd0>\TOCnumwidthG\edef\TOCnumwidthG{\the\wd0}\fi}{}%
+ %
+ \etocsettocstyle
+ {}
+ {\global\let\TOCnumwidthB\TOCnumwidthB
+ \global\let\TOCnumwidthC\TOCnumwidthC
+ \global\let\TOCnumwidthD\TOCnumwidthD
+ \global\let\TOCnumwidthE\TOCnumwidthE
+ \global\let\TOCnumwidthF\TOCnumwidthF
+ \global\let\TOCnumwidthG\TOCnumwidthG
+ }% make the found maximal widths have global scope
+ \etocnopar
+ \csname #1tableofcontents\endcsname
+\typeout{Next TOCs will use \TOCnumwidthB\space for chapter number width}%
+\typeout{Next TOCs will use \TOCnumwidthC\space for section number width}%
+\typeout{Next TOCs will use \TOCnumwidthD\space for subsection number width}%
+\typeout{Next TOCs will use \TOCnumwidthE\space for subsubsection number width}%
+\typeout{Next TOCs will use \TOCnumwidthF\space for paragraph number width}%
+\typeout{Next TOCs will use \TOCnumwidthG\space for subparagraph number width}%
+ \endgroup % matches \begingroup at start of definition
+}%
+\newcommand*\TOCcomputenumwidths [1][0.5em]{%
+ \TOCcompute@numwidths {}{#1}%
+}%
+\newcommand*\TOCcomputelocalnumwidths [1][0.5em]{%
+ \TOCcompute@numwidths {local}{#1}%
+}%
+\makeatother