diff options
Diffstat (limited to 'Master/texmf-dist/doc/latex/etoc/etocsnippet-25.tex')
-rw-r--r-- | Master/texmf-dist/doc/latex/etoc/etocsnippet-25.tex | 74 |
1 files changed, 51 insertions, 23 deletions
diff --git a/Master/texmf-dist/doc/latex/etoc/etocsnippet-25.tex b/Master/texmf-dist/doc/latex/etoc/etocsnippet-25.tex index 0926c9356be..bac4860ce8f 100644 --- a/Master/texmf-dist/doc/latex/etoc/etocsnippet-25.tex +++ b/Master/texmf-dist/doc/latex/etoc/etocsnippet-25.tex @@ -1,31 +1,59 @@ %% LaTeX2e file `etocsnippet-25.tex' %% generated by the `filecontentshere' environment -%% from source `etoc' on 2023/01/21. +%% from source `etoc' on 2023/03/04. %% \makeatletter -\newcommand*\firstsubname {} \newcommand*\lastsubname {} -\newcommand*\firstsubnumber {} \newcommand*\lastsubnumber {} -\newcommand*\thisspecialstatsaux{} -\newcommand*{\thisspecialstats}{% - \setcounter{mycounti}{0}% - \def\thisspecialstatsaux{% - \let\firstsubname\etocthelinkedname - \let\firstsubnumber\etocthelinkednumber - \def\thisspecialstatsaux{}} +\newcommand*{\MyQuasiStandardTOC}[2][]{% + % #1 is an optional "\ref{somelabeltoanothertoc}" + % #2 is the number of some exceptional section \begingroup - \etocsetstyle{subsection} {} {} - {\thisspecialstatsaux - \stepcounter{mycounti}% - \let\lastsubname\etocthelinkedname - \let\lastsubnumber\etocthelinkednumber } - {Here are some statistics for this section. It contains \arabic{mycounti} - subsections. The name of its first is \emph{\firstsubname{}} and the - corresponding number is {\firstsubnumber}. The name of the last - subsection is \emph{\lastsubname{}} and its number is {\lastsubnumber}.}% - \etocsettocstyle {}{} - \etocinline - \etocsetnexttocdepth {1}% - \localtableofcontents % to be used within a section + \etocsetstyle{section} + {} + {\etociffirst{% Suppress display of subsections for the first section! + \etocsetlevel{subsection}{6}} + {\etocsetlevel{subsection}{2}}% + \ifnum\etocthenumber=#2 % Handle especially section number #2 ! + \etocsetstyle{subsection} + {\def\foo{}\par\nopagebreak\begingroup + \leftskip2em \rightskip\@tocrmarg + \parfillskip \@flushglue + \parindent 0pt + \normalfont\normalsize\rmfamily\itshape + \etocskipfirstprefix} + {\allowbreak\,--\,} + {\edef\foo{\the\numexpr\foo+1}\etocname\ \textup{(\etocnumber)}} + {.\par \upshape My AI counted circa \foo\space subsections, + was it right?\par\endgroup}% + \else + \ifnum\etocthenumber>#2 % Only count subsections in those sections ! + \etocsetstyle{subsection} + {\def\foo{}}% + {\edef\foo{\the\numexpr\foo+1}}% + {}% + {\leftskip2em \emph{There are \foo\space subsections here, + but I will need payment to display them.}\par}% + \else + \etocsetstyle{subsection} + {}% + {}% + {\l@subsection{\numberline{\etocnumber}\etocname}{\etocpage}}% + {}% + \fi + \fi + }% + {% Display in a special color the number of the special section! + \l@section{\numberline{{\ifnum\etocthenumber=#2 + \color{red}\else\color{cyan}\fi\etocthenumber}}% + \etociffirst{\etocname\space (SUBSECTIONS SKIPPED)}{\etocname}} + {\etocpage}}% + {}% + \etocclasstocstyle % will use the ambient document class + % special KOMA-script customization as this document uses scrartcl + % and we need to enlarge numwidth for some subsections + \DeclareTOCStyleEntry[numwidth=2em,indent=0pt]{tocline}{section} + \DeclareTOCStyleEntry[numwidth=2.5em,indent=2em]{tocline}{subsection} + \etocsetnexttocdepth {subsection}% + \tableofcontents #1 \endgroup } \makeatother |