Debian Codegraph @

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

raw
1 %% LaTeX2e file `etocsnippet-22.tex'
2 %% generated by the `filecontentshere' environment
3 %% from source `etoc' on 2026/05/05.
4 %%
5 \newsavebox\firstnamei \newsavebox\firstnumberi
6 \newsavebox\lastnamei \newsavebox\lastnumberi
7 \newsavebox\firstnameii \newsavebox\firstnumberii
8 \newsavebox\lastnameii \newsavebox\lastnumberii
9 \newcounter{mycounti} \newcounter{mycountii}
10 \newcommand*{\thispartstatsauxi}{} \newcommand*{\thispartstatsauxii}{}
11 \newcommand*{\oldtocdepth}{}
12 \newcommand*{\thispartstats}{%
13 \setcounter{mycounti}{0}%
14 \setcounter{mycountii}{0}%
15 \def\thispartstatsauxi{%
16 \sbox{\firstnamei}{\footnotesize\etocname}%
17 \sbox{\firstnumberi}{\footnotesize\etocnumber}%
18 \def\thispartstatsauxi{}}%
19 \def\thispartstatsauxii{%
20 \sbox{\firstnameii}{\footnotesize\etocname}%
21 \sbox{\firstnumberii}{\footnotesize\etocnumber}%
22 \def\thispartstatsauxii{}}%
23 \begingroup
24 \etocsetlinestyle{subsection} {} {}
25 {\thispartstatsauxii
26 \stepcounter{mycountii}%
27 \sbox{\lastnameii}{\footnotesize\etocname}%
28 \sbox{\lastnumberii}{\footnotesize\etocnumber}} {}%
29 \etocsetlinestyle{section} {} {}
30 {\thispartstatsauxi
31 \stepcounter{mycounti}%
32 \sbox{\lastnamei}{\footnotesize\etocname}%
33 \sbox{\lastnumberi}{\footnotesize\etocnumber}}
34 {{\footnotesize\itshape
35 Here are some statistics for this part: it contains \arabic{mycounti}
36 section\ifnum\value{mycounti}>1 s\fi{} and \arabic{mycountii}
37 subsection\ifnum\value{mycountii}>1 s\fi. The name of the first section is
38 \unhbox\firstnamei{} and the corresponding number is \unhbox\firstnumberi.
39 The name of the last section is \unhbox\lastnamei{} and its number is
40 \unhbox\lastnumberi. The name of the first subsection is \unhbox\firstnameii{}
41 and the corresponding number is \unhbox\firstnumberii. The name of the last
42 subsection is \unhbox\lastnameii{} and its number is \unhbox\lastnumberii.\par}}%
43 \etocinline % cancels the automatic \par automatically before the TOC
44 \etocsettocstyle {}{}
45 \etocsetnexttocdepth{2}%
46 \localtableofcontents % to be used at the top level of a Part.
47 \endgroup
48 }