Debian Codegraph @

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

raw
1 %% LaTeX2e file `etocsnippet-26.tex'
2 %% generated by the `filecontentshere' environment
3 %% from source `etoc' on 2026/05/05.
4 %%
5 \newtoks\toctabletok
6 \newcommand*\appendtotok[2]{% #1=toks variable, #2=macro, expands once #2
7 #1\expandafter\expandafter\expandafter {\expandafter\the\expandafter #1#2}}
8
9 \newcommand*\PreparePart{%
10 \toks0 \expandafter{\etocthelinkednumber}%
11 \toks2 \expandafter{\etocthelinkedname}%
12 \toks4 \expandafter{\etocthelinkedpage}%
13 \edef\toctablepiece {\noexpand\hline
14 \noexpand\strut\the\toks0 &\noexpand\bfseries\the\toks2
15 &\the\toks4 \noexpand\\\noexpand\hline}%
16 }
17 \newcommand*\PrepareSection{%
18 \toks0 \expandafter{\etocthelinkednumber}%
19 \toks2 \expandafter{\etocthelinkedname}%
20 \toks4 \expandafter{\etocthelinkedpage}%
21 \edef\toctablepiece {\the\toks0 &\the\toks2 &\the\toks4 \noexpand\\}%
22 }
23 %
24 \newcommand*{\PrepareSubsection}{%
25 \toks0 \expandafter{\etocthelinkednumber}%
26 \toks2 \expandafter{\expandafter\itshape\etocthelinkedname\strut}%
27 \toks4 \expandafter{\expandafter\itshape\etocthelinkedpage}%
28 \edef\toctablepiece{&\noexpand\makebox[1cm][c]{\the\toks0}%
29 \noexpand\parbox[t]{\dimexpr6cm-\tabcolsep\relax}
30 {\noexpand\sloppy\the\toks2}%
31 &\the\toks4 \noexpand\\}%
32 }
33
34 \begingroup
35 \etocsetlinestyle{part}{}{}{\PreparePart \appendtotok\toctabletok\toctablepiece}{}
36
37 \etocsetlinestyle{section}{}{}{\PrepareSection \appendtotok\toctabletok\toctablepiece}{}
38
39 \etocsetlinestyle{subsection}{}{}{\PrepareSubsection\appendtotok\toctabletok\toctablepiece}{}
40
41 \etocsettocstyle
42 {\toctabletok{\hypersetup{hidelinks}%
43 \begin{longtable}{|>{\bfseries}c|p{7cm}|r|}\hline
44 \multicolumn{3}{|c|}{\Large\bfseries\strut TABLE OF CONTENTS}%
45 \\\hline\hline}}
46 {\global\toctabletok\expandafter{\the\toctabletok\hline\end{longtable}}}
47 \etocsettocdepth {subsection}
48 \tableofcontents
49 \the\toctabletok
50 \endgroup