summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/etoc
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2023-05-01 03:03:35 +0000
committerNorbert Preining <norbert@preining.info>2023-05-01 03:03:35 +0000
commit5164dcdfce521e72debadb619624c4ee37b03ccc (patch)
treec1d8f6031b3af0521ebd8a6fe8363439aeb3e021 /macros/latex/contrib/etoc
parent7932c8102a8f5298d7d36caa6df233c356f96e56 (diff)
CTAN sync 202305010303
Diffstat (limited to 'macros/latex/contrib/etoc')
-rw-r--r--macros/latex/contrib/etoc/README.md48
-rw-r--r--macros/latex/contrib/etoc/etoc.dtx1629
-rw-r--r--macros/latex/contrib/etoc/etoc.pdfbin940496 -> 975956 bytes
3 files changed, 1092 insertions, 585 deletions
diff --git a/macros/latex/contrib/etoc/README.md b/macros/latex/contrib/etoc/README.md
index ed067af271..08308b0ee8 100644
--- a/macros/latex/contrib/etoc/README.md
+++ b/macros/latex/contrib/etoc/README.md
@@ -1,6 +1,6 @@
<!-- -->
- Source: etoc.dtx (1.2)
+ Source: etoc.dtx (1.2a)
Author: Jean-Francois Burnol
Info: Completely customisable TOCs
License: LPPL 1.3c
@@ -16,7 +16,7 @@ tables of contents, i.e. having their scope limited to the last
sectioning command encountered.
No auxiliary file is used additionally to the standard `.toc` file.
-Release 1.2 provides experimental additions `\locallistoffigures` and
+Release 1.2 provides **experimental** additions `\locallistoffigures` and
`\locallistoftables` which also use only the `.toc` file.
Such local TOCs or "Lists Of" typically need to adopt a "display
@@ -78,29 +78,21 @@ etoc.sty, etoc.tex, etoc.pdf, etoc.dvi.
RECENT CHANGES
==============
-This is `1.2` of `2023/03/01`.
-
-`1.1a` up to `1.1d` were mainly about refactoring core legacy code
-dating back to the earliest versions of the package. The initial
-stimulus came from the necessity to prepare for changes to how
-hyperref and the LaTeX kernel will interact in the future.
-
-`1.2` added `\locallistoffigures` and `\locallistoftables`. One must
-pass options `lof` and `lot` to the package to activate these
-experimental features.
-
-The initial default rendering of the titles of tables of contents now
-uses the emulated document class code only for the global ones
-(`\tableofcontents`); for local ones (`localtableofcontents` and the
-new "local lists of") it uses by default a context aware title
-(such as `\subsection*` if local to a section). Thus, usage of
-`\etocsettocstyle` is now purely optional. Regarding the
-"line styles", the package has always used the unaltered rendering
-from the document class, so using the other core customization command
-`\etocsetstyle` to truly unleash the package powers has always been
-optional.
-
-Shoud they dare to go check the PDF documentations, users will
-discover that it has been completely restructured at release `1.2`, to
-the extent allowed by random permutations of topics, and that many
-commands have been added to facilitate usage of `\etocsettocstyle`.
+This is `1.2a` of `2023/05/01`.
+
+- `1.2a` lifted the requirement added at `1.1a` of a LaTeX kernel from
+ 2020-10-01 or later, and also the requirement added at `1.2` of
+ availability of the `\expanded` engine primitive. It also added a
+ `deeplevels` option.
+
+- `1.2` completed the core internal refactoring from `1.1a-d` and added
+ **experimental** `\locallistoffigures` and `\locallistoftables`. It also
+ let `\localtableofcontents` by default auto-select a heading style
+ adapted to location, and added options to control whether local TOCs
+ and Lists Of add an entry corresponding to their heading in the `.toc`
+ file. Compatibility with `tocbibind` package, too.
+
+- `1.1a` up to `1.1d` were mainly about refactoring core legacy code.
+ In part, this is to prepare for future changes relative to how
+ hyperref and the LaTeX kernel will interact in the future.
+
diff --git a/macros/latex/contrib/etoc/etoc.dtx b/macros/latex/contrib/etoc/etoc.dtx
index 8dd0df588a..1745aef818 100644
--- a/macros/latex/contrib/etoc/etoc.dtx
+++ b/macros/latex/contrib/etoc/etoc.dtx
@@ -2,20 +2,20 @@
% N.B.: this dtx file does NOT use \DocInput. It does NOT prefix the user
% manual part with percent characters.
%<*none>
-\def\etocdtxtimestamp {Time-stamp: <01-03-2023 at 23:38:38 CET>}%
+\def\etocdtxtimestamp {Time-stamp: <30-04-2023 at 21:53:47 CEST>}%
%</none>
%<*!readme>
%%
%% Package: etoc
-%% Version: 1.2
+%% Version: 1.2a
%% License: LPPL 1.3c
%% Copyright (C) 2012-2023 Jean-Francois Burnol
%% <jfbu at free dot fr>
%</!readme>
%<*none>
-\def\etocpkgdate {2023/03/01}
-\def\etocdocdate {2023/03/01}
-\def\etocpkgversion {1.2}
+\def\etocpkgdate {2023/05/01}
+\def\etocdocdate {2023/05/01}
+\def\etocpkgversion {1.2a}
\def\etocpkgdescription {Completely customisable TOCs (JFB)}
%% Formerly this etoc.dtx also included source for a German translation
%% etoc-DE.pdf. But all additions since April 2015 had been only in English.
@@ -29,7 +29,7 @@
\catcode32=13\catcode`\\=12^^Brelax^^A
^^Bfirstofone{^^Bendgroup^^Bdef^^BetocLicense^^A
{% Package: etoc
-% Version: 1.2
+% Version: 1.2a
% License: LPPL 1.3c
% Copyright (C) 2012-2023 Jean-Francois Burnol <jfbu at free dot fr>
%
@@ -56,7 +56,7 @@
%<*readme>
<!-- -->
- Source: etoc.dtx (1.2)
+ Source: etoc.dtx (1.2a)
Author: Jean-Francois Burnol
Info: Completely customisable TOCs
License: LPPL 1.3c
@@ -72,7 +72,7 @@ tables of contents, i.e. having their scope limited to the last
sectioning command encountered.
No auxiliary file is used additionally to the standard `.toc` file.
-Release 1.2 provides experimental additions `\locallistoffigures` and
+Release 1.2 provides **experimental** additions `\locallistoffigures` and
`\locallistoftables` which also use only the `.toc` file.
Such local TOCs or "Lists Of" typically need to adopt a "display
@@ -137,32 +137,24 @@ etoc.sty, etoc.tex, etoc.pdf, etoc.dvi.
RECENT CHANGES
==============
-This is `1.2` of `2023/03/01`.
-
-`1.1a` up to `1.1d` were mainly about refactoring core legacy code
-dating back to the earliest versions of the package. The initial
-stimulus came from the necessity to prepare for changes to how
-hyperref and the LaTeX kernel will interact in the future.
-
-`1.2` added `\locallistoffigures` and `\locallistoftables`. One must
-pass options `lof` and `lot` to the package to activate these
-experimental features.
-
-The initial default rendering of the titles of tables of contents now
-uses the emulated document class code only for the global ones
-(`\tableofcontents`); for local ones (`localtableofcontents` and the
-new "local lists of") it uses by default a context aware title
-(such as `\subsection*` if local to a section). Thus, usage of
-`\etocsettocstyle` is now purely optional. Regarding the
-"line styles", the package has always used the unaltered rendering
-from the document class, so using the other core customization command
-`\etocsetstyle` to truly unleash the package powers has always been
-optional.
-
-Shoud they dare to go check the PDF documentations, users will
-discover that it has been completely restructured at release `1.2`, to
-the extent allowed by random permutations of topics, and that many
-commands have been added to facilitate usage of `\etocsettocstyle`.
+This is `1.2a` of `2023/05/01`.
+
+- `1.2a` lifted the requirement added at `1.1a` of a LaTeX kernel from
+ 2020-10-01 or later, and also the requirement added at `1.2` of
+ availability of the `\expanded` engine primitive. It also added a
+ `deeplevels` option.
+
+- `1.2` completed the core internal refactoring from `1.1a-d` and added
+ **experimental** `\locallistoffigures` and `\locallistoftables`. It also
+ let `\localtableofcontents` by default auto-select a heading style
+ adapted to location, and added options to control whether local TOCs
+ and Lists Of add an entry corresponding to their heading in the `.toc`
+ file. Compatibility with `tocbibind` package, too.
+
+- `1.1a` up to `1.1d` were mainly about refactoring core legacy code.
+ In part, this is to prepare for future changes relative to how
+ hyperref and the LaTeX kernel will interact in the future.
+
%</readme>
%<*tex>-------------------------------------------------------------------------
%% To produce the documentation etoc.pdf with source code included:
@@ -234,7 +226,7 @@ commands have been added to facilitate usage of `\etocsettocstyle`.
\endgroup
\fi % end of file extraction (from etex/latex/pdflatex run on etoc.dtx)
\ifnum\noetex=1 % warning for README.md
- \expandafter\def\expandafter\MessageDeFin\expandafter
+ \expandafter\def\expandafter\MessageDeFin\expandafter
{\MessageDeFin
\Msg{* warning: to get correct utf-8 encoded README.md ^^J}%
\Msg{* do etex etoc.dtx and not as here tex etoc.dtx ^^J}%
@@ -426,9 +418,9 @@ commands have been added to facilitate usage of `\etocsettocstyle`.
\renewcommand *{\sectionmark }[1]{%
% Que c'est pénible cette syntaxe \markboth/\markright de LaTeX !
% Pourquoi est-ce que \markright n'a pas été définie comme #1#2-> truc avec #2 ??
- \if@twoside \expandafter \markboth \else
+ \if@twoside \expandafter \markboth \else
\expandafter\expandafter\expandafter \markright\expandafter \@firstoftwo
- \fi
+ \fi
{\MakeMarkcase {\Ifnumbered {section}{\sectionmarkformat }{}#1}}%
{\MakeMarkcase {\Ifnumbered {section}{\sectionmarkformat }{}#1}}%
}
@@ -437,7 +429,7 @@ commands have been added to facilitate usage of `\etocsettocstyle`.
% dont la définition par défaut est :
% \rightmark:
-% macro:->\expandafter \@rightmark \firstmark \@empty \@empty
+% macro:->\expandafter \@rightmark \firstmark \@empty \@empty
\renewcommand*\rightmark{\expandafter\@rightmark\botmark \@empty\@empty}
% Au passage l'output de latexdef à un : supplémentaire bizarre
@@ -479,39 +471,39 @@ commands have been added to facilitate usage of `\etocsettocstyle`.
\def\MicroFont{\ttfamily\hyphenchar\font45 }
% modif de \do@noligs: \char`#1} --> \char`#1 }
-\makeatletter
+\makeatletter
\def\do@noligs #1%
{%
- \catcode `#1\active
- \begingroup \lccode `\~=`#1\relax
+ \catcode `#1\active
+ \begingroup \lccode `\~=`#1\relax
\lowercase {\endgroup \def ~{\kern \z@ \char `#1 }}%
-}%
+}%
\def\dobackslash
{%
- \catcode92 \active
- \begingroup \lccode `\~=92\relax
+ \catcode92 \active
+ \begingroup \lccode `\~=92\relax
\lowercase {\endgroup \def ~{\kern \z@ \char 92 }}%
-}%
+}%
\def\dobraces
{%
- \catcode123 \active
- \begingroup \lccode `\~=123\relax
+ \catcode123 \active
+ \begingroup \lccode `\~=123\relax
\lowercase {\endgroup \def ~{\hskip \z@\@plus.1pt\@minus.1pt
\char 123 }}%
- \catcode125 \active
- \begingroup \lccode `\~=125\relax
+ \catcode125 \active
+ \begingroup \lccode `\~=125\relax
\lowercase {\endgroup \def ~{\char 125 \hskip \z@\@plus.1pt\@minus.1pt }}%
-}%
-\def\verb
+}%
+\def\verb
{%
\relax \ifmmode\hbox\else\leavevmode\null\fi
\bgroup \MicroFont
\let\do\do@noligs \verbatim@nolig@list
- \let\do\@makeother \dospecials
- \catcode32 10
- \dobackslash \dobraces \makestarlowast
- \@jfverb
-}%
+ \let\do\@makeother \dospecials
+ \catcode32 10
+ \dobackslash \dobraces \makestarlowast
+ \@jfverb
+}%
\def\@jfverb #1{\catcode`#1\active
\lccode`\~`#1\lowercase{\def~{\egroup\unskip}}}%
% (\unskip ajouté le 14 octobre)
@@ -680,7 +672,7 @@ commands have been added to facilitate usage of `\etocsettocstyle`.
% 12 mars 2015, pour 1.08a, see http://tex.stackexchange.com/a/232584/4686
-\usetikzlibrary{mindmap}
+\usetikzlibrary{mindmap}
% Vendredi 13 mars 2015 à 18:10:40
% POUR LA TOC DE TITLE PAGE
\usepackage{eso-pic}
@@ -696,7 +688,7 @@ linktoc=all,%
%%linktoc=none,% STRESS TEST OF 1.1a
%% bookmarksdepth=3,% (not needeed anymore now, 1.07g)
breaklinks=true,%
-colorlinks,%
+colorlinks,%
linkcolor=RoyalBlue,% Orchid
urlcolor=OliveGreen,%
pdfauthor={Jean-François Burnol},% on peut y aller maintenant avec ç en 2022...
@@ -707,7 +699,7 @@ pdfstartview=FitH,%
%%pdfpagemode=UseOutlines,% commented-out for 1.09h
}
% added usage of package bookmark 2013/10/10
-\usepackage{bookmark}
+\usepackage{bookmark}
\usepackage{varioref}
% Vendredi 16 septembre 2016
@@ -760,7 +752,7 @@ pdfstartview=FitH,%
%\else
\usepackage{attachfile}% no op with dvipdfmx
%\fi
-%
+%
\def\CEST{+02'00'}\def\CET{+01'00'}
\def\ExtractDateStamp #1<#2-#3-#4 at #5:#6:#7 #8>%
{D:#4#3#2#5#6#7\csname#8\endcsname}
@@ -864,7 +856,8 @@ pdfstartview=FitH,%
{\stepcounter{visibletoc}%
\phantomsection
\etoctoccontentsline{visibletoc}{\the\value{visibletoc}}}
-\etocsetlevel{visibletoc}{6}
+% at 1.2a \etocthemaxlevel for test of build with deeplevels option
+\etocsetlevel{visibletoc}{\etocthemaxlevel}
%--------
% Statistics on sections and subsections in a part \thispartstats:
% 2 mars 2013
@@ -920,20 +913,20 @@ pdfstartview=FitH,%
section\ifnum\value{mycounti}>1 s\fi{} and
\ifnum\value{mycountii}>1 \arabic{mycountii} \else no \fi
subsection\ifnum\value{mycountii}>1 s\fi. The name of
- the first section is
- ``\unhbox\firstnamei{}'' and the corresponding number is
- ``\unhbox\firstnumberi''. The name of the last section is
+ the first section is
+ ``\unhbox\firstnamei{}'' and the corresponding number is
+ ``\unhbox\firstnumberi''. The name of the last section is
``\unhbox\lastnamei{}'' and its number is
- ``\unhbox\lastnumberi''.
+ ``\unhbox\lastnumberi''.
\ifnum\value{mycountii}>0 The name of
- the first subsection is
- ``\unhbox\firstnameii{}'' and the corresponding number is
- ``\unhbox\firstnumberii''. The name of the last subsection is
+ the first subsection is
+ ``\unhbox\firstnameii{}'' and the corresponding number is
+ ``\unhbox\firstnumberii''. The name of the last subsection is
``\unhbox\lastnameii{}'' and its number is
``\unhbox\lastnumberii''.\fi
\par}}
- \etocinline
-% october 10, 2013.
+ \etocinline
+% october 10, 2013.
\etocsetnexttocdepth {2}%
\etocsettocstyle {\pdfbookmark[1]{Statistics}{\thepart.STATS}}{}
\localtableofcontents
@@ -963,7 +956,7 @@ pdfstartview=FitH,%
\else
% for .toc suffixed macros
\ifcsname r@etocmacro-\xintTrimUnbraced{-4}{#1}\endcsname
- \hyperref[etocmacro-\xintTrimUnbraced{-4}{#1}]{\ttfamily\hyphenchar\font45
+ \hyperref[etocmacro-\xintTrimUnbraced{-4}{#1}]{\ttfamily\hyphenchar\font45
\xintTrim{\nbforuser}{#1}}%
\else
% 2023/02/27 also catch non existing destinations in source code
@@ -1098,53 +1091,53 @@ etoc-af-ter-con-tents-hook
etoc-af-ter-toc-hook
etoc-skip-first-pre-fix
etoc-only-on-first
-%
-etoc-font-mi-nus-two
-etoc-font-mi-nus-one
-etoc-font-zero
-etoc-font-one
-etoc-font-two
-etoc-font-three
-etoc-sep-mi-nus-two
-etoc-sep-mi-nus-one
-etoc-sep-zero
-etoc-sep-one
-etoc-sep-two
-etoc-sep-three
-etoc-mi-nus-two-left-mar-gin
-etoc-mi-nus-two-right-mar-gin
-etoc-mi-nus-one-left-mar-gin
-etoc-mi-nus-one-right-mar-gin
-etoc-base-line-spread-mi-nus-two
-etoc-base-line-spread-mi-nus-one
-etoc-base-line-spread-zero
-etoc-base-line-spread-one
-etoc-base-line-spread-two
-etoc-base-line-spread-three
-etoc-toc-line-lead-ers
-etoc-ab-brev-page-name
-etoc-part-name
-etoc-book-name
-etoc-above-toc-skip
-etoc-be-low-toc-skip
-etoc-column-sep
-etoc-mul-ti-col-sep
-etoc-mul-ti-col-pre-tol-er-ance
-etoc-mul-ti-col-tol-er-ance
-etoc-de-fault-nb-col
-etoc-in-ner-top-sep
-etoc-top-rule
-etoc-top-rule-col-or-cmd
-etoc-in-ner-left-sep
-etoc-in-ner-right-sep
-etoc-in-ner-bot-tom-sep
-etoc-left-rule
-etoc-right-rule
-etoc-bot-tom-rule
-etoc-left-rule-col-or-cmd
-etoc-right-rule-col-or-cmd
-etoc-bot-tom-rule-col-or-cmd
-etoc-bkg-col-or-cmd
+%
+etoc-font-mi-nus-two
+etoc-font-mi-nus-one
+etoc-font-zero
+etoc-font-one
+etoc-font-two
+etoc-font-three
+etoc-sep-mi-nus-two
+etoc-sep-mi-nus-one
+etoc-sep-zero
+etoc-sep-one
+etoc-sep-two
+etoc-sep-three
+etoc-mi-nus-two-left-mar-gin
+etoc-mi-nus-two-right-mar-gin
+etoc-mi-nus-one-left-mar-gin
+etoc-mi-nus-one-right-mar-gin
+etoc-base-line-spread-mi-nus-two
+etoc-base-line-spread-mi-nus-one
+etoc-base-line-spread-zero
+etoc-base-line-spread-one
+etoc-base-line-spread-two
+etoc-base-line-spread-three
+etoc-toc-line-lead-ers
+etoc-ab-brev-page-name
+etoc-part-name
+etoc-book-name
+etoc-above-toc-skip
+etoc-be-low-toc-skip
+etoc-column-sep
+etoc-mul-ti-col-sep
+etoc-mul-ti-col-pre-tol-er-ance
+etoc-mul-ti-col-tol-er-ance
+etoc-de-fault-nb-col
+etoc-in-ner-top-sep
+etoc-top-rule
+etoc-top-rule-col-or-cmd
+etoc-in-ner-left-sep
+etoc-in-ner-right-sep
+etoc-in-ner-bot-tom-sep
+etoc-left-rule
+etoc-right-rule
+etoc-bot-tom-rule
+etoc-left-rule-col-or-cmd
+etoc-right-rule-col-or-cmd
+etoc-bot-tom-rule-col-or-cmd
+etoc-bkg-col-or-cmd
etoc-framed-mp-hook
etoc-keep-orig-i-nal-table-of-con-tents
etoc-im-me-di-ate-set-toc-dep-th
@@ -1198,12 +1191,12 @@ next-toc-with-tags
% 12 et 13 mars 2015 pour la mind map de title page
% pour les Mindmap avec branch color
-\def\appendpart #1#2#3{%
+\def\appendpart #1#2#3{%
\edef\tmpstuff {\the#1 child [branch color = #3]{\the#2}}%
#1\expandafter {\tmpstuff }%
}
% for 1.09f mind map on title page
-\def\prependpart #1#2#3{%
+\def\prependpart #1#2#3{%
\edef\tmpstuff {child [branch color = #3]{\the#2} \the#1}%
#1\expandafter {\tmpstuff }%
}
@@ -1327,7 +1320,7 @@ next-toc-with-tags
}%
}%
}%
- \appendtotok\parttok\childnode
+ \appendtotok\parttok\childnode
}
{}
@@ -1338,7 +1331,7 @@ next-toc-with-tags
% 1.2 uses append always so we can initialize here
\treetok{\node [root concept]{\normalfont{The \etoc package}\par {\normalsize\textsc
{Jean-François Burnol}\par \ttfamily jfbu (at) free (dot) fr}\par
- {\normalsize
+ {\normalsize
Package version:\par \hyperref[changelog]{\etocpkgversion{} (\etocpkgdate )}\par}}%
}
@@ -1385,7 +1378,7 @@ next-toc-with-tags
sibling angle=360/8},% 8 parties
% level 1 concept/.append style={font=\Large, text width = 3cm},
% ancienne version circulaire
- % level 2/.append style={level distance=12.5cm, sibling angle=360/39},%
+ % level 2/.append style={level distance=12.5cm, sibling angle=360/39},%
% pour version rectangulaire, par tâtonnements:
% réactivée pour 1.09f (étonnamment, juste quelques petits ajustements, mais ça
% a tout de même pris pas mal de temps...)
@@ -1406,7 +1399,7 @@ next-toc-with-tags
% On l'envoie au shipout
\AddToShipoutPictureFG*{\put(.5\paperwidth,.5\paperheight)
{\makebox(0,0){\box\TitlePageMindmapTOC}}}
-% trigger first page
+% trigger first page
\noindent\null\par\vskip-5cm\hbox{\hypertarget{FRONTPAGE}{}}\vskip5cm
% % for standard TOC
@@ -1433,36 +1426,40 @@ next-toc-with-tags
\onehalfspacing
\begin{shaded}\small
- Since \etocrelease{1.08h} (2016/09/25), about 25 code samples
- (especially the longer ones) are incorporated into the PDF file (thanks to
- \textsc{Scott Pakin}'s \href{http://www.ctan.org/pkg/attachfile}{attachfile}
- package) as \textit{file attachement annotations}. Each file is represented
- by its filename in the margin after the verbatim rendering of the
- corresponding code. Clicking on this filename will on supporting viewers
- trigger some dialog for extracting the file, or perhaps even will extract it
- automatically and open it in some text editor. This is much better than
- copy-paste which often loses indentation. In some PDF viewers side panels
- may provide a convenient clickable list of all these \textit{attachments
- annotations}.
+ % lien pour pour les "attachment annotations"
% https://helpx.adobe.com/acrobat/using/comments.html
-
- \medskip
-
- Since \etocrelease{1.09h} (2022/11/20), the command names throughout
+ %
+% Memo: https://english.stackexchange.com/questions/42370/is-two-thirds-plural
+% Yes and no. Yes, when you're talking about multiples of fractions eg. two
+% thirds they are plural. But when you're talking about a portion of a single
+% item, that item is singular.
+% 1). One third of the pizza was eaten. (part of one pizza was eaten)
+% Two thirds of the pizza was eaten. (part of one pizza was eaten)
+% The subject is pizza - singular. If you have one third of a pizza, and I have
+% one third of that same pizza we have two thirds (plural) of one pizza
+% (singular).
+% Of course this changes when the subject becomes plural:
+% One third of two pizzas were eaten. (part of two pizzas were eaten)
+% 2). One third of the visitors were men. (multiple visitors were men)
+% Two thirds of the visitors were men. (multiple visitors were men)
+% The subject in this case - men - is plural.
+%
+% Cependant j'ai un doute à cause de «the first» qui en française se traduirait
+% par un pluriel «les premiers deux-tiers» et ensuite on aurait envie de mettre
+% un pluriel; mais de toute la Grammaire n'a pas de Logique ! Tout le monde le
+% sait !
+%
+ The command names throughout
the user documentation which are displayed
{\textcolor{RoyalBlue}{with this colour}} are doubly hyperlinked:
- their left parts hyperlink to the user documentation, their right
- parts hyperlink to the source code. You can try it out now:
+ the first two-thirds of the command name hyperlinks to the user documentation, and the
+ remaining third part hyperlinks to the source code. You can try it out now:
\csb{localtableofcontents}. But read this first: if you get lost
inside the source code, clicking on control sequences displayed
{\textcolor{macrocodelinktouserdoccolor}{with this colour}} brings
you back to the part of the user manual discussing that specific
command. \ifnum\NoSourceCode=1 (but this PDF does not include the
- source code) \fi As of \etocrelease{1.2} (2023/03/01), the left
- \emph{two-third} of the command name hyperlinks to its user documentation,
- not only the left \emph{half}, as landing by accident in the midst
- of the source code is not recommended for the general public, so the
- dangerous area was made smaller.
+ source code) \fi
\end{shaded}
@@ -1481,7 +1478,7 @@ tables of contents, i.e. having their scope limited to the last
sectioning command encountered.
No auxiliary file is used additionally to the standard \texttt{.toc}
-file. Release \etocrelease{1.2} provides experimental additions
+file. Release \etocrelease{1.2} provides EXPERIMENTAL additions
\csb{locallistoffigures} and \csb{locallistoftables} which also use
only the \texttt{.toc} file.
@@ -1509,7 +1506,7 @@ TOCs as trees or mind maps.
%\end{abstract}
\endgroup
-\clearpage
+%\clearpage
\setstretch{1}
@@ -1519,7 +1516,7 @@ TOCs as trees or mind maps.
\begingroup
\ttfamily
\hyphenchar\font -1
- \parindent0pt
+ \parindent0pt
\obeyspaces\obeylines %
\etocLicense\endgroup
@@ -1591,7 +1588,7 @@ Throughout this documentation ``layout'', ``display'', ``TOC style'' always are
synonyms and refer roughly to how the TOC title is typeset. And ``line
styles'' refer to how each individual entry in the TOC will be rendered
according to its ``level''. Whenever ``TOC style'' is mentioned it is for the
-title related things, else the documentation will say ``line styles''.
+title related things, else the documentation will say ``line styles''.
\csb{etocsetstyle} is for line styles and it requires \LaTeX{} fluency. It is
however absolutely not required to use it: by default \etoc does not intervene
@@ -1648,7 +1645,57 @@ will ignore the status of these options, as in the \ctanpkg{memoir} class.
The major novelty with \etocrelease{1.2} is the addition of
\csb{locallistoffigures} and \csb{locallistoftables}.
-Please read this:
+\begin{framed}
+ The following major problem is known with the current implementation:
+ \csb{locallistoffigures} and \csb{locallistoftables} actually list the
+ figures, respectively the tables, say in a given \csa{section} which are
+ \textbf{TYPESET THEREIN}, which is not necessarily the same figures, tables,
+ which in the \LaTeX{} source are located \textbf{``WITHIN'' THAT SECTION}.
+
+ Recall that \LaTeX{} does not have a structured representation of the
+ document (despite what many people like to think), so there is no
+ pre-existing official way from inside a table to know in which section or
+ subsection it is defined. And figures and tables are \emph{floating}.
+
+ If a figure, for example, floats to next page, and the section were it was
+ \emph{defined} is followed on the initial page by another one, then a
+ \csb{locallistoffigures} in the first section will NOT see the figure which
+ has drifted to next page! That floating figure will be listed by a
+ \csb{locallistoffigures} in the NEXT section!
+
+ Now, if all sections are equipped with \csb{locallistoffigures} this current
+ ``feature'' of \etoc means that all figures will be accounted for and one
+ will be able to see in which section they physically reside after
+ typesetting!
+
+ Which is nice but perhaps counter intuitive.
+
+ The source of this problem is well-understood by package author but
+ addressing the issue is delayed probably for some months, by lack of time
+ and ressources; or may remain a permanent ``feature'' as the author does not
+ intend to hack in any way into code for floats, or even captions.
+
+ Here is a non-\etoc file you can play with and which illustrates the
+ mechanism:
+\begin{verbatim}
+\documentclass{article}
+\begin{document}
+\tableofcontents % the table of contents will show the "table" entry
+ % as belonging to **second** section
+\section{first}
+\begin{table}[p]
+ some tabular
+ \makeatletter
+ % add some entry in the toc file, like a subsection would do
+ \write\@auxout{\string \@writefile {toc}
+ {\protect \contentsline {subsection}{table}{\thepage }{}}}
+ \caption{table}
+\end{table}
+
+\section{second}
+\end{document}
+\end{verbatim}
+\end{framed}
\begin{itemize}
\item This is experimental code and the user interface as well as the
output may change.
@@ -1768,7 +1815,7 @@ Generally speaking the \marg{before\_toc} part should leave \TeX{} in
package default ones) all expect to get started in `vertical mode'.
For more documentation of this and related commands see first
-\autoref{sec:compatoverview} then
+\autoref{sec:compatoverview} then
\autoref{sec:tocstyle} for the more detailed pre-\etocrelease{1.2} documentation.
Only daring people will continue reading documentation as it now starts
@@ -1917,6 +1964,9 @@ will use some pre-defined defaults which are in \etoc source code.
ones. The denomination is a bit confusing as `default' here means that
these line styles are the ones defined by default, but not used by
default\dots{} perhaps \csa{etocfallbacklines} would have been a better name.
+
+ Please be aware that by design the |paragraph| and |subparagraph| linestyles
+ are configured by \csb{etocdefaultlines} to display nothing at all.
\end{description}
Naturally \csb{etocsettocstyle} and \csb{etocsetstyle} can be used arbitrarily
@@ -1933,23 +1983,27 @@ custom changes.
During expansion of \csb{locallistoffigures} or
\csb{locallistoftables}, the macros \csb{etoclocallistoffigureshook} resp.\@
\csb{etoclocallistoftableshook} are executed right before typesetting
-the entries. (Click on ``hook'' in previous sentence for advices on their usage).
+the entries. Their default definitions (refer to source code for more info):
\begin{verbatim}
-\def\etoclocallistoffigureshook{\etocstandardlines}
-\def\etoclocallistoftableshook {\etocstandardlines}
+\def\etoclocallistoffigureshook{\etocstandardlines}%
+\def\etoclocallistoftableshook {\etocstandardlines}%
\end{verbatim}
-Let's simply say here
-that if you redefine them to do nothing, the lines will use the style as
-appropriate for entries at numerical level one deeper than the ``local top'':
-i.e. in a section they will be typeset as if being subsections. If
-you have both \csb{locallistoffigures} and a \localtoc, this may align
-better vertically than the \LaTeX{} line style from the global ``Lists Of''.
+means compatibility mode, i.e.\@ the macros \csa{l@figure} and \csa{l@table}
+will be the ones involved, as if we were in the global \csa{listoffigures} or
+\csa{listoftables}.
+
+If you redefine these ``hook''-macros to do nothing, the figure/table entries
+will use the style as appropriate for entries at numerical level one deeper
+than the ``local top'': i.e. in a section they will be typeset as if being
+subsections. If you have both \csb{locallistoffigures} and a \localtoc, this
+may align better vertically than the \LaTeX{} line style from the global
+``Lists Of''.
Note that ``hook'' is used here in a very naive meaning of some macro which is
pre-located somewhere and that one can redefine to obtains various effects.
-\section{A list of the commands added at \protect\etocrelease{1.2}}
+\section{A list of the commands added at \texorpdfstring{\protect\etocrelease{1.2}}{1.2}}
\label{etocstoretocstyleinto}
\label{etocstorelinestylesinto}
\label{etocstorethislinestyleinto}
@@ -1964,6 +2018,8 @@ pre-located somewhere and that one can redefine to obtains various effects.
\label{etociflocallottotoc}
\label{etocifisstarred}
\label{etoclevel}
+\label{etocthelevel}
+%%\label{etocthemaxlevel}
\label{etocifunknownlevelTF}
\label{etocdivisionnameatlevel}
\label{etoclocalheadtotoc}
@@ -1995,74 +2051,98 @@ pre-located somewhere and that one can redefine to obtains various effects.
for deeper local TOCs or ``lists of''.
\end{shaded}
-With \csb{etocsettocstyle} one has complete decision about how the TOCs
-typeset their titles. Thus, this also means that supporting the options such
-as \etocoption{localtoctotoc} is entirely up to the provided code. There is
-no real reason for the user to go into this but \etoc does provide
-nevertheless generic utilities allowing to write very general styles,
-supporting the options if so desired. We now turn to their descriptions. The
-first few are accompanied with more details, but all hyperlink to their source
-code via the right third of their names (some are defined in batches and
-receive initial dummy definitions only to provide hyperlink targets).
+\DeleteShortVerb\|
+First there is \csb{etocsetup}:
\begin{description}
-\item [\csb{etocstoretocstyleinto}\marg{control\_sequence}] This is a command
- with one mandatory argument which must be a control sequence such as
- \csa{foo}. The macro \csa{foo} is then overwritten with no check if it
- exists already. Its effect is to store inside \csa{foo} the data configured
- by the last \csb{etocsettocstyle}. Then inserting \csa{foo} in the document
- will restore the saved toc style.%
-%
-\footnote{It is impossible to store the style used by the
- \csb{etocetoclocaltocstyle} for local TOCs. Only the one for main TOCs,
- which was configured by last usage of \csb{etocsettocstyle} is saved in
- \csa{foo}. After \csa{foo} is executed, one needs to again issue
- \csb{etocetoclocaltocstyle} if one wants the latter to be active.}
+\item [\csb{etocsetup}\marg{key[=true|false],...}] has already been mentioned
+ earlier. It is usable with \etocoption{maintoctotoc},
+ \etocoption{localtoctotoc}, \etocoption{localloftotoc},
+ \etocoption{locallottotoc}, and \etocoption{ouroboros}, everywhere in the
+ document after the package loading.
+\end{description}
-\item [\csb{etocstorelinestylesinto}\marg{control\_sequence}] Same principle
- but now \csa{foo} will store the line styles for all levels. And inserting
- \csa{foo} will have the same effect as re-doing all \csb{etocsetstyle} for
- all levels.
+\MakeShortVerb\|
+
+Then some utilities relative to the
+\csb{etocsetlevel} command:
+\begin{itemize}
+\item \csb{etoclevel}\marg{levelname} expands to a numeric quantity giving the
+ level of a given string argument. For example \csb{etoclevel}|{section}|
+ will usually produce a \TeX{} number denotation of value one. It is
+ provided for matters of programming, as its output format is suitable for
+ usage in \csa{ifnum} test. For typesetting, it should be prefixed
+ by the \TeX{} primitive \csa{number}.
+
+\item \csb{etocthelevel}\marg{levelname} expands to a explicit digits
+ (possibly prefixed by a minus sign), i.e.\@ it is equivalent to
+ |\number|\csb{etoclevel}\marg{levelname} and is provided as a
+ convenience. (added at \etocrelease{1.2a})
+
+\item \csb{etocthemaxlevel} expands to either |12| or |6| (default) depending
+ on whether the \etocoption{deeplevels} option was used or not. See the
+ documentation of \csb{etocsetlevel} for more. (added at \etocrelease{1.2a})
+
+\item \csb{etocifunknownlevelTF}\marg{levelname}\marg{True}\marg{False} is a
+ conditional to test if a level name has been declared to \etoc.
+\end{itemize}
+
+Then two utilities to help store and restore toc line styles:
+
+\begin{description}
+\item [\csb{etocstorelinestylesinto}\marg{control\_sequence}] This is a
+ command with one mandatory argument which must be a control sequence such as
+ \csa{foo}. The macro \csa{foo} is then overwritten with no check if it
+ exists already. Its effect is to store inside \csa{foo} the current toc
+ line styles configuration, for all levels at once. Then inserting \csa{foo}
+ in the document will restore all line styles to the state they were in at
+ time of usage of \csb{etocstorelinestylesinto}.
\item [\csb{etocstorethislinestyleinto}\marg{name or
number}\marg{control\_sequence}] Same principle but now \csa{foo} will
- store the line style for the specified level, which can be numerical or a
- name. And then executing \csa{foo} will have the same effect as re-doing the
- \csb{etocsetstyle} for this level.%
-%
-\footnote{Absolutely no error check is done on the first argument. There is no
- interface for re-assigning the style to another level, although it would not
- be difficult to code it. But the \etoc powers about re-assigning levels are
- things better left to unearthly entities such as the author.}
-
-\DeleteShortVerb\|
-
-\item [\csb{etocsetup}\marg{key[=true|false],...}] was already mentioned
- earlier. Only usable with the five boolean options. But everywhere in the
- document after the package loading.
+ store the line style for the specified level only. This argumant can be
+ numerical or a name. And thus executing \csa{foo} will then have the same
+ effect as re-doing the \csb{etocsetstyle} for that level.
\end{description}
-\MakeShortVerb\|
+The more numerous additions are relative to usage of \csb{etocsettocstyle},
+i.e.\@ customizing the ``display'' style. This mainly means matters relative
+to the title of the local TOCs or Lists Of, inclusive of whether they should
+add an entry into the |.toc| file matching their titles. Indeed, please be
+aware that as soon as you use \csb{etocsettocstyle} you will have to handle
+yourself the support for such behavior. Of course, as you also control the
+options, you don't have to use the provided command layer which tests the
+status of these options, but it is provided anyway as public interface.
+Indeed all of this is done via commands with no |@| letter in their names, and
+the package itself uses this public interface in its implementation of the
+default behavior, adjusted to the document class. The documentation here is
+brief, check for more the source code to which the listed commands are
+hyperlinked (from the last third of their names).
+
+Some of these commands are defined via batch processing done in loops in the
+code, and the hyperlinks only point to some initial dummy definitions, which
+were added only to provide such link targets, and one has to read the code
+further to discover the actual definitions.
-Those next will be more briefly described.
\begin{itemize}
\item \csb{etocifislocal}, \csb{etocifislocaltoc}, \csb{etocifislocallof},
\csb{etocifislocallot} can be used from inside the \csb{etocsettocstyle}
- first or second argument to select either one of the \marg{True} and \marg{False}
- branches.
+ first or second argument to select either one of the \marg{True} and
+ \marg{False} branches.
-\item \csb{etocifmaintoctotoc}, \csb{etociflocaltoctotoc},
+\item \csb{etocifmaintoctotoc}, \csb{etociflocaltoctotoc},
\csb{etociflocalloftotoc}, \csb{etociflocallottotoc}, are conditionals
- matching the options and selecting one of the \marg{True} or \marg{False} branches.
+ matching the options and selecting one of the \marg{True} or \marg{False}
+ branches.
\item \csb{etocifisstarred}\marg{True}\marg{False} says from inside the
\csb{etocsettocstyle} arguments if the toc or `list of' command was in
starred form.
- The \csb{etocetoclocaltocstyle} and \csb{etocclasstocstyle} have been configured so
- that when a |*| follows a \toc or \localtoc or local ``lists of'', its ``to
- toc'' behavior (if active from \ctanpkg{tocbibind} or \etoc own options) is
- canceled. They use \csb{etocifisstarred} to this effect.
+ The \csb{etocetoclocaltocstyle} and \csb{etocclasstocstyle} have been
+ configured so that when a |*| follows a \toc or \localtoc or local ``lists
+ of'', its ``to toc'' behavior (if active from \ctanpkg{tocbibind} or \etoc
+ own options) is canceled. They use \csb{etocifisstarred} to this effect.
\item \csb{etoclocalheadtotoc}\marg{levelname}\marg{text} is a synonym for
\centeredline{\csa{addcontentsline}|{toc}|\marg{@levelname}\marg{text}}
@@ -2086,43 +2166,57 @@ Those next will be more briefly described.
\item \csb{etocglobalheadtotoc}\marg{levelname}\marg{text} is a synonym for
\centeredline{\csa{addcontentsline}|{toc}|\marg{levelname}\marg{text}}
-%
- We
- have so many commands we can define another useless one\dots{} for aesthetic
- reasons of coherent names\dots{}
-
-\item \csb{etoclevel}\marg{levelname} expands to a numeric quantity giving
- the level of a given string argument. For example \csb{etoclevel}|{section}|
- will usually produce a \TeX{} number denotation of value one. It must be
- prefixed by something such as the \TeX{} primitive \csa{number} to give an
- explicit digit with perhaps a minus sign, but can serve as is in \csa{ifnum}
- tests.
-
-\item \csb{etocifunknownlevelTF}\marg{levelname}\marg{True}\marg{False} is a
- conditional to test if a level is known to \etoc.
+%
+ We have so many commands we can define another useless one\dots{} for
+ aesthetic reasons of coherent names\dots{}
\item \csb{etocdivisionnameatlevel}\marg{number} is an expandable construct
which starts from a numerical level from |-2| to |5| and produces one of
- |book|, |part|, ..., up to |subparagraph|.
-
-\item \csb{etocetoclocaltocmaketitle} is the command used by
+ |book|, |part|, ..., up to |subparagraph| as per the built-in \LaTeX\
+ (and standard classes) default assignments (and \ctanpkg{memoir} for
+ |book|).
+
+ Under option \etocoption{deeplevels} the numerical level can go up to |11|
+ but as there is no standard default for documents with extra sectioning
+ commands (e.g. is it using \csa{subsubsubparagraph}? or
+ \csa{subsubsubsection}? or some \csa{subivsection}?), the user has probably
+ to copy and redo with changes the package definition of
+ \csb{etocdivisionnameatlevel} in that case.
+
+\item \csb{etocetoclocaltocmaketitle} is the command used by
\csb{etocetoclocaltocstyle} which typesets a local ``list of'' title using
an un-numbered sectioning appropriate to its scope. See the source code for
how it looks.
-\item \csb{etocetoclistoffiguresmaketitle} and
+\item \csb{etocetoclistoffiguresmaketitle} and
\csb{etocetoclistoftablesmaketitle} are similar, see the source code.
-\item \csb{localcontentsname}, \csb{locallistfigurename}, \csb{locallisttablename}
- are self-explanatory.
+\item \csb{localcontentsname}, \csb{locallistfigurename},
+ \csb{locallisttablename} are self-explanatory.
-\item \csb{etocclasslocaltocmaketitle}, \csb{etocclasslocallofmaketitle},
+\item \csb{etocclasslocaltocmaketitle}, \csb{etocclasslocallofmaketitle},
\csb{etocclasslocallotmaketitle}, \csb{etocclassmaintocaddtotoc},
\csb{etocclasslocaltocaddtotoc}, \csb{etocclasslocallofaddtotoc},
\csb{etocclasslocallotaddtotoc}, well again see source code.
+\end{itemize}
+
+Finally there is a command to help store/restore a given display style configuration.
+\begin{description}
+\item [\csb{etocstoretocstyleinto}\marg{control\_sequence}] This is a command
+ with one mandatory argument which must be a control sequence such as
+ \csa{foo}. The macro \csa{foo} is then overwritten with no check if it
+ exists already. Its effect is to store inside \csa{foo} the data configured
+ by the last \csb{etocsettocstyle}. Then inserting \csa{foo} in the document
+ will restore the saved toc style.%
+%
+\footnote{It is impossible to store the style used by the
+ \csb{etocetoclocaltocstyle} for local TOCs. Only the one for main TOCs,
+ which was configured by last usage of \csb{etocsettocstyle} is saved in
+ \csa{foo}. After \csa{foo} is executed, one needs to again issue
+ \csb{etocetoclocaltocstyle} if one wants the latter to be active.}
+\end{description}
-\end{itemize}
% {\footnotesize (clearing this page as next display must be on one page
% only)\par}
@@ -2237,7 +2331,7 @@ and which were listed in the previous section.\par
{.\hfil\par\endgroup\pagebreak[3]}
% 27 janvier 2013 22:30
-% je définis les macros (non protégées)
+% je définis les macros (non protégées)
% \etocthename, \etocthenumber, \etocthepage
\etocruledstyle[1]{\etocfontminusone\color{green}%
@@ -2375,7 +2469,7 @@ And the output is:
{\item [{\bfseries\etocnumber.}] \etocname\ (\emph{p. \etocpage })}
{\end{itemize*}.}%
\etocsetnexttocdepth {subsection}%
- \etocsettocstyle {a clone of a local table of contents, originally defined in
+ \etocsettocstyle {a clone of a local table of contents, originally defined in
\autoref{sec:tocstyle}, but here rendered completely
differently via an inline \ctanpkg{enumitem} list: }{}%
\etocinline\tableofcontents \ref{toc:tocstyle}
@@ -2487,8 +2581,8 @@ The general format of \csb{etocruledstyle} is:
\centeredline{\csb{etocruledstyle}%
\oarg{number of columns}\marg{title of the toc}%
}%
-\noindent
-The title is horizontal material (the |LR| mode of
+\noindent
+The title is horizontal material (the |LR| mode of
\emph{\LaTeX{}, a document preparation system}): if it
does not fit on one line it should be put in a \csa{parbox} of
a given width.
@@ -2576,7 +2670,7 @@ names. Note that dimensions are stored in macros so are modifed using
are not color definitions, they execute \csa{color}, and their effect gets canceled
by re-defining them to do \csa{relax} or \csa{empty}.
\begin{verbatim}
-\newcommand*\etocabovetocskip{3.5ex plus 1ex minus .2ex}
+\newcommand*\etocabovetocskip{3.5ex plus 1ex minus .2ex}
\newcommand*\etocbelowtocskip{3.5ex plus 1ex minus .2ex}
\newcommand*\etoccolumnsep{2em}
@@ -2608,7 +2702,7 @@ by re-defining them to do \csa{relax} or \csa{empty}.
The \csa{etocframedmphook} is positioned immediately
after the beginning of a minipage environment where the
-contents of the framed TOC are typeset.
+contents of the framed TOC are typeset.
The \csa{...colorcmd} commands are initially set to expand to
\csa{relax} (hence do not require package |color| or |xcolor|
@@ -2620,7 +2714,7 @@ to reset it to do nothing, one \emph{must} use
Regarding the dimensions of the top rule they can be specified
in |ex|'s or |em|'s as in this example:
-\centeredline{|\renewcommand{\etoctoprule}{\hrule height 1ex}|}
+\centeredline{|\renewcommand{\etoctoprule}{\hrule height 1ex}|}
The package code is done in such a manner
that it is the font size in instance at the end of typesetting
the title argument to \csb{etocruled} or
@@ -2635,7 +2729,7 @@ horizontal \emph{leaders} (of a specified height) in the general
\TeX{} sense. However the left and right rules are not
used as (horizontal) leaders but as objects of a given specified
width. Note that \emph{only} the Plain \TeX{} syntax for rules is
-accepted here.
+accepted here.
\subsection{Headings, titles, \csbhyp{etocoldpar}, \csbhyp{etocinnertopsep}}
@@ -2643,7 +2737,7 @@ accepted here.
\label{etocoldpar}
For \csb{etocmulticolstyle} the mandatory \meta{heading} argument can be
-either
+either
vertical mode material like |\section*{\emph{Table of Contents}}| or
horizontal mode material like in the simple |\etocmulticolstyle{Hello World}|.
@@ -2672,7 +2766,7 @@ An important dimension used by all three of \csb{etocmulticolstyle},
between the heading and the start of the contents. Its default
value is |2ex| and it is changed with
|\renewcommand*{\etocinnertopsep}|\marg{new\_value}, not with
-|\setlength|.
+|\setlength|.
\section{Starred variants and hooks}
@@ -2796,7 +2890,7 @@ much better to use the further command \csb{etocnumber} inside
the item label, which gives the real thing. The improved
definitions will thus be explained later.
-With this style, one would have
+With this style, one would have
to be imaginative to design something then for paragraph and
subparagraph entries! perhaps as superscripts? Well, usually
one does not need paragraphs and subparagraphs numbered and
@@ -2822,7 +2916,7 @@ encountered and the previous one was at a higher level. The
\meta{finish} code is executed when one again encounters a higher
level toc entry. In the meantime all entries for that level are
typeset by executing first the \meta{prefix} code and then the
-\meta{contents} code.
+\meta{contents} code.
The (robust) commands \csb{etocname}, \csb{etocnumber} and \csb{etocpage} are
provided for use inside the \meta{prefix} and \meta{contents} parts of the
@@ -3028,6 +3122,7 @@ The command \csb{etoclink} is its robust variant.
\subsection{The \csbhyp{etocsetlevel} command}
\label{etocsetlevel}
+\label{etocthemaxlevel}
One
can inform \etoc of a level to associate to a given sectioning
@@ -3043,19 +3138,19 @@ In compatibility mode, it will be assumed that the commands |\l@cell|,
doing only |\etocsetlevel| is not enough for the corresponding level to work
out-of-the-box in compatibility mode.
-However, if no table of contents is typeset in compatibility mode, then all that
-matters is that the various line styles have been set. If, for example
+However, if table of contents are never using compatibility mode, then all
+that matters is that the various line styles have been set. If, for example
|section| is at level |1|, then there is no need to do some
\csb{etocsetstyle}|{molecule}{..}{..}{..}{..}| after
\csb{etocsetlevel}|{molecule}{1}| if
-\csb{etocsetstyle}|{section}{..}{..}{..}{..}| has already been done (and it has
-been done by the package itself in its definition of its own line styles).
-
-The accepted levels run from |-2| to |6| inclusive. Anything else is
-mapped to |6|, which is a dummy level, never displayed. The package
-does:
+\csb{etocsetstyle}|{section}{..}{..}{..}{..}| has already been done (and it
+has been done by the package itself in its definition of its own line styles).
+
+The accepted levels (but see the frame below) run from |-1| to |6| inclusive
+(also |-2| with class \ctanpkg{memoir}). Anything else is mapped to |6|,
+which is a dummy level, never displayed. The package does:
\begin{verbatim}
-\etocsetlevel{book}{-2}
+\etocsetlevel{book}{-2}% (only with class memoir)
\etocsetlevel{part}{-1}
\etocsetlevel{chapter}{0}
\etocsetlevel{appendix}{0}% or 1 if document has no \chapter
@@ -3066,8 +3161,30 @@ does:
\etocsetlevel{subparagraph}{5}
\end{verbatim}
\etoc own custom styles are activated by \csb{etocdefaultlines}.
-
-These level assignments can be modified at anytime. See
+\begin{framed}
+ Boolean option \etocoption{deeplevels} added at \etocrelease{1.2a} has the
+ effect of replacing \texttt{6} by \texttt{12} as the maximal numerical level
+ (which, as has been said above, is never displayed). The value |6|
+ (default) or |12| (if \etocoption{deeplevels} is set to true) is held by
+ \csb{etocthemaxlevel}. With \etocoption{deeplevels} option one can for
+ example do:
+\begin{verbatim}
+\etocsetlevel{subsubsubsection}{4}
+\etocsetlevel{subsubsubsubsection}{5}
+\etocsetlevel{subsubsubsubsubsection}{6}
+\etocsetlevel{paragraph}{7}
+\etocsetlevel{subparagraph}{8}
+\end{verbatim}
+ but it is up to user to actually define \LaTeX{} commands such as
+ \csa{subsubsubsection}, and also to provide, if \etoc is left in
+ ``compatibility mode'', the suitable \csa{l@subsubsubsection} et al. needed
+ for TOC rendering. If you use \csb{etocsetstyle} (even only for one level
+ name) though, which quits ``compatiblity mode'', it is not
+ \csa{l@subsubsubsection} which needs definition, but
+ \csb{etocsetstyle}|{subsubsubsection}{..}{..}{..}{..}| which has to have
+ been used.
+\end{framed}
+The numerical level assignments can be modified at anytime. See
\autoref{part:surprising} for various applications of this technique.
@@ -3144,7 +3261,7 @@ an effect only locally to the environment or group where they are used.
\etocruledstyle{\normalfont\normalsize\rmfamily\fboxrule1pt\color{red}%
\fbox{\parbox{.8\linewidth}{\centering\normalcolor This is a table of
- contents for the (few) subsections of this section. It carries the label |toc:c|}}}
+ contents for the (few) subsections of this section. It carries the label |toc:c|}}}
\localtableofcontents \label{toc:c}
@@ -3157,7 +3274,7 @@ to customize the font choicess or vertical spaces, etc\dots, used
by these line styles, most other changes would require copying
them from the sources and modify them directly. Admittedly they
have been written at a rather scary low-\TeX{} level, and will not
-serve as a very friendly starting point.
+serve as a very friendly starting point.
Activating their use is done via \csb{etocdefaultlines}, or
\csb{etoctoclines} if the line styles have not been modified with
@@ -3290,7 +3407,7 @@ the TOC entries are (hopefully) formatted as would have
happened in the absence of \etoc.\footnote{with the
\ctanpkg{KOMA-script} classes, we noticed that
\csb{etocclasstocstyle} was apparently needed for the
- KOMA options |toc=left| to be active at the level of the line entries.}
+ KOMA options |toc=left| to be active at the level of the line entries.}
The \csb{etocstandardlines} compatibility mode will work also with
@@ -3368,10 +3485,10 @@ can be followed with optional labels or references:\par
\csb{etocpage}, \csb{etocifnumbered}\marg{A}\marg{B}}%
\framebox[\linewidth][c]
{\vbox{\hsize\wd0\normalcolor\noindent
- \toc \csa{label}|\{toc:here\}|\\
+ \toc \csa{label}|\{toc:here\}|\\
\toc \csa{ref}|\{toc:far\}| \\
\toc \csa{label}|\{toc:here\}| \csa{ref}|\{toc:far\}| \\
- \localtoc \csa{label}|\{toc:here\}|\\
+ \localtoc \csa{label}|\{toc:here\}|\\
\localtoc \csa{ref}|\{toc:far\}| \\
\localtoc \csa{label}|\{toc:here\}| \csa{ref}|\{toc:far\}| \\
\hbox{}{\itshape\ttfamily\ \ \ \ similarly with\ }%
@@ -3379,7 +3496,7 @@ can be followed with optional labels or references:\par
}}}
-\medskip
+\medskip
\localtoc \csa{ref}|{toc:far}| acts the same as \toc
\csa{ref}|{toc:far}|.
@@ -3396,9 +3513,9 @@ currently defined, not the ones from the cloned toc.
\thispartstats
-\etocsettocstyle{}{}% maybe I should use \etocclasstocstyle here ?
+\etocsettocstyle{}{}% maybe I should use \etocclasstocstyle here ?
% but then I probably need some extra KOMA stuff to
- % counteract the setspace effet
+ % counteract the setspace effet
\begingroup
\DeclareTOCStyleEntry[numwidth=2em,indent=0pt]{tocline}{section}
\DeclareTOCStyleEntry[numwidth=2.5em,indent=2em]{tocline}{subsection}
@@ -3448,7 +3565,7 @@ subsection, etc... (see also \csb{etocsetnexttocdepth}).%
\item[\localtocwrdp\marg{number}]
%
\mbox{}\footnote{Thanks to Tony \textsc{Roberts} for feature request.}
-%
+%
can be used to override the document or
current tocdepth setting (see \autoref{sec:tocdepth} for a discussion of
tocdepth) to become relative to where the local TOC originates. For example,
@@ -3497,7 +3614,7 @@ has been cloned here in a
\etocstandardlines % <-- use the defaults from the document class
\renewcommand{\etocbkgcolorcmd}{\color{green!5}}
\renewcommand{\etocbelowtocskip}{0pt\relax}
- \fboxsep1ex
+ \fboxsep1ex
\etocframedstyle [1]{\fbox{\makebox[.5\linewidth]{\etocfontminusone
I am from \hyperref[toc:part:styling]{far away}}}}
\etocsetnexttocdepth{subsection}
@@ -3568,7 +3685,7 @@ subsections, and subparagraphs in the style of subsubsections, if
so desired. One can also decide to set everything to be at the level
|6| (never displayed by \etoc), except for example
paragraphs, promoted to be at level |1|, and then one obtains a nice
-table of contents of all the paragraphs from the document!
+table of contents of all the paragraphs from the document!
(|tocdepth| at least |1|)\footnotemark
\end{framed}
@@ -3591,11 +3708,11 @@ appropriate value (which decides the finest sectioning level displayed) again
and again each time a table of contents needs to be typeset.
\etoc provides \csb {etocsettocdepth}\marg{level} whose mandatory argument is
-either
+either
numeric (from |-3| to |5|) or a division name such as |subsection| or
|subsubsection| or any name previously declared to \etoc with
\csb{etocsetlevel} (the keywords |all| and |none| are recognized, although not
-corresponding to a document division).
+corresponding to a document division).
This does the appropriate |\setcounter{tocdepth}{numeric_level}|.
As is explained in the next subsection, |tocdepth| is used by \ctanpkg{hyperref}, and
@@ -3651,7 +3768,7 @@ Or, there is the \emph{bookmarksdepth=n} option of package
maximal depth, which can be numeric or the name of a level known to
\ctanpkg{hyperref}. This documentation previously passed |bookmarksdepth=3| as
option to \ctanpkg{hyperref}, so even if |tocdepth| was left to |1|
-by inadvertance after printing a certain table of contents
+by inadvertance after printing a certain table of contents
this did not modify the bookmark tree of the |pdf| file. Now that
\csb{etocsetnexttocdepth} has been added to the package, we have used it
systematically and there was no need for |bookmarksdepth=3| anymore.
@@ -3676,7 +3793,7 @@ canceled by \etoc) and more-or-less designed for a single table of contents.
The action of \csb{etocsettocdepth.toc} is totally different than the one of
\csb{etocsettocdepth}. Rather than modifying the |tocdepth| counter immediately,
it adds a line to the |.toc| file which, when executed inside a table of
-contents will enact this change.
+contents will enact this change.
The command \csb{etocsettocdepth.toc}, like
\csb{etocsettocdepth}, accepts both numeric and named
@@ -3684,7 +3801,7 @@ arguments. In the case of a named argument, the actual numeric
value to be used is not yet decided at the time the |.toc|
file is created; it will be the value currently specified for
the named level at the time each table of contents (not having
-done |\etocignoretoctocdepth|) is typeset.
+done |\etocignoretoctocdepth|) is typeset.
The |tocdepth| counter will never be set to a value finer than its initial value
at the start of the table of contents: so adding commands
@@ -3719,7 +3836,7 @@ re-activate it. The package does initially \csb{etocobeytoctocdepth}.
-% Release \etocrelease{1.07h} has a
+% Release \etocrelease{1.07h} has a
The command \csb{etocdepthtag.toc}
allows to control dynamically the which contents end up included in the
displayed TOCs (this documentation also decribed formerly a way
@@ -3743,7 +3860,7 @@ keywords |none| and |all|.
As usual, once the tag depths have been set, they remain in effect until getting
redefined or seeing their scope expire via the closing of a group or of a
-surrounding
+surrounding
environment. For an example, see \autoref{sec:tocwithdepthtags}.
When using \csb{etocdepthtag.toc} in combination with \LaTeX's |\include|,
@@ -3769,7 +3886,7 @@ So%
with a fix, in July\dots 2016. Sorry for long delay before updating
\etoc six years later\dots}
%
-% \etocrelease{1.09f} adds
+% \etocrelease{1.09f} adds
there is \csb{etocimmediatedepthtag.toc} which will force the tag to be written
immediately to the |.toc| file (well, rather immediately to the |.aux| file,
so before the inclusion of the auxiliary file of the included file).
@@ -3810,7 +3927,7 @@ choice.
After \csb{etocignoredepthtags}, the |.toc| depth tags are ignored (but
\csb{etocdepthtag.toc} still works). The package does initially
\csb{etocobeydepthtags} which makes \etoc react to the found tags in the
-|.toc| file.
+|.toc| file.
\section{Adding commands to the \texorpdfstring{\texttt{.toc}}{.toc} file}
\label{sec:addingtotoc}
@@ -3846,7 +3963,7 @@ document has \csa{settocdepth}|{chapter}| at some point to
avoid having the sections from subsequent chapters be listed
in the main table of contents. Then a local table of contents
in one of these chapters will print a title but will be
-without any entry.
+without any entry.
As the \ctanpkg{memoir} class by itself allows multiple\toc
these issues already arise there,
@@ -3885,7 +4002,7 @@ I use the following trick: either in the preamble using
within a group (as if enclosed in an environment). So
the command \csa{hypersetup}|{hidelinks}| will be
executed by \emph{each} TOC, but its effect will be
- limited to that TOC.
+ limited to that TOC.
\end{framed}
I found out experimentally that the option |hidelinks| could
@@ -3913,7 +4030,7 @@ transparent to \csb{localtableofcontents}:
must display a TOC local to the \emph{subsection}.
\end{itemize}
-% Since release \etocrelease{1.08k}, \etoc provides the one-argument
+% Since release \etocrelease{1.08k}, \etoc provides the one-argument
There is the command
\csb{etocsetlocaltop.toc} to insert into the |.toc| file a kind
of ``ghost'' of a given sectioning unit. Here is an example:
@@ -4159,7 +4276,7 @@ And as we used
|\invisible...|,\footnote{this is a shortcut for setting temporarily the
|tocdepth| to |-3|, which has the effect to tell \etoc not to print the TOC,
and not even the heading.} the local TOC will exist only through its clones
-elsewhere in the document.
+elsewhere in the document.
\begin{filecontentsdef}{etocsnippet-\snippetno.tex}{\foo}
\begingroup\parindent 0pt \parfillskip 0pt \leftskip 0cm \rightskip 1cm
@@ -4255,7 +4372,7 @@ is done via the technique of \emph{depth tags}, described in
{\parfillskip 0pt plus 1fil\relax }
\etocsetstyle {subsection}
-{\leftskip1cm\rightskip .75cm \parfillskip 0pt plus 1fil\relax
+{\leftskip1cm\rightskip .75cm \parfillskip 0pt plus 1fil\relax
\nobreak\smallskip}
{}
{\footnotesize\sffamily\mdseries\itshape
@@ -4285,7 +4402,7 @@ The code:
\section{A Beautiful Thesis example}
Here is a relatively simple example of use of the package
-functionalities.
+functionalities.
Let us set up some line styles. We choose a style for sections and
sub-sections which would be suitable for, respectively, sections and
sub-sections in an average length memoir. The line style specifications have
@@ -4316,7 +4433,7 @@ breaks. Also, they do not worry about potential multi-column use.
\def\tmptitle{My Beautiful Thesis}
\etocsettocstyle{\color{cyan}\parindent0pt \leftskip\tocleftmargin
- \leavevmode\leaders\hrule height 1pt\hfill\
+ \leavevmode\leaders\hrule height 1pt\hfill\
\huge\textit{\tmptitle}\par}{\bigskip}
\tableofcontents \ref{toc:overview}
@@ -4391,7 +4508,7 @@ Here is an example. Include in the preamble:
\makeatletter
\newcommand{\MyLocalTOC}[1][section]{%
\begingroup
- \etocsetstyle{section}{}{}
+ \etocsetstyle{section}{}{}
{\l@section{\numberline{\etocnumber}\etocname}{\etocpage}}{}%
\etocsetstyle{subsection}{}{}
{\l@subsection{\numberline{\etocnumber}\etocname}{\etocpage}}{}%
@@ -4404,7 +4521,7 @@ Here is an example. Include in the preamble:
\etocsettocstyle{\@nameuse{#1}*{Local contents}}
{}
%
- \localtableofcontents
+ \localtableofcontents
\endgroup}
\makeatother
\end{filecontentshere}
@@ -4621,7 +4738,7 @@ using |pt| as dimensional unit.
{\advance\leftskip-\TOCnumwidthB\relax}%
\bfseries\etocname
\nobreak\hfil\makebox[-\parfillskip][r]{\etocpage}\par }%
- \penalty \@highpenalty
+ \penalty \@highpenalty
}
{}
{\advance\leftskip-\TOCnumwidthB\relax}%
@@ -4634,7 +4751,7 @@ using |pt| as dimensional unit.
}% end of \TOCglobalstyle
%The common code for line styles is abstracted into a macro:
-
+
\newcommand\TOCsetlinestyle [2]{% #1= unit, #2= numwidth as macro
\etocsetstyle{#1}
{\advance\leftskip#2\relax}
@@ -4686,7 +4803,7 @@ TOC at end of document one will naturally have to issue again
\rightskip 4.5em
\advance\rightskip-\TOCrightmargin\relax
\leavevmode\leaders\hrule\@height\p@\hfill\kern\z@\par
- \rightskip 4.5em
+ \rightskip 4.5em
\parfillskip -\TOCrightmargin\relax }
{\nobreak\vskip-.5\baselineskip
\leavevmode\leaders\hrule\@height\p@\hfill\kern\z@\par
@@ -4734,13 +4851,13 @@ line styles and some colors added (it has been put in a float which appears
\begin{filecontentshere}{etocsnippet-\snippetno.tex}
\etocdefaultlines
-\begingroup
+\begingroup
\renewcommand{\etoccolumnsep}{2em}
\renewcommand{\etocinnerleftsep}{1.5em}
\renewcommand{\etocinnerrightsep}{1.5em}
% specify a background color for the toc contents
\renewcommand{\etocbkgcolorcmd}{\color{yellow!10}}
-% set up the top and bottom rules
+% set up the top and bottom rules
\renewcommand{\etoctoprule}{\hrule height 1pt}
\renewcommand{\etoctoprulecolorcmd}{\color{red!25}}
\renewcommand{\etocbottomrule}{\hrule height 1pt}
@@ -4757,7 +4874,7 @@ line styles and some colors added (it has been put in a float which appears
\fcolorbox{red}{white}{\parbox{.8\linewidth}{\centering
This is a table of contents \`a la \etoc, but for
the subsections and subsubsections of \autoref{sec:tocstyle}.
- As it is put in a frame, it has to be small enough to fit on
+ As it is put in a frame, it has to be small enough to fit on
one page. It has the label |toc:b|.}}}
\begin{figure}[ht!]
\centering
@@ -4866,7 +4983,7 @@ code is used also for \hyperref[toc:clone]{this other toc}.
\etocframedstyle[1]{}
\tableofcontents \label{toc:floating} \ref{toc:part:styling}
\vspace{-\baselineskip}
-\centeredline{|\tableofcontents \ref{toc:part:styling}|
+\centeredline{|\tableofcontents \ref{toc:part:styling}|
(\emph{cf.} \hyperref[toc:clone]{this other toc})}
\end{figure}
\end{filecontentshere}
@@ -4884,12 +5001,12 @@ footnotes... This kind of style is suitable for a hyperlinked
document, probably not for print! (although I like it, but my personal tastes in
many matters do not seem to be widely shared).
-%%%% Note: 27 april 2014
+%%%% Note: 27 april 2014
%%%% except for a miraculous situation depending from the quantity of previous
%%%% material this TOC will have links extending accross pagebreaks, which
%%%% dvipdfmx does not know how to handle completely. Apart from that the output
-%%%% is ok, thus no need to try seriously to avoid them.
+%%%% is ok, thus no need to try seriously to avoid them.
\begin{filecontentsdef}{etocsnippet-\snippetno.tex}{\foo}
\begingroup
@@ -4990,7 +5107,7 @@ the frame.
\etocsetstyle{section}
{\coloredstuff{white}
- {\hfil \hyperref[toc:b]{\bfseries\large I am a twin of
+ {\hfil \hyperref[toc:b]{\bfseries\large I am a twin of
that other TOC (click me!)}\hfil}}
{\vskip3pt\sffamily\small}
{\coloredstuff{white}
@@ -5007,7 +5124,7 @@ the frame.
\marginattach
\filecontentsexec\filecontentsheremacro
-% 1.07l on the occasion of traduction into German documentation
+% 1.07l on the occasion of traduction into German documentation
% APRIL 26, 2014 Improvement in the section style for better placement of
% page number when the section name is more than one line long. Use of
% \makebox rather than \hbox, to be more LaTeX like.
@@ -5024,7 +5141,7 @@ framed style (which we used to get this background
color) can only deal with material short enough to fit on one
page.
-% 1.2 doc: commenté out to avoid a new page
+% 1.2 doc: commenté out to avoid a new page
% ah non finalement car cause TOC as a tree d'être sur page impaire,
% ce qui est moins bien à cause des overlap.
Regarding colors, generally speaking all color commands inside
@@ -5066,7 +5183,7 @@ displayed within this document:\footnote{The TOCs put in
this document... }
\tableofcontents
\endgroup. And to obtain
-it here we just wrote:\par\smallskip
+it here we just wrote:\par\smallskip
{\leftskip1cm\rightskip2cm
\ttfamily\small\baselineskip11pt \noindent Here is the
numbered and linked list of all tables of contents which are
@@ -5103,8 +5220,8 @@ it here we just wrote:\par\smallskip
\centeredline{| ||\addcontentsline{toc}|\marg{level\_name}\marg{name}}
but its usefulness is to circumvent\footnote{using \csa{addtocontents} rather
than \csa{addcontentsline}} the patching for automatic creation
- of bookmarks done to \csa{addcontentsline} by the \ctanpkg{hyperref} package,
- as pdf bookmarks don't make
+ of bookmarks done to \csa{addcontentsline} by the \ctanpkg{hyperref} package,
+ as pdf bookmarks don't make
much sense here (and would elicit a complaint
of \ctanpkg{hyperref} that the bookmark level is `unknown').\footnote{%
The package provides a starred variant
@@ -5115,15 +5232,18 @@ it here we just wrote:\par\smallskip
profitably preceded by \csa{phantomsection}.}
Finally, the preamble of the document did
- |\etocsetlevel{visibletoc}{6}|. The level |6| (or anything
+ \csb{etocsetlevel}|{visibletoc}{6}|. The level |6| (or anything
with a higher number) is ignored, even if |tocdepth| has
value |10| for example; this is independently of whether \etoc
uses the document class default line styles or its own line
styles, or the ones defined by the user with the
\csb{etocsetstyle} command. So there is no need to worry that
- something could go wrong.
+ something could go wrong.
+
+ \emph{The example actually uses \csb{etocthemaxlevel}, see the
+ \etocrelease{1.2a} change log entry.}
- Then, only here we have set |\etocsetlevel{visibletoc}{0}|. And to display
+ Then, only here we have set \csb{etocsetlevel}|{visibletoc}{0}|. And to display
only this kind of entries we assign temporarily to |part| and |chapter| level
|1| (or anything higher than zero) and set |tocdepth| to the value |0|. We
also did%
@@ -5144,7 +5264,7 @@ Here are the implementation details:
\newcounter{visibletoc}
\renewcommand{\etocaftertitlehook}
{\stepcounter{visibletoc}\etoctoccontentsline{visibletoc}{\thevisibletoc}}
-\etocsetlevel{visibletoc}{6}
+\etocsetlevel{visibletoc}{\etocthemaxlevel}
\begin{document}
< document body >
\subsection{Surprising uses of etoc}
@@ -5172,7 +5292,7 @@ chapters). To keep these changes strictly local the simplest
manner is to put everything inside a group.
The \autoref{subsec:interverting} gives another use of the
-shuffling of levels.
+shuffling of levels.
\section[Arbitrary ``Lists Of...'', \csbhyp{etoctoccontentsline}]{%
@@ -5184,13 +5304,14 @@ shuffling of levels.
This idea of interverting the levels is very powerful and allows
to let \etoc display lists of arbitrary things contained in the
document. All of that still
-using nothing else than the |.toc| file!
+using nothing else than the |.toc| file!
Example: imagine a document with dozens of
exercises, perhaps defined as |\newtheorem{exercise}{}[section]|. Let
us explain how to instruct \etoc to display an hyperlinked list
-of all these exercises. For this we put in the preamble:
+of all these exercises. For this we put in the preamble: (but see
+\etocrelease{1.2a} change log entry)
\begin{verbatim}
- \newtheorem{exerci}{}[section]
+ \newtheorem{exerci}{}[section]
% the exercice number will be recoverable via \etocname: v--here--v
\newcommand*{\exercisetotoc}{\etoctoccontentsline{exercise}{\theexerci}}
\newenvironment{exercise}{\begin{exerci}\exercisetotoc}{\end{exerci}}
@@ -5265,7 +5386,7 @@ delayed execution?
We need to store, not the macro names, but the macro contents. And also we wish
to maintain the correct \ctanpkg{hyperref} hyperlinks.
The
-commands \csb{etocname}, etc\dots, are robust, it is easier to work with
+commands \csb{etocname}, etc\dots, are robust, it is easier to work with
\csb{etocthelinkednumber}, \csb{etocthelinkedname}, and \csb{etocthelinkedpage}
which contain the same information in an easier accessible form.%
%
@@ -5299,7 +5420,7 @@ which will be given the contents of |\treetok|.
\newcommand*\PrepareSectionNode{%
\tmptok {\centering\bfseries}%
\appendtotok\tmptok\etocthelinkedname
- \edef\foresttreenode{ [{\noexpand\parbox{2cm}{\the\tmptok}}}%
+ \edef\foresttreenode{ [{\noexpand\parbox{2cm}{\the\tmptok}}}%
}
\newcommand*{\PrepareSubsectionNode}{%
@@ -5326,7 +5447,7 @@ which will be given the contents of |\treetok|.
% forest does not like @\the\treetok if \treetok is empty. On first latex
% run, this will be the case because the TOC style defined above will not
-% have been executed, as the label {toc:overview} does not refer to a valid
+% have been executed, as the label {toc:overview} does not refer to a valid
% TOC yet. So we must give a safe default value to \treetok
\treetok{[{run latex again}]}
@@ -5339,7 +5460,7 @@ which will be given the contents of |\treetok|.
% manual adjustments to fit the printed page
% \kern-1cm
\noindent\kern-3cm
- \begin{forest}
+ \begin{forest}
for tree={anchor=center,child anchor=west,
grow'=east,draw,thick,
edge={draw,thick,dashed,color=teal}},
@@ -5348,7 +5469,7 @@ which will be given the contents of |\treetok|.
where={level()==2}{fill=red!5,
before computing xy={l=6cm}}{},
rectangle, thick, fill=cyan!5, inner sep=6pt,
- @\the\treetok
+ @\the\treetok
\end{forest}
\end{figure}
\endgroup
@@ -5412,7 +5533,7 @@ contents of this (or another) document part, only a \csa{sectiontok} and a
\let\preparetreenode\relax
\begin{filecontentshere}{etocsnippet-\snippetno.tex}
% \newtoks\treetok % put this (uncommented) preferably in the preamble
-% \newtoks\subsectiontok
+% \newtoks\subsectiontok
% \newtoks\subsubsectiontok
% Attention: this code has been prepared only for subsections
% and subsubsections.
@@ -5457,7 +5578,7 @@ contents of this (or another) document part, only a \csa{sectiontok} and a
\centeredline{% from package centeredline (limits scope of \hypersetup)
\etocsetnexttocdepth{subsubsection}
\etocinline\tableofcontents \label{toc:molecule} \ref{toc:tocstyle}
- \hypersetup{hidelinks}%
+ \hypersetup{hidelinks}%
\begin{tikzpicture}
[grow cyclic,
level 1/.style={level distance=4cm,sibling angle=72},
@@ -5492,8 +5613,8 @@ data in the \csa{toks} register \csa{treetok}. This
% See the varioref package documentation for explanation.
% Type H <return> for immediate help.
-% ...
-
+% ...
+%
% l.6114 appears \vpageref{toc:mindmap}
% mais ça n'a pas suffit. Bon 10 minutes de perdues je vais déplacer la ligne.
@@ -5508,7 +5629,7 @@ Another example:
\etocsetnexttocdepth {subsubsection}
\tableofcontents \ref{toc:tocstyle}
-\centeredline{%
+\centeredline{%
\hypersetup{hidelinks}
\begin{tikzpicture}
[grow cyclic,
@@ -5516,7 +5637,7 @@ Another example:
level 2/.style={level distance=1cm,sibling angle=45},
every node/.style={ball color=red!50,circle,text=black},
edge from parent path={[very thick,color=cyan]
- (\tikzparentnode) --(\tikzchildnode)}]
+ (\tikzparentnode) --(\tikzchildnode)}]
\the\treetok
\end{tikzpicture}
}%
@@ -5551,7 +5672,7 @@ primitive \csa{unexpanded} will simplify the code.%
\newcommand*\appendtotok[2]{% #1=toks variable, #2=macro, expands once #2
#1\expandafter\expandafter\expandafter{\expandafter\the\expandafter #1#2}}
-\newcommand*{\appendchildtree}[3]{%
+\newcommand*{\appendchildtree}[3]{%
% this is to construct "t1 child [#3]{t2}" from #1=t1 and #2=t2
% t1 and t2 are two toks variable (not macros)
% #3 = for example teal!60
@@ -5585,8 +5706,8 @@ primitive \csa{unexpanded} will simplify the code.%
%\ifnum\value{partco}=5 \def\tmprotate {[counterclockwise from =-40]}\fi
%\ifnum\value{partco}=8 \def\tmprotate {[counterclockwise from =-50]}\fi
% define the part node
- \edef\partnode{node \tmpoption
- {\unexpanded\expandafter{\etocthelinkednumber}.
+ \edef\partnode{node \tmpoption
+ {\unexpanded\expandafter{\etocthelinkednumber}.
\unexpanded\expandafter{\etocthelinkedname}}\tmprotate }%
% this is a starting point which will be filled it by the section children
\parttok\expandafter{\partnode}}
@@ -5601,7 +5722,7 @@ primitive \csa{unexpanded} will simplify the code.%
{}
{}
{% define the section node
- \edef\childnode{child {node {\unexpanded\expandafter{\etocthelinkednumber}
+ \edef\childnode{child {node {\unexpanded\expandafter{\etocthelinkednumber}
\unexpanded\expandafter{\etocthelinkedname}}}}%
% append it to the current \parttok
\appendtotok\parttok\childnode
@@ -5638,10 +5759,10 @@ primitive \csa{unexpanded} will simplify the code.%
\tableofcontents\label{toc:mindmap}%
\centeredline{\resizebox{.85\paperwidth}{!}%
{\begin{tikzpicture}[mindmap,
- grow cyclic,
- text width=2cm,
- align=flush center,
- nodes={concept},
+ grow cyclic,
+ text width=2cm,
+ align=flush center,
+ nodes={concept},
concept color=orange!60,
root concept/.append style={text width=4cm, font=\Large},
level 1/.append style={level distance=5cm,sibling angle=45, text width=3cm},
@@ -5724,7 +5845,7 @@ The code follows.
\global\let\@gtempb\@firstofone %%% ADDED
\gdef\LT@sep{\penalty-\@medpenalty\vskip\doublerulesep}%
\else
- \global\let\@gtempa\@empty
+ \global\let\@gtempa\@empty
\global\let\@gtempb\@gobble %%% ADDED
\gdef\LT@sep{\penalty-\@lowpenalty\vskip-\arrayrulewidth}%
\fi
@@ -5807,7 +5928,7 @@ to have a rule above them (easy, they do |\\\hline|) but also
below them: after each part there is a section, and it is these
sections which are used to insert the missing |\hline|
(this is done with the help of the \csb{etociffirst}
-conditional).
+conditional).
Last technical note: because we put the |\\\hline| inside the branches, there
@@ -5949,7 +6070,7 @@ Notes:
Let us display and count all subsections occurring in this
document (see \autoref{part:surprising} for other uses of
-this technique):
+this technique):
\begin{verbatim}
\etocsetnexttocdepth{2}
\begingroup
@@ -6043,7 +6164,7 @@ But first, the code of \csa{thispartstats}:\par
Here are some statistics for this part: it contains \arabic{mycounti}
section\ifnum\value{mycounti}>1 s\fi{} and \arabic{mycountii}
subsection\ifnum\value{mycountii}>1 s\fi. The name of the first section is
- \unhbox\firstnamei{} and the corresponding number is \unhbox\firstnumberi.
+ \unhbox\firstnamei{} and the corresponding number is \unhbox\firstnumberi.
The name of the last section is \unhbox\lastnamei{} and its number is
\unhbox\lastnumberi. The name of the first subsection is \unhbox\firstnameii{}
and the corresponding number is \unhbox\firstnumberii. The name of the last
@@ -6077,9 +6198,9 @@ stands here is for using within a section).
\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}.}%
+ 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}%
@@ -6116,7 +6237,7 @@ get:
\begin{filecontentsdef}{etocsnippet-\snippetno.tex}{\foo}
\etocsetnexttocdepth {all}
-\begingroup
+\begingroup
\parindent 0pt \leftskip 0cm \rightskip .75cm \parfillskip -\rightskip
\newcommand*{\EndParWithPagenoInMargin}
{\nobreak\hfill
@@ -6168,9 +6289,9 @@ get:
\etocsettagdepth {code} {all}
\renewcommand\etoctoprule {\hrule height 3pt\relax }
\renewcommand\etoctoprulecolorcmd {\color{blue}}
-\renewcommand\etocaftercontentshook
+\renewcommand\etocaftercontentshook
{\medskip\begingroup \color{blue}\hrule height 3pt \endgroup }
-\etocruledstyle [1]{\Large\bfseries
+\etocruledstyle [1]{\Large\bfseries
\fbox{\makebox[8cm]{A TOC using depth tags}}}
\sloppy
\etocobeydepthtags % let's not forget to activate this (default anyhow)
@@ -6205,13 +6326,13 @@ only count how many there are!
\etocsetstyle{section}
{}
{\etociffirst{% Suppress display of subsections for the first section!
- \etocsetlevel{subsection}{6}}
+ \etocsetlevel{subsection}{\etocthemaxlevel}}
{\etocsetlevel{subsection}{2}}%
- \ifnum\etocthenumber=#2 % Handle especially section number #2 !
+ \ifnum\etocthenumber=#2 % Handle especially section number #2 !
\etocsetstyle{subsection}
{\def\foo{}\par\nopagebreak\begingroup
\leftskip2em \rightskip\@tocrmarg
- \parfillskip \@flushglue
+ \parfillskip \@flushglue
\parindent 0pt
\normalfont\normalsize\rmfamily\itshape
\etocskipfirstprefix}
@@ -6237,7 +6358,7 @@ only count how many there are!
\fi
}%
{% Display in a special color the number of the special section!
- \l@section{\numberline{{\ifnum\etocthenumber=#2
+ \l@section{\numberline{{\ifnum\etocthenumber=#2
\color{red}\else\color{cyan}\fi\etocthenumber}}%
\etociffirst{\etocname\space (SUBSECTIONS SKIPPED)}{\etocname}}
{\etocpage}}%
@@ -6257,7 +6378,7 @@ only count how many there are!
\marginattach
\filecontentsexec\filecontentsheremacro
-The optional argument stands for a suitable |\ref|, see \autoref{sec:labeling}.
+The optional argument stands for a suitable |\ref|, see \autoref{sec:labeling}.
Here is what
\begin{verbatim}
\MyQuasiStandardTOC[\ref{toc:part:styling}]{11}% treat especially section 11
@@ -6292,7 +6413,7 @@ Due to, among other things, the fact that alignment cells create and close
groups, and that by default definitions of \csb{etocname}, \csb{etocnumber},
\csb{etocpage} made by \etoc are local, it was not easy to typeset a TOC as
table with \etoc, prior to release to the addition of \csb{etocglobaldefs} at
-\etocrelease{1.08}.
+\etocrelease{1.08}.
Not only \csb{etocname} etc... caused a problem, but also the basic
redefinition of \csa{contentsline} was made by \etoc only after the
@@ -6343,14 +6464,14 @@ Note: rather than |\toks| registers it would be easier here to use \eTeX{}
\toks2 \expandafter{\etocthelinkedname}%
\toks4 \expandafter{\etocthelinkedpage}%
\edef\toctablepiece {\noexpand\hline
- \noexpand\strut\the\toks0 &\noexpand\bfseries\the\toks2
- &\the\toks4 \noexpand\\\noexpand\hline}%
+ \noexpand\strut\the\toks0 &\noexpand\bfseries\the\toks2
+ &\the\toks4 \noexpand\\\noexpand\hline}%
}
\newcommand*\PrepareSection{%
\toks0 \expandafter{\etocthelinkednumber}%
\toks2 \expandafter{\etocthelinkedname}%
\toks4 \expandafter{\etocthelinkedpage}%
- \edef\toctablepiece {\the\toks0 &\the\toks2 &\the\toks4 \noexpand\\}%
+ \edef\toctablepiece {\the\toks0 &\the\toks2 &\the\toks4 \noexpand\\}%
}
%
\newcommand*{\PrepareSubsection}{%
@@ -6415,13 +6536,13 @@ Also a |\else| immediately following \csa{tableofcontents} or
\etoc can not really cohabit with packages modifying the \csa{tableofcontents}
command: some sort of truce can be achieved if \etoc is loaded last, hence is
- the winner.
+ the winner.
\begin{framed}
Do not modify the |\tableofcontents| command like this:
\centeredline{|\let\oldtableofcontents\tableofcontents|}
\centeredline{|\renewcommand\tableofcontents{\oldtableofcontents foo}|}
- as this will make the |\label/\ref| mechanism impossible.
+ as this will make the |\label/\ref| mechanism impossible.
Rather, redefine \csb{etocaftertochook}
\centeredline{|\renewcommand\etocaftertochook{foo}|} and there
@@ -6562,7 +6683,7 @@ from its |\localtableofcontents|, from its |\label+\ref| mechanism. One
may use |\etocsetstyle| to define via \etoc the layout for one TOC and
then use rather \ctanpkg{tocloft} for another one, if |\tableofcontents| follows
\csb{etocstandardlines} and \csb{etocclasstocstyle}. In this
-compatibility mode |\etocsetlevel{division unit}{6}| will render
+compatibility mode \csb{etocsetlevel}\marg{division unit}|{|\csb{etocthemaxlevel}|}| will render
invisible the chosen division level, but exchanging levels is otherwise
not possible.
@@ -6603,7 +6724,7 @@ It is possible to use simultaneously \etoc and
\etocrelease{1.08} of \etoc requires at least version |1.4a| of \ctanpkg{tableof}. If
\csb{etocglobaldefs} is put in the preamble, this must be after the loading of
package \ctanpkg{tableof}. {\color{niceone}\ctanpkg{tableof}} command \csa{nexttocwithtags}
-should work as expected.
+should work as expected.
\ctanpkg{tableof} commands \csa{tableof}, \csa{tablenotof}, ... will
typeset the (a priori global) table of contents according to the document
@@ -6724,7 +6845,7 @@ contents will be displayed only on the second compilation.
% Que c'est pénible cette syntaxe \markboth/\markright de LaTeX !
% Pourquoi est-ce que \markright n'a pas été définie comme #1#2-> truc avec #2 ??
\makeatletter
-\if@twoside
+\if@twoside
\renewcommand *{\sectionmark }[1]{%
\markboth
{\unexpanded{\ifodd\value{page}(\hyperref[imp]{implementation},
@@ -6783,9 +6904,9 @@ version is \texttt{\etocpkgversion}, of \texttt{\etocpkgdate}.
% fait par \jfverbaspace (n'ayant pas commenté mon code, j'ai dû réfléchir pour
% me rappeler à peu près ce que c'était censé faire).
-\def\jfverbatim{\@beginparpenalty \predisplaypenalty
- \parindent \z@
- \parfillskip \@flushglue
+\def\jfverbatim{\@beginparpenalty \predisplaypenalty
+ \parindent \z@
+ \parfillskip \@flushglue
\parskip \tw@\p@ plus 1fil\relax
\let \do \@makeother
\dospecials
@@ -6797,7 +6918,7 @@ version is \texttt{\etocpkgversion}, of \texttt{\etocpkgdate}.
\begingroup\lccode`~`^
\lowercase{\endgroup\def~{\nopagebreak}}% ajouté 2014/04/28, oblige à un peu
% plus de mark-up cependant
- \catcode`\~\z@
+ \catcode`\~\z@
\footnotesize\normalfont\baselineskip10pt\relax
% \def\v{\vskip\baselineskip v}% ajouté 2015/05/09; faudra trouver mieux.
% 2022/08/30, I remove all "v"'s from version numbers.
@@ -6818,13 +6939,13 @@ version is \texttt{\etocpkgversion}, of \texttt{\etocpkgdate}.
\jf@xverbatim
}
-\begingroup
-\catcode `|=0 \catcode `[= 1 \catcode`]=2
-\catcode `\{=12 \catcode `\}=12 \catcode`\\=12
+\begingroup
+\catcode `|=0 \catcode `[= 1 \catcode`]=2
+\catcode `\{=12 \catcode `\}=12 \catcode`\\=12
|long|gdef|jf@xverbatim#1\end{jfverbatim}[#1|end[jfverbatim]]
|endgroup
-\def\endjfverbatim{}
+\def\endjfverbatim{}
\newdimen\jfverbadim
\makeatother
@@ -6843,10 +6964,60 @@ version is \texttt{\etocpkgversion}, of \texttt{\etocpkgdate}.
\makeatother
\vskip-\baselineskip
\begin{jfverbatim}
+~1.2a [2023/05/01]^
+
+ The requirements (added respectively at 1.1a and 1.2) of a LaTeX
+ kernel at least as recent as 2020-10-01 and of availability of
+ \expanded engine primitive have been lifted. Due to lack of time
+ and ressources, etoc is not retro-tested on old LaTeX installations,
+ though.
+
+ Boolean option `deeplevels' extends the maximal allowed numerical
+ level from 6 to 12. Adapted from a patch courtesy of Matthew
+ Trescott. See
+
+ https://github.com/doxygen/doxygen/pull/9936
+
+ for context.
+
+ Using this option does not change anything to tocdepth and
+ secnumdepth LaTeX counters, nor does it do any of the needed extras
+ to let a sectioning level be known to LaTeX (if etoc is used in
+ "compatibility mode", the suitable \l@<levelname> macros must have
+ been declared to LaTeX for TOC rendering). Whether or not using
+ etoc in compatibility mode (i.e. whether or not using
+ \etocsetstyle{<levelname>}{...}{...}{...}{...}), recall that all new
+ levels must be declared to etoc at least once via
+ \etocsetlevel{<levelname>}{<number>}.
+
+ The macro \etocthemaxlevel expands accordingly to either 6 (default)
+ or 12 (if option `deeplevels'). So
+ \etocsetlevel{foo}{\etocthemaxlevel} should now be used in place of
+ \etocsetlevel{foo}{6} when one wants to make foo entries invisible
+ in a document context which may have used, or not, the `deeplevels'
+ option.
+
+ The auto-selection-of-heading-by-local-tocs from 1.2 uses a macro
+ \etocdivisionnameatlevel which will need most probably user
+ adaptation with `deeplevels', as etoc can not know what are the
+ standard names chosen by user, and how many deep levels were
+ actually added. So it opted to the choices done by the Doxygen
+ project. Check the etoc source code for this macro and redefine it
+ appropriately. Note though that this only matters if your documents
+ has local TOCs located under division units at least as deep as
+ subsubsection.
+
+ Fix a 1.2 bug: using `six' as first argument of `\etocsetlevel'
+ caused an internal control sequence to be redefined, with various
+ strange potential aftereffects.
+
~1.2 [2023/03/01]^
\locallistoffigures and \locallistoftables.
+ MAKE SURE TO READ THE FRAMED TEXT IN THE DOCUMENTATION AT START OF
+ SECTION 2 WHICH DESCRIBES THESE NEW COMMANDS.
+
It is for time being required to pass options `lof', resp. `lot'
at package loading time to activate these features. Whether or
not these features are enabled, etoc interferes in absolutely no
@@ -6860,7 +7031,7 @@ version is \texttt{\etocpkgversion}, of \texttt{\etocpkgdate}.
has been added to the `.toc' file due to `localtoctotoc` will show
deeper ones and the local `lists of' from their own level, but not
themselves.
-
+
Compatibility layer with `tocbibind'. Thanks to Denis Bitouzé for
feature request many years ago. Sorry for the delay!
@@ -6900,7 +7071,7 @@ version is \texttt{\etocpkgversion}, of \texttt{\etocpkgdate}.
which raised a deprecation warning since 1.1a now use an
error message.
- \expanded primitive is required.
+ \expanded primitive is required. [reverted at 1.2a]
~1.1d (not released, part of 1.2)^
@@ -6971,9 +7142,9 @@ version is \texttt{\etocpkgversion}, of \texttt{\etocpkgdate}.
commands. They are not needed as \l@section et al. are with this
release left unmodified during the table of contents typesetting.
- ~LaTeX kernel from 2020/10/01 or later is required (to allow
+ ~LaTeX kernel from 2020-10-01 or later is required (to allow
assuming the \contentsline entries in the TOC file always have
- four arguments).
+ four arguments). [reverted at 1.2a]
~1.09i [2022/11/21]^
@@ -7039,7 +7210,7 @@ version is \texttt{\etocpkgversion}, of \texttt{\etocpkgdate}.
~1.09d [2021/07/13]^
- Some minor synching with tableof 1.4c.
+ Some minor synching with tableof 1.4c.
Add \etockeeporiginaltableofcontents to provide a work-around to a
compatibility issue with listings's \lstlistoflistings, which abuses
@@ -7204,7 +7375,7 @@ version is \texttt{\etocpkgversion}, of \texttt{\etocpkgdate}.
they have empty contents. This is mainly for class authors who
might want to have their \section or \chapter automatically do
a \localtableofcontents. Could prove also useful for batch
- conversions of documents. Thanks to Paul Gaborit who asked for
+ conversions of documents. Thanks to Paul Gaborit who asked for
such a feature.
The command \etocnotocifnotoc extends this behaviour to global
@@ -7234,14 +7405,14 @@ version is \texttt{\etocpkgversion}, of \texttt{\etocpkgdate}.
~1.08c [2015/03/30]^
- removed a few unneeded \long from the code.
-
+
- removed use of \arabic at one location of the code, as it may get
redefined by some language modules for babel or polyglossia.
~1.08b [2015/03/18]^
- Bug fixes:
+ Bug fixes:
- extra space token removed from `\localtableofcontents` (showed
only for inline TOCs.)
@@ -7267,14 +7438,14 @@ version is \texttt{\etocpkgversion}, of \texttt{\etocpkgdate}.
The documentation has a brand new title page and a new section
The TOC as a TikZ mind map both illustrating further uses of
- etoc to display tables of contents as trees in an automatic
+ etoc to display tables of contents as trees in an automatic
manner.
~1.08 [2015/03/10]^
\etocskipfirstprefix may now appear anywhere in the <start>
- part of a level style.
+ part of a level style.
New commands \etociffirst, \etocxiffirst, \etocxifnumbered,
\etocglobaldefs and \etoclocaldefs.
@@ -7335,7 +7506,7 @@ version is \texttt{\etocpkgversion}, of \texttt{\etocpkgdate}.
had been done before adding the tocloft thing to the source code . . . ).
Also, etoc when detecting tocvsec2 now checks if this is under the memoir
class, as then nothing special needs to be done to rescue \tableofcontents,
- contrarily to the situation with the native tocvsec2.
+ contrarily to the situation with the native tocvsec2.
~1.07k [2014/03/06]^
@@ -7353,14 +7524,14 @@ version is \texttt{\etocpkgversion}, of \texttt{\etocpkgdate}.
~1.07i [2013/10/21]^
- Changes to the \etocmulticolstyle and \etocruledstyle codes
+ Changes to the \etocmulticolstyle and \etocruledstyle codes
to lessen the risk of a page break after the title (in the one-column case).
~1.07h [2013/10/16]^
New commands \etocdepthtag.toc, \etocsettagdepth, \etocobeydepthtags,
- \etocignoredepthtags.
+ \etocignoredepthtags.
~1.07g [2013/10/13]^
@@ -7374,7 +7545,7 @@ version is \texttt{\etocpkgversion}, of \texttt{\etocpkgdate}.
\invisiblelocaltableofcontents.
Switched from tikz-qtree to forest for the first `toc as
- tree' example.
+ tree' example.
Command names are linked to their descriptions, and many
other changes in the documentation.
@@ -7382,8 +7553,8 @@ version is \texttt{\etocpkgversion}, of \texttt{\etocpkgdate}.
Removed printing of temporary message when the local toc
id is not yet stabilized; indeed \localtableofcontents
can have many uses, such as filling up some token list
- register and one may wish to not have anything typeset,
- even in an intermediate run.
+ register and one may wish to not have anything typeset,
+ even in an intermediate run.
All of tex etoc.dtx, etex etoc.dtx, xetex etoc.dtx, latex
etoc.dtx, pdflatex etoc.dtx are now possible, and the
@@ -7401,7 +7572,7 @@ version is \texttt{\etocpkgversion}, of \texttt{\etocpkgdate}.
~1.07e [2013/03/01]^
Improvements in the package own line styles with
- regards to penalties and vertical spaces.
+ regards to penalties and vertical spaces.
Addition to the documentation of an example of
a tree-like table of contents (uses tikz).
@@ -7411,13 +7582,13 @@ version is \texttt{\etocpkgversion}, of \texttt{\etocpkgdate}.
~1.07d [2013/02/24]^
- Minor code improvements and new documentation
+ Minor code improvements and new documentation
section ``Another compatibility mode''.
~1.07b [2013/02/02]^
- Removal of the \xspace from the macros \etocname,
+ Removal of the \xspace from the macros \etocname,
\etocnumber, \etocpage.
Additional examples in the documentation.
@@ -7427,7 +7598,7 @@ version is \texttt{\etocpkgversion}, of \texttt{\etocpkgdate}.
New commands:
- \etocthename, \etocthenumber, \etocthe~-page, \etoclink,
+ \etocthename, \etocthenumber, \etocthe~-page, \etoclink,
\etoctoccontentsline, \etoctoccontentsline~lowast
@@ -7487,7 +7658,7 @@ version is \texttt{\etocpkgversion}, of \texttt{\etocpkgdate}.
% Que c'est pénible cette syntaxe \markboth/\markright de LaTeX !
% Pourquoi est-ce que \markright n'a pas été définie comme #1#2-> truc avec #2 ??
\makeatletter
-\if@twoside
+\if@twoside
\renewcommand *{\sectionmark }[1]{%
\markboth
{\unexpanded{{%
@@ -7622,7 +7793,7 @@ version is \texttt{\etocpkgversion}, of \texttt{\etocpkgdate}.
%%% not needed for etoc.dtx
%%%%%%% attention j'utilise plus bas \MakePrivateLetters pour
%%%%%%% problème de straight quotes depuis 2023/01/18 (1.1c)
-%%% \def\xintMakePrivateLetters{\catcode`: 11 \catcode`? 11 \catcode`@ 11
+%%% \def\xintMakePrivateLetters{\catcode`: 11 \catcode`? 11 \catcode`@ 11
%%% \catcode`^ 11 \catcode`_ 11 }
%%% \def\xintexprMakePrivateLetters{\xintMakePrivateLetters \catcode`! 11 }
%%% \let\MakePrivateLetters\xintMakePrivateLetters
@@ -7751,7 +7922,7 @@ version is \texttt{\etocpkgversion}, of \texttt{\etocpkgdate}.
\fi
% \ifnot@excluded
% \edef\@tempa{\noexpand\SpecialIndex{\bslash\macro@namepart}}%
- % \@tempa
+ % \@tempa
% \fi
\macro@spacepart
}%
@@ -7796,7 +7967,7 @@ version is \texttt{\etocpkgversion}, of \texttt{\etocpkgdate}.
% import de mon code de lgrmath de novembre 2022
% useless with doc.sty as \verb, verbatim and macrocode do not use \@noligs
% \usepackage{upquote}
-%
+%
\begingroup
\catcode`\'\active\catcode`\`\active
\gdef\MakePrivateLetters{\makeatletter\def`{\textasciigrave}\def'{\textquotesingle}}
@@ -7951,7 +8122,7 @@ of real structure in a \LaTeX{} document body).
% par un effet particulier si avant macrocode un enumerate, inefficient,
% mais vraiment pas envie d'investiguer.
%
-% l'esthétique est un peu douteuse mais je laisse ?
+% l'esthétique est un peu douteuse mais je laisse ?
% non finalement je supprime
@@ -7960,7 +8131,7 @@ of real structure in a \LaTeX{} document body).
% \ifpm@module \endgroup \pm@modulefalse \fi
% \everypar{}%
% \global\@inlabelfalse
-% \endtrivlist\@endpefalse % <<-- ajouté
+% \endtrivlist\@endpefalse % <<-- ajouté
% \close@crossref}
% \makeatother
@@ -7988,14 +8159,46 @@ of real structure in a \LaTeX{} document body).
%
%</none>
%<*package>
-% \etocrelease{1.1a} implements a radical change to legacy core internals for compatibility
-% with some (future) \ctanpkg{hyperref} changes. In order to facilitate this
-% overhaul, we require \LaTeX{} 2020/10/01 for the fourth argument to
-% \cs{contentsline} lines in the |.toc| file to be always present.
-% \begin{macrocode}
-\NeedsTeXFormat{LaTeX2e}[2020/10/01]
-\ProvidesPackage{etoc}
-[2023/03/01 v1.2 Completely customisable TOCs (JFB)]
+% \etocrelease{1.1a} implements a radical change to legacy core internals for
+% compatibility with some (future) \ctanpkg{hyperref} changes. In order to
+% facilitate this overhaul, it required \LaTeX{} 2020-10-01 for the fourth
+% argument to \cs{contentsline} lines in the |.toc| file to be always present.
+%
+% At \etocrelease{1.2a}, this requirement has been lifted so that we
+% re-incorporated compatibility with old \cs{contentsline} fetching 4 or only
+% 3 arguments depending on presence or not of \ctanpkg{hyperref}. Fortunately
+% the code refactoring completed at \etocrelease{1.2} made this easier.
+% Testing on ``old'' \LaTeX{} was limited to one single check on a TL2019
+% install.
+%
+% Also \etocrelease{1.2} use \csa{expanded}, we now test for its existence and
+% provide alternative code if it is not provided by the engine.
+%
+% TeXLive started producing \LaTeX{} format incorporating by default the
+% \eTeX{} extensions I think twenty years ago with TL2003, so let's require at
+% least the \LaTeX{} of December of 2003 (but its is no guarantee that it will
+% actually be with engine providing \csa{ifdefined}, \csa{unless},
+% \csa{numexpr} or \csa{unexpanded} or maybe others yet that we use).
+% \begin{macrocode}
+\NeedsTeXFormat{LaTeX2e}[2003/12/01]
+\ProvidesPackage{etoc}[2023/05/01 v1.2a Completely customisable TOCs (JFB)]
+% \end{macrocode}
+% Gentle Info message in the log to mention no testing is done of current
+% \etoc on old \LaTeX{} installations.
+% \begin{macrocode}
+\newif\ifEtoc@oldLaTeX
+\@ifl@t@r\fmtversion{2020/10/01}
+ {}
+ {\Etoc@oldLaTeXtrue
+ \PackageInfo{etoc}{Old LaTeX (\fmtversion) detected!\MessageBreak
+ Since 1.1a (2023/01/14), etoc prefers LaTeX at least\MessageBreak
+ as recent as 2020-10-01, for reasons of the .toc file,\MessageBreak
+ and used to require it (from 1.1a to 1.2).\MessageBreak
+ This etoc (1.2a) does not *require* it, but has not been\MessageBreak
+ tested thoroughly on old LaTeX (especially if document\MessageBreak
+ does not use hyperref) and retrofitting was done only\MessageBreak
+ on basis of author partial remembrances of old context.\MessageBreak
+ Reported}}
% \end{macrocode}
% \etocrelease{1.2} adds experimental support (only tested with standard
% classes and few packages) for \csbc{locallistoffigures} and
@@ -8011,7 +8214,7 @@ of real structure in a \LaTeX{} document body).
% Now that \etoc uses package options, I will use \ctanpkg{kvoptions} as I am
% familiar with it. I understand upstream \LaTeX{} now has support for
% key-value input, put I simply have had no time to read the interface.
-% Besides not sure it was there for the |2020/10/01| required release.
+% Besides not sure it was there for the |2020-10-01| required release.
% \begin{macrocode}
\RequirePackage{kvoptions}
\SetupKeyvalOptions{prefix=Etoc@}
@@ -8040,10 +8243,61 @@ of real structure in a \LaTeX{} document body).
\DeclareBoolOption[false]{locallottotoc}
}
\DeclareBoolOption[true]{ouroboros}
+% \end{macrocode}
+% The \etocoption{deeplevels} option added at \etocrelease{1.2a}. Adapted
+% from an intial patch contributed by Matthew Trescott in the context of
+% the \href{https://github.com/doxygen/doxygen}{Doxygen} project.
+% It sets the maximum level usable with \csbc{etocsetlevel} (and never
+% displayed) at |12| rather than |6|.
+%
+% Such an extension of the number of levels handled by \etoc would have been
+% much more cumbersome to achieve prior to the \etocrelease{1.2} refactoring
+% which replaced usage of a booleans by a stack storage of the succession of
+% levels seen in the |.toc| file (from which \etoc creates virtual nesting
+% structure), which actually is completely scalable and can handle unlimited
+% number of levels. Basically we only needed to replace the formerly used
+% \csa{Etoc@@six@@} by a \csbc{Etoc@maxlevel} set to have value |12| but this
+% simple change caused also many modification to messages involved in
+% \etoc-user interactions, and a disproportionate quantity of time passed on
+% updating the documentation, even though in a minimal way, and of course a
+% minimal amount of testing but \etoc is lacking a strong regression test
+% suite which for lack of time has not yet been put into place. As it is so
+% simple we could do some option |maxlevel=<number>| but well, there is no
+% real need, because the extra potential levels do not cause any overhead to
+% the actual \etoc handling of tables of contents, so it is even tempting to
+% adopt |12| (which is way beyond any realistic needs of a real document) as
+% default, but this would break the documents in the wild which have used the
+% advanced techniques based on hiding one or more levels via setting it at
+% numerical depth |6|.
+% \begin{macrocode}
+\DeclareBoolOption[false]{deeplevels}
\DeclareDefaultOption{\PackageWarning{etoc}{Option `\CurrentOption' is unknown.}}
\ProcessKeyvalOptions*
\DisableKeyvalOption[action=error,package=etoc]{etoc}{lof}
\DisableKeyvalOption[action=error,package=etoc]{etoc}{lot}
+\DisableKeyvalOption[action=error,package=etoc]{etoc}{deeplevels}
+% \end{macrocode}
+% The real verbosity problem of \LaTeX{} is not so much the log, which should
+% actually be as detailed as possible (and the default \csa{errorcontexlines}
+% setting of \LaTeX{} is to my view misguided), but the humongous output to
+% console, most of it being perfectly useless in 99\% of cases. Despite
+% \csa{PackageInfo} adding stuff to the log only, I finally decided not to use
+% this next hunk.
+% \begin{macrocode}
+% \PackageInfo{etoc}{Status of options at loading time:\MessageBreak
+% lof = \ifEtoc@lof true\else false\fi\MessageBreak
+% lot = \ifEtoc@lot true\else false\fi\MessageBreak
+% maintototoc = \ifEtoc@maintoctotoc true\else false\fi\MessageBreak
+% localtoctotoc = \ifEtoc@localtoctotoc true\else false\fi\MessageBreak
+% localloftotoc = \ifEtoc@localloftotoc true\else false\fi\MessageBreak
+% locallottotoc = \ifEtoc@locallottotoc true\else false\fi\MessageBreak
+% ouroboros = \ifEtoc@ouroboros true\else false\fi\MessageBreak
+% deeplevels = \ifEtoc@deeplevels true\else false\fi\@gobble
+% }
+% \end{macrocode}
+% For many many years \etoc had no options. Let's be modern and provide an
+% \csbc{etocsetup}.
+% \begin{macrocode}
\def\etocsetup#1{\setkeys{etoc}{#1}}
\def\etocifmaintoctotoc{\ifEtoc@maintoctotoc
\expandafter\@firstoftwo
@@ -8074,9 +8328,10 @@ of real structure in a \LaTeX{} document body).
\let\etocnopar\etocinline
\def\etocdisplay{\def\Etoc@par{\par}}
% \end{macrocode}
-% \csbc{etocglobaldefs} should be used only for special things such as TOC as a
-% table; it should be put in a group to limit its scope. If used in the
-% preamble, it must come \emph{after} \ctanpkg{tableof} if the latter is loaded too.
+% \csbc{etocglobaldefs} should be used only for special things such as TOC as
+% a table; it should be put in a group to limit its scope. If used in the
+% preamble, it must come \emph{after} \ctanpkg{tableof} if the latter is
+% loaded too.
% \begin{macrocode}
\let\Etoc@global\@empty
\def\etocglobaldefs{\let\Etoc@global\global\let\tof@global\global}
@@ -8135,7 +8390,7 @@ of real structure in a \LaTeX{} document body).
}
% \end{macrocode}
% Formerly a \LaTeX{} counter |etoc@tocdepth| was declared here but at
-% \etocrelease{1.2} it has been replaced by macro storage.
+% \etocrelease{1.2} it has been replaced by macro storage.\par
% \begin{macrocode}
\expandafter\def\csname Etoc@-3@@\endcsname {-\thr@@}
\expandafter\def\csname Etoc@-2@@\endcsname {-\tw@}
@@ -8147,10 +8402,41 @@ of real structure in a \LaTeX{} document body).
\expandafter\chardef\csname Etoc@4@@\endcsname 4
\expandafter\chardef\csname Etoc@5@@\endcsname 5
\expandafter\chardef\csname Etoc@6@@\endcsname 6
-\expandafter\let\expandafter\Etoc@@six@@\csname Etoc@6@@\endcsname
+% \end{macrocode}
+% \etocoption{deeplevels} option needs a few extra declarations.
+% \begin{macrocode}
+\ifEtoc@deeplevels
+ \expandafter\chardef\csname Etoc@7@@\endcsname 7
+ \expandafter\chardef\csname Etoc@8@@\endcsname 8
+ \expandafter\chardef\csname Etoc@9@@\endcsname 9
+ \expandafter\chardef\csname Etoc@10@@\endcsname 10
+ \expandafter\chardef\csname Etoc@11@@\endcsname 11
+ \expandafter\chardef\csname Etoc@12@@\endcsname 12
+\fi
+% \end{macrocode}
+% \etocrelease{1.2a} adds \csbc{Etoc@maxlevel} which replaces formerly
+% used \csa{Etoc@@six@@}. It adds also \csbc{etocthemaxlevel} as
+% user interface to its explicit numerical value.
+% \begin{macrocode}
+\expandafter\let\expandafter\Etoc@maxlevel
+ \csname Etoc@\ifEtoc@deeplevels12\else6\fi @@\endcsname
+\edef\etocthemaxlevel{\number\Etoc@maxlevel}
+% \end{macrocode}
+% For \csbc{etocsetlevel}, \etocrelease{1.2a} uses a comparison with
+% \csbc{Etoc@minf} so that only levels suitable for the document class can be
+% used. So \etoc now will not define unneeded `book' levelname with numerical
+% level |-2| except if with \ctanpkg{memoir}.
+% \begin{macrocode}
\@ifclassloaded{memoir}{\def\Etoc@minf{-\thr@@}}{\def\Etoc@minf{-\tw@}}
\let\Etoc@none@@ \Etoc@minf
-\expandafter\let\expandafter\Etoc@all@@ \csname Etoc@5@@\endcsname
+\expandafter\let\expandafter\Etoc@all@@
+ \csname Etoc@\ifEtoc@deeplevels11\else5\fi @@\endcsname
+% \end{macrocode}
+% \csa{Etoc@dolevels} will hold the names of all declared levels
+% (independently of their numerical levels), in a traditional
+% \LaTeX{} |\do| separated manner, except that for some reason
+% I used \csa{Etoc@do}. TODO: maybe use |\do|.
+% \begin{macrocode}
\let\Etoc@dolevels\@empty
\def\Etoc@newlevel #1{\expandafter\def\expandafter\Etoc@dolevels\expandafter
{\Etoc@dolevels\Etoc@do{#1}}}
@@ -8161,10 +8447,26 @@ of real structure in a \LaTeX{} document body).
% or even tokens for |-\tw@|), the other in a textual representation such as
% |minusone|. The latter do not get defined anymore.
%
-% MEMO: the name space here is poor and I should definitely have used
-% something such as \csa{Etoc@level@section}, not \csa{Etoc@section@@}.
-%
-% So \etocrelease{1.2} adds here \csbc{etocifunknownlevelTF} and
+% MEMO: the legacy name space here is rather poor as anything can happen after
+% \csa{Etoc@} with the sole and only characteristic that it terminates with
+% |@@|. So this means no package control sequence is allowed to end in |@@|
+% else it is in risk of being overwritten, were it not for the special
+% filtering done by \csbc{etocsetlevel}. For matters of
+% \csbc{etocsetnexttocdepth} allowing both name and numerical arguments, we
+% employed the cheap device to define ourselves special levels named by
+% explicit integers for internal usage, hence we need to filter them out here
+% from being redefined. We also filter out names starting with |@| for other
+% reasons, but still it was not true at \etocrelease{1.2} that the package
+% could safely use |\Etoc@@...@@| macros, as \csbc{etocsetlevel} creates since
+% then also a |\Etoc@@|\meta{name}|@@|. There was in particular a chardef
+% \csa{Etoc@@six@@} hence if user chose ``|six|'' as level name
+% \csa{Etoc@@six@@} acquired a new meaning and this could cause strange
+% symptoms, the main one being the disappearance from TOCs of levels at same
+% numerical depth than the one now given by the modified
+% \csa{Etoc@@six@@}. (There was no \csa{Etoc@six@@} so the bug was really only
+% one of \etocrelease{1.2} not of earlier releases).
+%
+% \etocrelease{1.2} adds here \csbc{etocifunknownlevelTF} and
% \csbc{etoclevel} for a higher level interface, which may be used by third
% parties such as the \ctanpkg{yathesis} class and will allow \etoc at some
% point to modify its internal naming conventions.
@@ -8175,14 +8477,27 @@ of real structure in a \LaTeX{} document body).
% \csa{ifnum} tests. I hesitated using only explicit digit tokens by the way.
%
% The dummy sectioning levels ``all'' and ``none'' play a special role and
-% will be declared by \csbc{etocifunknownlevelTF} as ``known''. They should
-% not be used as first argument of \csbc{etocsetlevel}...\par^^A TO FIX WHITELINE
+% will be declared by \csbc{etocifunknownlevelTF} as ``known''.
+%
+% TODO: is it worthwile to still allow `7' to `12` as level ``names''? This is
+% done here for perfact backward compatibility but they have to be excluded
+% under \etocoption{deeplevels} option, and it would be better to do something
+% not depending on whether that option is used or not.
% \begin{macrocode}
-\def\etocsetlevel#1#2{\expanded{\noexpand\etoc@setlevel{#1}{#2}}}%
+\ifdefined\expanded
+ \def\etocsetlevel#1#2{\expanded{\noexpand\etoc@setlevel{#1}{#2}}}%
+\else
+ \def\etocsetlevel#1#2{{\edef\Etoc@tmp{\noexpand\etoc@setlevel{#1}{#2}}\expandafter}\Etoc@tmp}%
+\fi
\def\etoc@setlevel#1#2{%
\edef\Etoc@tmp{\the\numexpr#2}%
- \if1\ifnum\Etoc@tmp>\Etoc@@six@@0\fi\ifnum\Etoc@tmp<-\tw@0\fi1%
- \in@{.#1,}{.none,.all,.figure,.table,.-3,.-2,.-1,.0,.1,.2,.3,.4,.5,.6,}%
+ \if1\ifnum\Etoc@tmp>\Etoc@maxlevel0\fi\unless\ifnum\Etoc@minf<\Etoc@tmp;\fi1%
+ \ifEtoc@deeplevels
+ \in@{.#1,}{.none,.all,.figure,.table,.-3,.-2,.-1,.0,.1,.2,.3,.4,.5,.6,%
+ .7,.8,.9,.10,.11,.12,}%
+ \else
+ \in@{.#1,}{.none,.all,.figure,.table,.-3,.-2,.-1,.0,.1,.2,.3,.4,.5,.6,}%
+ \fi
% \end{macrocode}
% Letter or other agnostic test. First time I ever use \csa{@car} as I never
% paid attention to its existence and in more macro-coding intensive context
@@ -8193,49 +8508,58 @@ of real structure in a \LaTeX{} document body).
\PackageWarning{etoc}
{Sorry, but `#1' is forbidden as level name.\MessageBreak
\if\@car#1\@nil @%
- (because of the @, especially as first character)\MessageBreak\fi
+ (because of the @ as first character)\MessageBreak\fi
Reported}%
\else
\etocifunknownlevelTF{#1}{\Etoc@newlevel{#1}}{}%
\expandafter\let\csname Etoc@#1@@\expandafter\endcsname
\csname Etoc@\Etoc@tmp @@\endcsname
% \end{macrocode}
-% This is a mechanism to allow ``to toc'' entries to not break the core
-% mechanism for local tables of contents (now also lists of) to correctly
-% know their scope, when for example we have in a row
+% This is to allow ``to toc'' entries to not break the core mechanism
+% used to let local tables of contents (now also lists of)
+% know their scope, in case for example we have one after the other
% \csbc{localtableofcontents}, \csbc{locallistoffigures},
% \csbc{locallistoftables} and each has created its ``to toc'' entry:
% main TOC will handle the |@<division>| as aliases to |<division>| and local
-% TOCs and Lists Of will ignoer them.
+% TOCs and Lists Of will ignore them.
+%
+% So we create |@<levelname>| as aliases to |<levelname>|. This is really
+% needed only for the level names actually involved by ``to toc'' thing, but
+% let's do it systematically to avoid implementation complications.
% \begin{macrocode}
\expandafter\edef\csname Etoc@@#1@@\endcsname
{\expandafter\noexpand\csname Etoc@#1@@\endcsname}%
% \end{macrocode}
% As ``to toc'' will use some \csa{addcontentsline}, we must make
-% \ctanpkg{hyperref} happy.
+% \ctanpkg{hyperref} happy and also define the suitable |toclevel@| prefixed
+% extra macros.
% \begin{macrocode}
\expandafter\edef\csname toclevel@@#1\endcsname
{\expandafter\noexpand\csname toclevel@#1\endcsname}%
% \end{macrocode}
-% But we don't let \csa{toclevel\string#1} to \csa{Etoc@tmp}, with some
-% hesitation. The level defined by \csbc{etocsetlevel} should only be
-% for interpretation for the contents of the |.toc| file. If for some reason
-% user wants to set all levels to six (i.e. not taken into account) except for
-% some special ones, then modifying \csa{toclevel\string#1} could prevent the
-% local TOC title to find a place in the bookmarks.
+% But we don't set \ctanpkg{hyperref}'s \csa{toclevel@\string#1} to be
+% numerically \csa{Etoc@tmp}, with some hesitation. The level defined by
+% \csbc{etocsetlevel} should only be for interpretation by \etoc for the
+% contents of the |.toc| file. If it also influences how \ctanpkg{hyperref}
+% hooks into \csa{section} and like commands influence the PDF bookmarks,
+% unexpected results could follow. It is up to user to set-up by themself
+% possibly needed extra \ctanpkg{hyperref} configuration in this regard.
% \begin{macrocode}
\fi
\else
\PackageWarning{etoc}
{Argument `\detokenize{#2}' of \string\etocsetlevel\space should
- represent\MessageBreak
- -2, -1, 0, 1, 2, 3, 4, 5, or 6 but evaluates to \Etoc@tmp.\MessageBreak
- The level of `#1' will be set to 6.\MessageBreak
+ represent one of\MessageBreak
+ \ifnum\Etoc@minf=-\thr@@-2, \fi-1, 0, 1, 2, \ifEtoc@deeplevels ...\else3, 4\fi,
+ \the\numexpr\Etoc@maxlevel-1, or \number\Etoc@maxlevel\space
+ but evaluates to \Etoc@tmp.\MessageBreak
+ The level of `#1' will be set to \number\Etoc@maxlevel.\MessageBreak
Tables of contents will ignore `#1' as long\MessageBreak
- as its level is 6.\MessageBreak
+ as its level is \number\Etoc@maxlevel\space (=\string\etocthemaxlevel).%
+ \MessageBreak
Reported}%
\etocifunknownlevelTF{#1}{\Etoc@newlevel{#1}}{}%
- \expandafter\let\csname Etoc@#1@@\endcsname\Etoc@@six@@
+ \expandafter\let\csname Etoc@#1@@\endcsname\Etoc@maxlevel
\fi
}
% \end{macrocode}
@@ -8244,10 +8568,15 @@ of real structure in a \LaTeX{} document body).
%
% I may also need for internal usage a variant for only numerical |#1| which be
% submitted to a \csa{the}\csa{numexpr}. Not so far.
+%
+% Unfortunately the name ``level'' here does not convey to user the fact that
+% the argument of \csbc{etocifunknownlevelTF} is a ``name'' not a numerical
+% thing.
% \begin{macrocode}
\def\etoclevel#1{\csname Etoc@#1@@\endcsname}
+\def\etocthelevel#1{\number\csname Etoc@#1@@\endcsname}
\def\etocifunknownlevelTF#1{\@ifundefined{Etoc@#1@@}}
-\etocsetlevel{book}{-2}
+\@ifclassloaded{memoir}{\etocsetlevel{book}{-2}}{}
\etocsetlevel{part}{-1}
\etocsetlevel{chapter}{0}
\etocsetlevel{section}{1}
@@ -8265,14 +8594,22 @@ of real structure in a \LaTeX{} document body).
\else
\etocsetlevel{appendix}{1}
\fi
+% \end{macrocode}
+% The ``to toc'' mechanism will add to the |.toc| file \csa{contentsline} entries
+% with first argument such as |@section| or |@subsection|. They will
+% generally behave as |section|, resp. |subsection|, etc\dots\ This special
+% mark-up is needed for ``to toc'' inclusions to not break the \etoc mechanism
+% for delimiting the scope of local tables of contents.
+% \begin{macrocode}
\def\Etoc@do#1{\@namedef{l@@#1}{\csname l@#1\endcsname}}
\Etoc@dolevels
% \end{macrocode}
-% We do not do a formal \csbc{etocsetlevel}|{figure}{6}| and anyhow the user
-% level interface forbids |figure| and |table| as first argument.
+% We do not issue \csbc{etocsetlevel}|{figure}{6}| (or |{12}|) as anyhow the
+% \csbc{etocsetlevel} interface forbids |figure| and |table| as first
+% argument.
% \begin{macrocode}
-\let\Etoc@figure@@\Etoc@@six@@
-\let\Etoc@table@@\Etoc@@six@@
+\let\Etoc@figure@@\Etoc@maxlevel
+\let\Etoc@table@@ \Etoc@maxlevel
% \end{macrocode}
% \etocrelease{1.09g} adapts to \ctanpkg{hyperref} depending on whether the
% latter is at |7.00u| or earlier. Indeed internal changes to
@@ -8282,10 +8619,35 @@ of real structure in a \LaTeX{} document body).
% \etocrelease{1.1a} radically simplifies matters at \etoc core, and if these
% changes had been in place earlier there would have been no incompatibility
% with the \ctanpkg{hyperref} |7.00u| release.
+%
+% At \etocrelease{1.2a} we drop the \etocrelease{1.1a} requirement of \LaTeX
+% from |2020-10-01| and must cater for \csa{contentsline} with 3 or 4
+% arguments. Fortunately, the code refactorings engaged at
+% \etocrelease{1.1a} and completed at \etocrelease{1.2} made such a retro-fit
+% relatively simple. Let's hope nothing was overlooked, though.
+%
+% But we can not assume anymore \csa{@gobblethree} exists... hesitation here
+% whether to use a \csbc{Etoc@gobblethree} or directly name it
+% \csa{@gobblethree}.
% \begin{macrocode}
+\let\Etoc@gobblethreeorfour\@gobblefour
+\ifdefined\@gobblethree
+ \let\Etoc@gobblethree\@gobblethree
+\else
+ \long\def\Etoc@gobblethree#1#2#3{}%
+\fi
\AtBeginDocument{%
\@ifpackageloaded{parskip}{\Etoc@parskiptrue}{}%
-\@ifpackageloaded{hyperref}{\Etoc@hyperreftrue}{}%
+\@ifpackageloaded{hyperref}
+ {\Etoc@hyperreftrue}
+ {\ifEtoc@oldLaTeX
+ \let\Etoc@gobblethreeorfour\Etoc@gobblethree
+ \let\Etoc@etoccontentsline@fourargs\Etoc@etoccontentsline@
+ \long\def\Etoc@etoccontentsline@#1#2#3{%
+ \Etoc@etoccontentsline@fourargs{#1}{#2}{#3}{}%
+ }%
+ \fi
+ }%
}
\def\etocskipfirstprefix {\global\Etoc@skipprefixtrue }
% \end{macrocode}
@@ -8300,16 +8662,18 @@ of real structure in a \LaTeX{} document body).
% the right time (they are rather called ``|begin|'' and ``|end|'' in the code
% though).
%
-% \etocrelease{1.2} did a complete rewrite of how \etoc creates virtually
-% a nesting structure out of the flat succession of the \csa{contentsline}'s
-% for various levels. Ever since the first release this was based on using
+% \etocrelease{1.2} did a complete rewrite of how \etoc creates virtually a
+% nesting structure out of the flat succession of the \csa{contentsline}'s for
+% various levels. Ever since the first release this was based on using
% boolean flags, one for each level. The flag was on if the level had been
% seen, hence its ``begin'' macro executed, but not yet its ``end'' macro.
% This is now replaced by a stack storage \csbc{Etoc@stackofends} which is
% simply, e.g. |{2}{0}{-3}{}|, to mean that first a chapter (|0|) was seen
% then a subsection (|2|). The |{-3}{}| trail is for matters of avoiding
% brace removal in the implementation next (I could have replaced it by a
-% single token being numerically |-3|).
+% single token being numerically |-3|). This structure made implementing the
+% \etocoption{deeplevels} painless (but time-consumingly documented) at
+% \etocrelease{1.2a}.
%
% When a new level is encountered and set in \csbc{Etoc@level}, it is compared
% to the left most entry in the stack. If higher, the ``begin'' macro is
@@ -8339,14 +8703,16 @@ of real structure in a \LaTeX{} document body).
% more careful in the various \csa{ifnum}.
%
% This (always globally defined) \csbc{Etoc@level} must now never be set to
-% the numerical value \texttt{6}: it is legal to add to the |.toc| file dummy
-% sectioning levels associated to the numerical level \texttt{6} (such dummy
-% sectioning will be ignored but can be assigned locally a non-ignored level
-% for special effects) and if \csbc{Etoc@level} was, as prior to
-% \etocrelease{1.2}, systematically set to the numerical level of the
-% last seen \csa{contentsline}, this could cause \csbc{Etoc@@startlocaltoc} to
-% fail to correctly set the ``local top''. Indeed it now only has
-% \csbc{Etoc@level} at his disposal, the legacy boolean flags being gone.
+% the numerical value \texttt{6} (or \texttt{12} if option
+% \etocoption{deeplevels}): it is legal to add to the |.toc| file dummy
+% sectioning levels associated to the maximal numerical level
+% \csbc{etocthemaxlevel} (such dummy sectioning will be ignored but can be
+% assigned locally a non-ignored level for special effects) and if
+% \csbc{Etoc@level} was, as prior to \etocrelease{1.2}, systematically set to
+% the numerical level of the last seen \csa{contentsline}, this could cause
+% \csbc{Etoc@@startlocaltoc} to fail to correctly set the ``local top''.
+% Indeed it now only has \csbc{Etoc@level} at his disposal, the legacy boolean
+% flags being gone.
%
% The \csa{Etoc@isfirsttrue} was formally incorporated as last token of the
% ``begin'' macros as defined by \csbc{etocsetstyle}, but has been displaced
@@ -8365,20 +8731,23 @@ of real structure in a \LaTeX{} document body).
% \csbc{etocxiffirst}.
% \begin{macrocode}
\def\Etoc@traversestackofends#1{%
- \ifnum#1>\Etoc@level\expandafter\@firstoftwo\else\expandafter\@secondoftwo\fi
- {\csname Etoc@end@#1\endcsname
- \Etoc@traversestackofends
- }%
- {\ifnum#1<\Etoc@level
- \csname Etoc@begin@\the\numexpr\Etoc@level\endcsname
- \Etoc@global\Etoc@isfirsttrue
- \edef\Etoc@tmp{{\the\numexpr\Etoc@level}}%
- \else
- \Etoc@global\Etoc@isfirstfalse
- \let\Etoc@tmp\@empty
- \fi
- \expandafter\Etoc@updatestackofends\Etoc@tmp{#1}%
- }%
+ \ifnum#1>\Etoc@level
+ \csname Etoc@end@#1\endcsname
+ \expandafter\Etoc@traversestackofends
+ \else
+ \Etoc@traversestackofends@done{#1}%
+ \fi
+}
+\def\Etoc@traversestackofends@done#1#2{#2%
+ \ifnum#1<\Etoc@level
+ \csname Etoc@begin@\the\numexpr\Etoc@level\endcsname
+ \Etoc@global\Etoc@isfirsttrue
+ \edef\Etoc@tmp{{\the\numexpr\Etoc@level}}%
+ \else
+ \Etoc@global\Etoc@isfirstfalse
+ \let\Etoc@tmp\@empty
+ \fi
+ \expandafter\Etoc@updatestackofends\Etoc@tmp{#1}%
}
% \end{macrocode}
% Ever since the first release of \etoc, the code has to be careful that the
@@ -8389,7 +8758,7 @@ of real structure in a \LaTeX{} document body).
% core internals for compatibility with (attow future) \ctanpkg{hyperref}.
% Formerly \csbc{Etoc@etoccontentsline@} fetched only the first argument. It
% now also fetches all four (the fourth argument of \csa{contentsline} is
-% always present since \LaTeX{} |2020/10/01|). The \csbc{Etoc@lxyz} used to
+% always present since \LaTeX{} |2020-10-01|). The \csbc{Etoc@lxyz} used to
% receive only the two arguments (possibly hacked by \ctanpkg{hyperref}) of
% \csa{l@chapter}, \csa{l@section}, etc..., (these macros had been |\let| to
% \csbc{Etoc@lxyz}), and examined them to see if they were carrying
@@ -8423,23 +8792,27 @@ of real structure in a \LaTeX{} document body).
% \ctanpkg{hyperref}, do not hyperlink the page number argument if it turns out
% empty. This maintains backwards-compatibility with earlier releases of
% \etoc.
+%
+% TODO: should this code ensure |#1| is actually a legit level name and if not
+% issue some nice error message? This would add system-level overhead only for
+% careless people who do not read docs...
% \begin{macrocode}
\def\Etoc@etoccontentsline #1{%
- \let\Etoc@next\@gobblefour
- \ifnum\csname Etoc@#1@@\endcsname=\Etoc@@six@@
+ \let\Etoc@next\Etoc@gobblethreeorfour
+ \ifnum\csname Etoc@#1@@\endcsname=\Etoc@maxlevel
\else
\Etoc@skipthisonefalse
% \end{macrocode}
% MEMO: the mechanism added to make
% added toc entries from ``list of'' titles invisible to the local tocs,
-% will be with |#1| starting with an |@|. In that case \csa{Etoc@\string#1@@}
+% goes via such a |#1| starting with an |@|. In that case \csa{Etoc@\string#1@@}
% is not a \csa{chardef} but expands to one (or to a count or |-\tw@| perhaps,
% or a |\numexpr...\relax|).
% \begin{macrocode}
\global\expandafter\let\expandafter\Etoc@level\csname Etoc@#1@@\endcsname
% \end{macrocode}
% The trick goes through a slight overhead here to filter out such special
-% level names and do not make them update what will serve as top level for
+% ``|@|``-level names and not make them update what will serve as top level for
% local tocs or listsof. Formerly this was managed by booleans, then for
% \etocrelease{1.1d} (released as \etocrelease{1.2}) it got replaced by
% sole usage of \csbc{Etoc@level}, and finally a specific
@@ -8731,8 +9104,8 @@ of real structure in a \LaTeX{} document body).
% actually found, now they are defined in \csbc{Etoc@lxyz} to always provide
% the hyperlinking to the target title in the document.
%
-% \etocrelease{1.1a} and \etocrelease{1.1b} still had here some superfluous code which was trimmed at
-% \etocrelease{1.1c}.
+% \etocrelease{1.1a} and \etocrelease{1.1b} still had here some superfluous
+% code which was trimmed at \etocrelease{1.1c}.
%
% Also, \etocrelease{1.1c} fixes here a brace removal bug (which had always been there I
% guess): if the numbered heading title was braced one level of bracing was
@@ -8952,7 +9325,7 @@ of real structure in a \LaTeX{} document body).
\ifEtoc@ouroboros
\else
\let\Etoc@tmp\contentsline
- \def\contentsline{\let\contentsline\Etoc@tmp\@gobblefour}%
+ \def\contentsline{\let\contentsline\Etoc@tmp\Etoc@gobblethreeorfour}%
\fi
\fi
\fi
@@ -8963,7 +9336,11 @@ of real structure in a \LaTeX{} document body).
\let\etoc@startlocaltoc\@gobble
\let\Etoc@@startlocaltoc@toc\Etoc@@startlocaltoc
\let\Etoc@@startlocaltochook\@empty
-\def\etocdivisionnameatlevel#1{%
+\unless\ifEtoc@deeplevels
+% \end{macrocode}
+% This only hard-codes the built-in \LaTeX\ defaults.
+% \begin{macrocode}
+ \def\etocdivisionnameatlevel#1{%
\ifcase\numexpr#1\relax
\ifdefined\c@chapter chapter\else section\fi%
\or section%
@@ -8978,19 +9355,55 @@ of real structure in a \LaTeX{} document body).
part%
\fi
\fi
-}
+ }
+\else
+% \end{macrocode}
+% The definition given to \csbc{etocdivisionnameatlevel} in the
+% \etocoption{deeplevels} branch is only needed if one wants to locate a
+% local table of contents at a deep place, and one has not made use of
+% \csbc{etocsettocstyle} to configure the heading by oneself. I have
+% used in the default definition the headings as in the
+% \href{https://github.com/doxygen/doxygen/}{Doxygen} \LaTeX{} templates
+% originating in the
+% \href{https://github.com/doxygen/doxygen/pull/9936}{Doxygen\#9936} PR.
+% \begin{macrocode}
+ \def\etocdivisionnameatlevel#1{%
+ \ifcase\numexpr#1\relax
+ \ifdefined\c@chapter chapter\else section\fi%
+ \or section%
+ \or subsection%
+ \or subsubsection%
+ \or subsubsubsection%
+ \or subsubsubsubsection%
+ \or subsubsubsubsubsection%
+ \or subsubsubsubsubsubsection%
+ \or paragraph%
+ \or subparagraph%
+ \else\ifnum\numexpr#1>\z@
+ empty%
+ \else\ifnum\numexpr#1=\m@ne
+ part%
+ \else
+ book%
+ \fi\fi
+ \fi
+ }
+\fi
\def\etoclocalheadtotoc#1#2{\addcontentsline{toc}{@#1}{#2}}
\def\etocglobalheadtotoc{\addcontentsline{toc}}
% \end{macrocode}
% I have coded this so that it can be copied pasted to a user document and
-% customized at will. The \csa{par} is in case of a local TOC in a
-% subsubsection or deeper, the heading will then be rendered as a paragraph
-% heading...\par^^A sigh with extra line if full here
+% customized at will. \etocrelease{1.2a} uses a better test for knowing if
+% the starred command of previous line created an inline heading with
+% \csa{everypar}: \etocrelease{1.2} simply tested if \csbc{etoclocaltop} was
+% at least |3| but this does not scale well with \etocoption{deeplevels}.
+% Only worry here is whether the \csa{if@noskipsec} thing really works with
+% all document classes. At least it is in \LaTeX{} kernel.\par^^A pénible
% \begin{macrocode}
\providecommand*\UseName{\@nameuse}
\def\etocetoclocaltocmaketitle{%
\UseName{\etocdivisionnameatlevel{\etoclocaltop+1}}*{\localcontentsname}%
- \ifnum\etoclocaltop>\tw@\mbox{}\par\fi
+ \if@noskipsec\leavevmode\par\fi
\etociflocaltoctotoc
{\etocifisstarred
{}% star variant, do not add to toc
@@ -9027,19 +9440,34 @@ of real structure in a \LaTeX{} document body).
}%
\fi
% \end{macrocode}
-% \csa{expanded} is by now available in all engines, I think.
-% \begin{macrocode}
-\def\Etoc@hackedaddcontentsline#1{%
- \expanded{\noexpand\in@{.#1,}{\ifEtoc@lof.lof,\fi\ifEtoc@lot.lot,\fi}}%
- \ifin@\expandafter\Etoc@hackedaddcontentsline@i
- \else\expandafter\Etoc@originaladdcontentsline
+% For optimization of execution speed we define the macro conditionnally on
+% the option status (wihch is frozen). In the first case, |#1=lof,.lot| would
+% work but this is not realistic.
+% \begin{macrocode}
+\ifEtoc@lof
+ \ifEtoc@lot
+ \def\Etoc@hackedaddcontentsline#1{%
+ \expanded{\noexpand\in@{.#1,}}{.lof,.lot,}%
+ \ifin@\expandafter\Etoc@hackedaddcontentsline@i
+ \else\expandafter\Etoc@originaladdcontentsline
+ \fi {#1}}
+ \else
+ \def\Etoc@hackedaddcontentsline#1{%
+ \expanded{\noexpand\in@{.#1,}}{.lof,}%
+ \ifin@\expandafter\Etoc@hackedaddcontentsline@i
+ \else\expandafter\Etoc@originaladdcontentsline
+ \fi {#1}}
\fi
- {#1}%
-}
+\else
+ \def\Etoc@hackedaddcontentsline#1{%
+ \expanded{\noexpand\in@{.#1,}}{.lot,}%
+ \ifin@\expandafter\Etoc@hackedaddcontentsline@i
+ \else\expandafter\Etoc@originaladdcontentsline
+ \fi {#1}}
+\fi
% \end{macrocode}
% This business of \csa{protected@file@percent} is not really needed as anyhow
% \etoc reads the |.toc| file with no space token from end of lines.
-
% \begin{macrocode}
\def\Etoc@hackedaddcontentsline@i#1#2#3{%
\expanded{\noexpand\in@{.#1;#2,}}{.lof;figure,.lot;table,}%
@@ -9052,6 +9480,31 @@ of real structure in a \LaTeX{} document body).
\Etoc@originaladdcontentsline{#1}{#2}{#3}%
}
% \end{macrocode}
+% The two macros need to be redefined if \csa{expanded} is not provided by the
+% engine. Here we leave some tests done at execution time although they could
+% have been done (as above) here at definition time.
+% \begin{macrocode}
+\unless\ifdefined\expanded
+ \def\Etoc@hackedaddcontentsline#1{%
+ {\edef\Etoc@tmp{\noexpand\in@{.#1,}{\ifEtoc@lof.lof,\fi\ifEtoc@lot.lot,\fi}}\expandafter}%
+ \Etoc@tmp
+ \ifin@\expandafter\Etoc@hackedaddcontentsline@i
+ \else\expandafter\Etoc@originaladdcontentsline
+ \fi {#1}%
+ }
+ \def\Etoc@hackedaddcontentsline@i#1#2#3{%
+ {\edef\Etoc@tmp{\noexpand\in@{.#1;#2,}}\expandafter}%
+ \Etoc@tmp{.lof;figure,.lot;table,}%
+ \ifin@
+ \addtocontents {toc}{%
+ \protect\contentsline{#2}{#3}{\thepage}{\ifEtoc@hyperref\@currentHref\fi}%
+ \ifdefined\protected@file@percent\protected@file@percent\fi
+ }%
+ \fi
+ \Etoc@originaladdcontentsline{#1}{#2}{#3}%
+ }
+\fi
+% \end{macrocode}
% We will simply let \csbc{locallistoffigures} and \csbc{locallistoftables}
% use \csbc{localtableofcontents}. We need some dedicated variant of
% \csbc{Etoc@@startlocaltoc}. Hesitation where to put
@@ -9130,7 +9583,7 @@ of real structure in a \LaTeX{} document body).
% \begin{macrocode}
\def\Etoc@do##1{%
\ifnum\etoclevel{##1}>\etoclocaltop
- \expandafter\let\csname Etoc@##1@@\endcsname\Etoc@@six@@
+ \expandafter\let\csname Etoc@##1@@\endcsname\Etoc@maxlevel
\fi}%
\Etoc@dolevels
}
@@ -9156,15 +9609,15 @@ of real structure in a \LaTeX{} document body).
% where the dots represent some code with \csbc{etocnumber}, \csbc{etocname},
% \csbc{etocpage}, itself possibly querying \csbc{etoclevel}|{figure}|, or
% perhaps \csbc{etoclocaltop} to know the actual depth (which may the one of a
-% Part which can thus be distinguished from being in a Chapter, whereas
+% Part which can thus be distinguished from being in a Chapter, whereas
% \csa{number}\csbc{etoclevel}|{figure}| will give |1| in both cases).
%
% There is variant which is to maintain the default \csbc{etocstandardlines}
% in the hook and then re-define the kernel macro \csa{l@figure} to do the
% desired thing. For example the default with |article| is for \csa{l@figure}
-% to do {|\@dottedtocline {1}{1.5em}{2.3em}|} so you can do some
-% variant where the second and third argument (numwidth and indent) are set
-% according to \csbc{etoclocaltop}.
+% to do {|\@dottedtocline {1}{1.5em}{2.3em}|} so you can do some variant where
+% the second and third argument (indent and numwidth) are set according to
+% \csbc{etoclocaltop}.
%
% I hope the above explanations help, they appear too advanced for inclusion
% in the user manual so I give them here.
@@ -9213,8 +9666,8 @@ of real structure in a \LaTeX{} document body).
% \end{macrocode}
% Memo: \csa{ext@toc} defined in KOMA and memoir but not in the standard classes.
% \begin{macrocode}
-\def\locallistoffigures{%
- \ifEtoc@lof
+\ifEtoc@lof
+ \def\locallistoffigures{%
\def\Etoc@listofreset{%
\let\Etoc@currext\Etoc@tocext
\let\Etoc@@startlocaltoc\Etoc@@startlocaltoc@toc
@@ -9236,20 +9689,22 @@ of real structure in a \LaTeX{} document body).
\def\Etoc@@startlocaltochook{\Etoc@@startlocallistof@setlevels{figure}}%
\def\Etoc@listofhook{%
\def\Etoc@do####1{%
- \expandafter\let\csname Etoc@@####1@@\endcsname\Etoc@@six@@
+ \expandafter\let\csname Etoc@@####1@@\endcsname\Etoc@maxlevel
}%
\Etoc@dolevels
}%
- \expandafter\localtableofcontents
- \else
+ \localtableofcontents
+ }
+\else
+ \def\locallistoffigures{%
\PackageError{etoc}{%
\string\locallistoffigures \on@line\space but\MessageBreak
package was loaded without `lof' option}%
{Try again with \string\usepackage[lof]{etoc}}%
- \fi
-}
-\def\locallistoftables{%
- \ifEtoc@lot
+ }
+\fi
+\ifEtoc@lot
+ \def\locallistoftables{%
\def\Etoc@listofreset{%
\let\Etoc@currext\Etoc@tocext
\let\Etoc@@startlocaltoc\Etoc@@startlocaltoc@toc
@@ -9262,18 +9717,20 @@ of real structure in a \LaTeX{} document body).
\def\Etoc@@startlocaltochook{\Etoc@@startlocallistof@setlevels{table}}%
\def\Etoc@listofhook{%
\def\Etoc@do####1{%
- \expandafter\let\csname Etoc@@####1@@\endcsname\Etoc@@six@@
+ \expandafter\let\csname Etoc@@####1@@\endcsname\Etoc@maxlevel
}%
\Etoc@dolevels
}%
- \expandafter\localtableofcontents
- \else
+ \localtableofcontents
+ }
+\else
+ \def\locallistoftables{%
\PackageError{etoc}{%
\string\locallistoftable \on@line\space but\MessageBreak
package was loaded without `lot' option}%
{Try again with \string\usepackage[lot]{etoc}}%
- \fi
-}
+ }
+\fi
% \end{macrocode}
% \csbc{Etoc@tocid} is the number of the toc (possibly gotten via a |\ref|
% following a \csbc{tableofcontents}), or it is |\z@| if the emptiness test is
@@ -9299,7 +9756,7 @@ of real structure in a \LaTeX{} document body).
%
% MEMO: Should I also execute \csbc{etoclocaltableofcontentshook}?
% Then I would need to set \csbc{etoclocallistoffigureshook} to redefine it,
-% rather than be inserted as itself.
+% rather than be inserted as itself.
% \begin{macrocode}
\def\Etoc@checkifempty {%
\global\Etoc@isemptytoctrue
@@ -9341,7 +9798,7 @@ of real structure in a \LaTeX{} document body).
\def\Etoc@testingcontentslinelocal #1{%
\ifEtoc@stoptoc
\else
- \ifnum\csname Etoc@#1@@\endcsname=\Etoc@@six@@
+ \ifnum\csname Etoc@#1@@\endcsname=\Etoc@maxlevel
\else
\global\expandafter\let\expandafter\Etoc@level\csname Etoc@#1@@\endcsname
\if @\@car#1\@nil\else\global\let\Etoc@virtualtop\Etoc@level\fi
@@ -9374,7 +9831,7 @@ of real structure in a \LaTeX{} document body).
% The \csa{@gobblethree} was added to the \LaTeX{} kernel for its 2020-02-02
% PL 5 release and we require 2020-10-01 since \etocrelease{1.1a}.
% \begin{macrocode}
- \@gobblethree
+ \Etoc@gobblethreeorfour{}%
}
% \end{macrocode}
% Test of emptiness of the global TOC (according to current setting of the
@@ -9383,7 +9840,7 @@ of real structure in a \LaTeX{} document body).
\def\Etoc@testingcontentsline #1{%
\ifEtoc@stoptoc
\else
- \ifnum\csname Etoc@#1@@\endcsname=\Etoc@@six@@
+ \ifnum\csname Etoc@#1@@\endcsname=\Etoc@maxlevel
\else
\unless\ifnum\csname Etoc@#1@@\endcsname>\c@tocdepth
\global\Etoc@isemptytocfalse
@@ -9391,24 +9848,22 @@ of real structure in a \LaTeX{} document body).
\fi
\fi
\fi
- \@gobblethree
+ \Etoc@gobblethreeorfour{}%
}
% \end{macrocode}
-% |2015/03/16|: \etocrelease{1.08e} lets \csbc{localtableofcontents} do a
+% \etocrelease{1.08e} lets \csbc{localtableofcontents} do a
% first scan of the |.toc| file (as stored in \csbc{Etoc@toctoks}) to
-% determine if the table of contents will in fact end up empty.
-%
-% Update (|2023/02/26|): the actual \etocrelease{1.08e} of |2015/04/17| had
-% \csbc{etocchecksemptiness} to tell \etoc to do the emptiness check, it is
-% not done automatically.
-%
-% In that case, nothing is typeset. The
-% command \csbc{etocaftertochook} is still executed though. Other ways were
-% envisioned (like delimited macros) to determine this potential emptiness, but
-% in the end I opted for execution of the |.toc| file with suitable definitions
-% for \csa{contentsline} and \csbc{etoc@startlocaltoc}. Notice though that if
-% emptiness would result from empty line styles, this can not be detected.
-% Emptiness means ``no executed \csa{contentsline}''.
+% determine if the table of contents will in fact end up empty. Only,
+% however if user has added \csbc{etocchecksemptiness} to document.
+%
+% If this optional emptiness check is positive, nothing is typeset.
+% The command \csbc{etocaftertochook} is still executed though. Other
+% ways were envisioned (like delimited macros) to determine this potential
+% emptiness, but in the end I opted for execution of the |.toc| file with
+% suitable definitions for \csa{contentsline} and
+% \csbc{etoc@startlocaltoc}. Notice though that if emptiness would result from
+% empty line styles, this can not be detected. Emptiness means ``no
+% \csa{contentsline} under the TOC scope''.
%
% For this detection of emptiness, assignments (here and in
% \csbc{Etoc@testingcontentsline}) are made globally, I think this is the best
@@ -9420,7 +9875,7 @@ of real structure in a \LaTeX{} document body).
% \toc|\ref{foo}|; the latter could so far possibly refer to a local or also to
% a global table of contents but release \etocrelease{1.08e} has deprecated the latter use
% as it complicated the code, for something truly silly. Thus |\ref{foo}| must
-% now be with |foo| a label of a local TOC. As a result \csbc{ifEtoc@tocwithid} is
+% now be with |foo| a label of a \emph{local} TOC. As a result \csbc{ifEtoc@tocwithid} is
% less used now.
%
% In the case of a |\ref|ed-to toc whose label was just added hence is not yet
@@ -9472,7 +9927,7 @@ of real structure in a \LaTeX{} document body).
% Also the \csa{PackageWarning} does not trigger a visible message
% near the end of the log file or console output, contrarily to a
% \centeredline{|LaTeX Warning: There were undefined references.|}
-% followed by a
+% followed by a
% \centeredline{|LaTeX Warning: Label(s) may have changed. Rerun to get cross-references right.|}
%
% Method used here seems to work fine also with |latexmk|: it does not seem to
@@ -9878,20 +10333,37 @@ of real structure in a \LaTeX{} document body).
}
\def\Etoc@setstyle@a #1{%
\edef\Etoc@tmp{\the\numexpr\csname Etoc@#1@@\endcsname}%
- \if1\unless\ifnum\Etoc@tmp<\Etoc@@six@@ 0\fi\unless\ifnum\Etoc@tmp>\Etoc@minf 0\fi1%
+ \if1\unless\ifnum\Etoc@tmp<\Etoc@maxlevel 0\fi
+ \unless\ifnum\Etoc@tmp>\Etoc@minf 0\fi1%
\Etoc@standardlinesfalse
\expandafter\Etoc@setstyle@b\expandafter\Etoc@tmp
\else
- \PackageWarning{etoc}{Sorry, but you can not set the style of `#1',\MessageBreak
- as its level \Etoc@tmp\space is either \number\Etoc@minf\space
- or 6.\MessageBreak
- Consider using \string\etocsetlevel\space first, but note
- that `all',\MessageBreak
- `none', `figure' and `table' are forbidden there. \space
- Check\MessageBreak
- the documentation about how to proceed for customizing\MessageBreak
- figure and table entries in \string\listoffigures/tables.\MessageBreak
- Reported}%
+ \ifnum\Etoc@tmp=\Etoc@maxlevel
+ \in@{.#1,}{.figure,.table,}%
+ \ifin@
+ \PackageWarning{etoc}
+ {You can not use \string\etocsetstyle\space with `#1'.\MessageBreak
+ Check the package documentation (in particular about\MessageBreak
+ \string\etoclocallistoffigureshook/\string\etoclocallistoftableshook)%
+ \MessageBreak on how to customize
+ figure and table entries in local\MessageBreak lists. Reported}%
+ \else
+ \PackageInfo{etoc}
+ {Attempt to set the style of `#1',\MessageBreak
+ whose level is currently the maximal one \etocthemaxlevel,\MessageBreak
+ which is never displayed. \space This will be ignored\MessageBreak
+ but note that we do quit compatibility mode.\MessageBreak
+ Reported}%
+ \Etoc@standardlinesfalse
+ \fi
+ \else
+% \end{macrocode}
+% This branch was actually in the end only for the case of a level equal to
+% |-2|, with a document class not \ctanpkg{memoir}, but \etocrelease{1.2a}
+% prevents \csbc{etocsetlevel} to use numerical level |-2| in such case.
+% \begin{macrocode}
+ \PackageWarning{etoc}{This should not happen. Reported}%
+ \fi
\expandafter\@gobblefour
\fi
}
@@ -9911,6 +10383,12 @@ of real structure in a \LaTeX{} document body).
\expandafter\def\csname Etoc@contents@#1\endcsname {#4}%
\expandafter\def\csname Etoc@end@#1\endcsname {#5}%
}
+\def\Etoc@setstyle@e#1{%
+ \expandafter\let\csname Etoc@begin@#1\endcsname \@empty
+ \expandafter\let\csname Etoc@prefix@#1\endcsname \@empty
+ \expandafter\let\csname Etoc@contents@#1\endcsname \@empty
+ \expandafter\let\csname Etoc@end@#1\endcsname \@empty
+}
\def\Etoc@storelines@a#1{%
\noexpand\Etoc@setstyle@b{#1}%
{\expandafter\Etoc@expandonce\csname Etoc@begin@#1\endcsname}%
@@ -9922,11 +10400,16 @@ of real structure in a \LaTeX{} document body).
\def\etocstorelinestylesinto#1{%
\edef#1{\Etoc@storelines@a{-2}\Etoc@storelines@a{-1}\Etoc@storelines@a{0}%
\Etoc@storelines@a {1}\Etoc@storelines@a {2}\Etoc@storelines@a{3}%
- \Etoc@storelines@a {4}\Etoc@storelines@a {5}}%
+ \Etoc@storelines@a {4}\Etoc@storelines@a {5}%
+ \ifEtoc@deeplevels
+ \Etoc@storelines@a{6}\Etoc@storelines@a{7}\Etoc@storelines@a{8}%
+ \Etoc@storelines@a{9}\Etoc@storelines@a{10}\Etoc@storelines@a{11}%
+ \fi
+ }%
}
\def\etocstorethislinestyleinto#1#2{%
\edef#2{\expandafter\Etoc@storelines@a\expandafter{\number\etoclevel{#1}}}%
-}%
+}%
% \end{macrocode}
% Customization macros of the package default line styles.
% \begin{macrocode}
@@ -9987,10 +10470,29 @@ of real structure in a \LaTeX{} document body).
% Version \etocrelease{1.09f} wraps \csbc{etocbookname}, respectively
% \csbc{etocpartname}, in the book, resp. part, line styles inside a
% (potential) hyperlink together with the number.
-% \begin{macrocode}
-\def\etocdefaultlines{\Etoc@standardlinesfalse
-%% `book':
-\Etoc@setstyle@b
+%
+% \etocrelease{1.2a} does not define a `book' style if not with
+% \ctanpkg{memoir} class as the numerical level |-2| is made available only
+% with that class.
+%
+% Unfortunately \csa{@ifclassloaded} was preamble-only until the |2021-11-15|
+% LaTeX release (and also \csa{@ifpackageloaded}). Anyway let's refactor this
+% \csbc{etocdefaultlines} at \etocrelease{1.2a} to use encapsulating macros
+% rather than be a single one with gigantic contents.
+% \begin{macrocode}
+\def\etocdefaultlines{%
+ \Etoc@standardlinesfalse
+ \etocdefaultlines@setbook
+ \etocdefaultlines@setpart
+ \etocdefaultlines@setchapter
+ \etocdefaultlines@setsection
+ \etocdefaultlines@setsubsection
+ \etocdefaultlines@setsubsubsection
+ \etocdefaultlines@setdeeperones
+}
+\@ifclassloaded{memoir}{%
+ \def\etocdefaultlines@setbook{%
+ \Etoc@setstyle@b
{-2}%
{\addpenalty\@M\etocskipfirstprefix}
{\addpenalty\@secpenalty}
@@ -10008,7 +10510,9 @@ of real structure in a \LaTeX{} document body).
\addpenalty\@M\addvspace{\etocsepminusone}%
\endgroup}
{}%
-%% `part':
+ }
+ }{\let\etocdefaultlines@setbook\@empty}
+\def\etocdefaultlines@setpart{%
\Etoc@setstyle@b
{-1}%
{\addpenalty\@M\etocskipfirstprefix}
@@ -10027,7 +10531,8 @@ of real structure in a \LaTeX{} document body).
\addpenalty\@M\addvspace{\etocsepzero}%
\endgroup}
{}%
-%% `chapter':
+}
+\def\etocdefaultlines@setchapter{%
\Etoc@setstyle@b
{0}%
{\addpenalty\@M\etocskipfirstprefix}
@@ -10041,7 +10546,8 @@ of real structure in a \LaTeX{} document body).
\par}%
\endgroup}
{\addpenalty{-\@highpenalty}\addvspace{\etocsepminusone}}%
-%% `section':
+}
+\def\etocdefaultlines@setsection{%
\Etoc@setstyle@b
{1}%
{\addpenalty\@M\etocskipfirstprefix}
@@ -10075,7 +10581,8 @@ of real structure in a \LaTeX{} document body).
\fi
\endgroup}
{\addpenalty\@secpenalty\addvspace{\etocsepzero}}%
-%% `subsection':
+}
+\def\etocdefaultlines@setsubsection{%
\Etoc@setstyle@b
{2}%
{\addpenalty\@medpenalty\etocskipfirstprefix}
@@ -10108,7 +10615,8 @@ of real structure in a \LaTeX{} document body).
\fi
\endgroup}
{\addpenalty\@secpenalty\addvspace{\etocsepone}}%
-%% `subsubsection':
+}
+\def\etocdefaultlines@setsubsubsection{%
\Etoc@setstyle@b
{3}%
{\addpenalty\@M
@@ -10123,13 +10631,20 @@ of real structure in a \LaTeX{} document body).
\baselineskip\etocbaselinespreadthree\baselineskip
\par
\endgroup
- \addpenalty{-\@highpenalty}}%
-% \end{macrocode}
-% placeholder for comments
-% \begin{macrocode}
-\Etoc@setstyle@b{4}{}{}{}{}%
-\Etoc@setstyle@b{5}{}{}{}{}%
-}% end of \etocdefaultlines definition
+ \addpenalty{-\@highpenalty}}
+}
+\def\etocdefaultlines@setdeeperones{%
+\Etoc@setstyle@e{4}%
+\Etoc@setstyle@e{5}%
+\ifEtoc@deeplevels
+ \Etoc@setstyle@e{6}%
+ \Etoc@setstyle@e{7}%
+ \Etoc@setstyle@e{8}%
+ \Etoc@setstyle@e{9}%
+ \Etoc@setstyle@e{10}%
+ \Etoc@setstyle@e{11}%
+\fi
+}
% \end{macrocode}
% The \csbc{etocinnertopsep} default value is too big as well as \csbc{etocbelowtocskip}
% and \csbc{etocabovetocskip}, I guess, but if I am remember correctly I chose them
@@ -10610,7 +11125,7 @@ of real structure in a \LaTeX{} document body).
% \csbc{Etoc@aftertitlehook} is empty or not). Notice that the memoir class
% way of implementing \csbc{tableofcontents} leaves no way for code executed
% by the TOC code to know if it is executed in starred or non-starred context.
-% \begin{macrocode}
+% \begin{macrocode}
\Etoc@aftertitlehook \let \Etoc@aftertitlehook \relax
\fi
\parskip \cftparskip \@nameuse {cft\Etoc@currext beforelisthook}%
@@ -10692,7 +11207,7 @@ of real structure in a \LaTeX{} document body).
{\csname ifEtoc@local#1totoc\endcsname
\setuptoc{\Etoc@currext}{totoc}%
\fi
- }%
+ }%
}%
}
\ifdefined\Iftocfeature
@@ -10862,7 +11377,7 @@ of real structure in a \LaTeX{} document body).
}%
{%
\endgroup
- \@cfttocfinish
+ \@cfttocfinish
}%
}
\def\etoctocloftlocalperhapsaddtotoc#1{%
@@ -10871,7 +11386,7 @@ of real structure in a \LaTeX{} document body).
{\csname ifEtoc@local#1totoc\endcsname
\ifdefined\c@chapter\def\@tocextra{@section}\else\def\@tocextra{@subsection}\fi
\csname @cftdobib#1\endcsname
- \fi
+ \fi
}%
}
% \end{macrocode}
@@ -11001,7 +11516,7 @@ of real structure in a \LaTeX{} document body).
\fi
}%
{}%
- }%
+ }%
% \end{macrocode}
% Maybe I should check if the options were already set. I will simply
% make the message more generic.
@@ -11260,7 +11775,7 @@ of real structure in a \LaTeX{} document body).
% consistency with internal macros, but too late it is already in user |.toc| files.
% \begin{macrocode}
\def\etoc@setlocaltop #1{%
- \ifnum#1=\Etoc@@six@@
+ \ifnum#1=\Etoc@maxlevel
\Etoc@skipthisonetrue
\else
\Etoc@skipthisonefalse
@@ -11282,7 +11797,7 @@ of real structure in a \LaTeX{} document body).
% would have to document. And test. And implement first.
% \begin{macrocode}
\global\let\Etoc@level #1%
- \global\let\Etoc@virtualtop #1%
+ \global\let\Etoc@virtualtop #1%
\ifEtoc@localtoc
\ifEtoc@stoptoc
\Etoc@skipthisonetrue
diff --git a/macros/latex/contrib/etoc/etoc.pdf b/macros/latex/contrib/etoc/etoc.pdf
index 667b79b3ad..931135c469 100644
--- a/macros/latex/contrib/etoc/etoc.pdf
+++ b/macros/latex/contrib/etoc/etoc.pdf
Binary files differ