summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/etoc
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2022-11-21 03:04:15 +0000
committerNorbert Preining <norbert@preining.info>2022-11-21 03:04:15 +0000
commitcf9efbbd09ec0218821a622f2ff7dc2ce0ad5645 (patch)
tree6da67db1fcedb1d9d25e76ad43115e1642710955 /macros/latex/contrib/etoc
parent999f362e8eb932fc5a4a09a0105de82c52456dbf (diff)
CTAN sync 202211210304
Diffstat (limited to 'macros/latex/contrib/etoc')
-rw-r--r--macros/latex/contrib/etoc/README.md37
-rw-r--r--macros/latex/contrib/etoc/etoc.dtx1513
-rw-r--r--macros/latex/contrib/etoc/etoc.pdfbin819311 -> 867601 bytes
3 files changed, 998 insertions, 552 deletions
diff --git a/macros/latex/contrib/etoc/README.md b/macros/latex/contrib/etoc/README.md
index b58480ffb9..ccb69c6990 100644
--- a/macros/latex/contrib/etoc/README.md
+++ b/macros/latex/contrib/etoc/README.md
@@ -1,6 +1,6 @@
<!-- -->
- Source: etoc.dtx (1.09g)
+ Source: etoc.dtx (1.09h)
Author: Jean-Francois Burnol
Info: Completely customisable TOCs
License: LPPL 1.3c
@@ -97,6 +97,14 @@ etoc.sty, etoc.tex, etoc.pdf, etoc.dvi.
RECENT CHANGES
==============
+1.09h \[2022/11/20\]
+--------------------
+
+Documentation improvements. In particular, attached code snippets
+are now visible via their filenames in the page margins. Also,
+command names are doubly hyperlinked: first half links to the devoted
+part of the user manual, second half links to the implementation part.
+
1.09g \[2022/11/17\]
--------------------
@@ -138,30 +146,3 @@ Also add `\etocimmediatesetlocaltop.toc`.
Fix an obscure bug (see source code comments) in the `\etocsetlocaltop.toc`
mechanism.
-
-1.09e \[2021/09/23\]
---------------------
-
-Needed (if etoc is used without hyperref) updates to
-internal macros to prepare for the upcoming LaTeX November
-2021 change to `\contentsline`.
-
-Related updates to the user macro `\etoctoccontentsline`.
-
-1.09d \[2021/07/13\]
---------------------
-
-Some minor synching with tableof 1.4c.
-
-Add `\etockeeporiginaltableofcontents` to provide a work-around to a
-compatibility issue with listings's `\lstlistoflistings`, which abuses
-`\tableofcontents` for doing something unrelated to the actual contents.
-Thanks to Denis Bitouzé for report.
-
-Usage: `\usepackage{etoc}\etockeeporiginaltableofcontents`, then
-however you must employ `\etoctableofcontents`, not `\tableofcontents`.
-
-1.09c \[2020/05/15\]
---------------------
-
-Syncs with KOMA-script deprecation of `\iftocfeature`.
diff --git a/macros/latex/contrib/etoc/etoc.dtx b/macros/latex/contrib/etoc/etoc.dtx
index 362219028f..4563c21dc9 100644
--- a/macros/latex/contrib/etoc/etoc.dtx
+++ b/macros/latex/contrib/etoc/etoc.dtx
@@ -2,20 +2,20 @@
% N.B.: this dtx file is NOT for use with \DocInput. The latex source of the
% user manual is not prefixed with percent signs.
%<*none>
-\def\etocdtxtimestamp {Time-stamp: <17-11-2022 at 23:14:36 CET>}%
+\def\etocdtxtimestamp {Time-stamp: <20-11-2022 at 21:44:51 CET>}%
%</none>
%<*!readme>
%%
%% Package: etoc
-%% Version: 1.09g (DEVELOPMENT)
+%% Version: 1.09h
%% License: LPPL 1.3c
%% Copyright (C) 2012-2022 Jean-Francois Burnol
%% <jfbu at free dot fr>
%</!readme>
%<*none>
-\def\etocpkgdate {2022/11/17}
-\def\etocdocdate {2022/11/17}
-\def\etocpkgversion {1.09g}
+\def\etocpkgdate {2022/11/20}
+\def\etocdocdate {2022/11/20}
+\def\etocpkgversion {1.09h}
\def\etocpkgdescription {Completely customisable TOCs (JFB)}
%% German translation was last udpated on April 2015 and all new material
%% was included since in English. During 2020/2021/2022 emerged a still
@@ -33,7 +33,7 @@
\catcode32=13\catcode`\\=12^^Brelax^^A
^^Bfirstofone{^^Bendgroup^^Bdef^^BetocLicense^^A
{% Package: etoc
-% Version: 1.09g
+% Version: 1.09h
% License: LPPL 1.3c
% Copyright (C) 2012-2022 Jean-Francois Burnol <jfbu at free dot fr>
%
@@ -60,7 +60,7 @@
%<*readme>
<!-- -->
- Source: etoc.dtx (1.09g)
+ Source: etoc.dtx (1.09h)
Author: Jean-Francois Burnol
Info: Completely customisable TOCs
License: LPPL 1.3c
@@ -157,6 +157,14 @@ etoc.sty, etoc.tex, etoc.pdf, etoc.dvi.
RECENT CHANGES
==============
+1.09h \[2022/11/20\]
+--------------------
+
+Documentation improvements. In particular, attached code snippets
+are now visible via their filenames in the page margins. Also,
+command names are doubly hyperlinked: first half links to the devoted
+part of the user manual, second half links to the implementation part.
+
1.09g \[2022/11/17\]
--------------------
@@ -198,33 +206,6 @@ Also add `\etocimmediatesetlocaltop.toc`.
Fix an obscure bug (see source code comments) in the `\etocsetlocaltop.toc`
mechanism.
-
-1.09e \[2021/09/23\]
---------------------
-
-Needed (if etoc is used without hyperref) updates to
-internal macros to prepare for the upcoming LaTeX November
-2021 change to `\contentsline`.
-
-Related updates to the user macro `\etoctoccontentsline`.
-
-1.09d \[2021/07/13\]
---------------------
-
-Some minor synching with tableof 1.4c.
-
-Add `\etockeeporiginaltableofcontents` to provide a work-around to a
-compatibility issue with listings's `\lstlistoflistings`, which abuses
-`\tableofcontents` for doing something unrelated to the actual contents.
-Thanks to Denis Bitouzé for report.
-
-Usage: `\usepackage{etoc}\etockeeporiginaltableofcontents`, then
-however you must employ `\etoctableofcontents`, not `\tableofcontents`.
-
-1.09c \[2020/05/15\]
---------------------
-
-Syncs with KOMA-script deprecation of `\iftocfeature`.
%</readme>
%<*tex>-------------------------------------------------------------------------
%% run pdflatex thrice on this file etoc.tex to produce the documentation
@@ -472,38 +453,68 @@ Syncs with KOMA-script deprecation of `\iftocfeature`.
\usepackage[utf8]{inputenc}
\usepackage[hscale=0.66,vscale=0.75]{geometry}
\pagestyle{headings}
-% \usepackage{layout}
-
-% January 2014. work-around a bug in KOMA 3.12 (December 2013):
+% \sectionmark uses \markboth in twoside but
+% with an empty right mark! As a result if a section starts
+% on an odd page, it does not appear in the header mark.
+% Perhaps there was a subsection of 3 lines on that page
+% and it is the subsection which decides what is in the header.
\makeatletter
-\def\buggysectionmark #1{% KOMA 3.12 as released to CTAN December 2013
- \if@twoside\expandafter\markboth\else\expandafter\markright\fi
- {\MakeMarkcase{\ifnumbered{section}{\sectionmarkformat\fi}{}#1}}{}}
-\ifx\buggysectionmark\sectionmark
-\def\sectionmark #1{%
- \if@twoside\expandafter\markboth\else\expandafter\markright\fi
- {\MakeMarkcase{\ifnumbered{section}{\sectionmarkformat}{}#1}}{}}
-\fi
+% \newwrite\out
+% \immediate\openout\out=\jobname.headings
+% \immediate\write\out{\meaning\ps@headings}
+% \immediate\closeout\out
+% from \ps@headings:
+% \renewcommand *{\sectionmark }[1]{\if@twoside \expandafter \markboth
+% \else \expandafter \markright \fi {\MakeMarkcase {\Ifnumbered
+% {section}{\sectionmarkformat }{}##1}}{}}
+% \renewcommand *{\subsectionmark }[1]{\if@twoside \markright {\MakeMarkcase
+% {\Ifnumbered {subsection}{\subsectionmarkformat }{}##1}}\fi }
+
+% Some custom \sectionmark to get headers more to my taste.
+% But it is hard to find algorithm giving satisfaction in all cases.
+
+\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
+ \expandafter\expandafter\expandafter \markright\expandafter \@firstoftwo
+ \fi
+ {\MakeMarkcase {\Ifnumbered {section}{\sectionmarkformat }{}#1}}%
+ {\MakeMarkcase {\Ifnumbered {section}{\sectionmarkformat }{}#1}}%
+}
+
+% Par ailleurs je vais remplacer \firstmark par \botmark dans \rightmark
+% dont la définition par défaut est :
+
+% \rightmark:
+% macro:->\expandafter \@rightmark \firstmark \@empty \@empty
+
+\renewcommand*\rightmark{\expandafter\@rightmark\botmark \@empty\@empty}
+% Au passage l'output de latexdef à un : supplémentaire bizarre
+% $ latexdef botmark
+%
+% \botmark:
+% \botmark:
+%
+
+% Néanmoins pour les \part il ne faut clairement pas utiliser \botmark
+% Tous mes \part sont après un \clearpage explicite
+% Je crois que le plus simple est encore de faire ceci:
+\def\ps@mypartheadings{%
+ \ps@headings
+ \let\@evenhead\@empty
+ \let\@oddhead\@empty
+}
+
+% peut-être serait-ce mieux de mettre le \thispagestyle après mon \clearpage,
+% explicitement dans la source
+\def\part{\thispagestyle{mypartheadings}\scr@startpart {part}}
+
\makeatother
-\makeatletter
-% 2013/03/07.
-% This macro allows to conveniently center a line inside a paragraph and still
-% use therein \verb or other commands changing catcodes.
-% Note: \centerline in LaTeX still uses \hsize and not \linewidth/\columnwidth
- \def\@centeredline {\hbox to \linewidth
- \bgroup \hss \bgroup
- \aftergroup\centeredline@ }
- \newcommand*\centeredline {%
- \ifhmode
- \\\relax
- \def\centeredline@{\hss\egroup\hskip\z@skip}%
- \else
- \def\centeredline@{\hss\egroup}%
- \fi
- \afterassignment\@centeredline
- \let\next=}
+\usepackage{centeredline}% replaces the 2013/03/07 original code
+\makeatletter
% pour maintenir les % en début de ligne dans les blocs verbatim
%
@@ -723,7 +734,8 @@ pdftitle={The etoc package},%
pdfsubject={Tables of contents with LaTeX},%
pdfkeywords={LaTeX, table of contents},%
pdfstartview=FitH,%
-pdfpagemode=UseOutlines}
+%%pdfpagemode=UseOutlines,% commented-out for 1.09h
+}
% added usage of package bookmark 2013/10/10
\usepackage{bookmark}
@@ -827,12 +839,12 @@ pdfpagemode=UseOutlines}
\setcounter{mycounti}{0}%
\setcounter{mycountii}{0}%
\def\thispartstatsauxi{%
- \sbox{\firstnamei}{\etocname}%
- \sbox{\firstnumberi}{\etocnumber}%
+ \sbox{\firstnamei}{\footnotesize\etocname}%
+ \sbox{\firstnumberi}{\footnotesize\etocnumber}%
\def\thispartstatsauxi{}}%
\def\thispartstatsauxii{%
- \sbox{\firstnameii}{\etocname}%
- \sbox{\firstnumberii}{\etocnumber}%
+ \sbox{\firstnameii}{\footnotesize\etocname}%
+ \sbox{\firstnumberii}{\footnotesize\etocnumber}%
\def\thispartstatsauxii{}}%
\begingroup
\etocsetstyle{subsection}
@@ -840,17 +852,18 @@ pdfpagemode=UseOutlines}
{}
{\thispartstatsauxii
\stepcounter{mycountii}%
- \sbox{\lastnameii}{\etocname}%
- \sbox{\lastnumberii}{\etocnumber}}
+ \sbox{\lastnameii}{\footnotesize\etocname}%
+ \sbox{\lastnumberii}{\footnotesize\etocnumber}}
{}
\etocsetstyle{section}
{}
{}
{\thispartstatsauxi
\stepcounter{mycounti}%
- \sbox{\lastnamei}{\etocname}%
- \sbox{\lastnumberi}{\etocnumber}}
- {Here are some statistics for this part: it contains \arabic{mycounti}
+ \sbox{\lastnamei}{\footnotesize\etocname}%
+ \sbox{\lastnumberi}{\footnotesize\etocnumber}}
+ {{\footnotesize\itshape
+ 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
@@ -863,7 +876,8 @@ pdfpagemode=UseOutlines}
``\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 }
+ ``\unhbox\lastnumberii''.\fi
+ \par}}
\etocinline
% october 10, 2013.
\etocsetnexttocdepth {2}%
@@ -902,18 +916,71 @@ pdfpagemode=UseOutlines}
\newcommand\etoc{%
\texorpdfstring{{\color{joli}\ttfamily\bfseries etoc}}{etoc}\xspace}
-\DeclareRobustCommand\csa [1] {{\ttfamily\hyphenchar\font45 \char`\\ #1}}
-\DeclareRobustCommand\csb [1]
- {\hyperref[#1] {\ttfamily\hyphenchar\font45 \char`\\ #1}}
+% hyperlinks to source code... added November 20, 2022
+% works in sync with macrocode hacks explained after \StopEventually
+% which were added in August 2022
+% imported/adapted from code originally added to xint.dtx
+
+% FINALLY, after many hesitations and great suffering with \marginpar
+% I decide to simply divide the name into two parts and use two
+% distinct hyperlinks, so as to not render the reading to painful.
+\usepackage{xinttools}
+
+% \makeatletter
+% \newsavebox\sourcelinkbox
+% \sbox\sourcelinkbox{\color{red}\normalfont\footnotesize\itshape src}
+% % This simply is not workable. I can not use \marginpar in footnotes,
+% % in multicols, etc... and I can not avoid mysterious margin par lost
+% % messages and ! LaTeX Error: Float(s) lost. on page 25 for example.
+% \def\marginsourcelink#1{\normalmarginpar\marginpar{%
+% {%\normalfont\footnotesize#1...
+% \ifodd\value{page}\else\hfill\fi
+% {\hyperref[etocmacro-#1]{\usebox\sourcelinkbox}}%
+% \ifodd\value{page}\hfill\fi
+% }%
+% }}%
+% %
+% % Si j'utilise \smash à l'intérieur, la zone cliquable devient réduite à rien verticalement
+% % ah ok avec \smash à l'extérieur
+% \def\exponentsourcelink#1{{\m@th\kern-\wd\sourcelinkbox
+% \smash{$^{\raisebox{0.75ex}{{\hyperref[etocmacro-#1]{\usebox\sourcelinkbox}}}}$}%
+% }}%
+% \makeatother
+
+\def\csbi#1{\hyperref[#1]{\ttfamily\hyphenchar\font45 \char`\\ #1}}
+
+% use a slightly different colour for second half?
+\DeclareRobustCommand\csb[1]{%
+ \edef\nbmoitie{\the\numexpr\xintLength{#1}/2}%
+ \hyperref[#1]{\ttfamily\hyphenchar\font45 \char`\\ \xintKeepUnbraced{\nbmoitie}{#1}}%
+ \ifcsname r@etocmacro-#1\endcsname
+ %\marginsourcelink{#1}%
+ \hyperref[etocmacro-#1]{\ttfamily\hyphenchar\font45 \xintTrim{\nbmoitie}{#1}}%
+ \else
+ % for .toc suffixed macros
+ \ifcsname r@etocmacro-\xintTrimUnbraced{-4}{#1}\endcsname
+ \hyperref[etocmacro-\xintTrimUnbraced{-4}{#1}]{\ttfamily\hyphenchar\font45
+ \xintTrim{\nbmoitie}{#1}}%
+ \else
+ \hyperref[#1]{\ttfamily\hyphenchar\font45 \xintTrim{\nbmoitie}{#1}}%
+ \fi
+ \fi
+}
+
+\DeclareRobustCommand\csa [1]
+ {{\ttfamily\hyphenchar\font45 \char`\\ #1}}
\newcommand\cshyp[1]{\texorpdfstring{\csa{#1}}{\textbackslash #1}}
\newcommand\csbhyp[1]{\texorpdfstring{\csa{#1}}{\textbackslash #1}}
-\newcommand\toc{\csa{tableofcontents}\xspace}
-\newcommand\localtoc{\csa{localtableofcontents}\xspace}
-\newcommand\localtocwrdp{\csa{localtableofcontentswithrelativedepth}\xspace}
+\DeclareRobustCommand\ctanpkg[1]
+ {\texorpdfstring{\href{https://ctan.org/pkg/#1}{#1}}{#1}}
+
+\newcommand\toc{\csb{tableofcontents}\xspace}
+\newcommand\localtoc{\csb{localtableofcontents}\xspace}
+\newcommand\localtocwrdp{\csb{localtableofcontentswithrelativedepth}\xspace}
\newcommand\lowast{\raisebox{-.25\height}{*}}
\newcommand\starit[1]{\csa{#1\lowast}}
@@ -1070,9 +1137,58 @@ etoc-im-me-di-ate-set-local-top
\def\ExtractDateStamp #1<#2-#3-#4 at #5:#6:#7 #8>%
{D:#4#3#2#5#6#7\csname#8\endcsname}
\edef\DateForSamples {\expandafter\ExtractDateStamp\etocdtxtimestamp}
-\attachfilesetup{icon=Paperclip, mimetype=application/x-tex, appearance=false,
- author={Jean-François Burnol}, date=\DateForSamples}% print=false ?
-% attention Paperclip pas PaperClip !!
+\attachfilesetup{%icon=Paperclip,% attention Paperclip pas PaperClip !!
+ mimetype=application/x-tex,
+ %appearance=false,
+% author={Jean-François Burnol},
+% author={\pdfescapestring{Jean-François Burnol}},
+% TODO: resolve this at some point in my future life
+ author={Jean-Francois Burnol},
+% doing this has fixed the date shown in Acrobat annotation panel
+% but now some strange seemingly unrelated date is printed in
+% the "Comment panel"
+ created=\DateForSamples,
+ modified=\DateForSamples,
+% allright this one next sets the dates shown in the "Comment Panel",
+% whereas the above two (or only modified) impacts the panel of
+% annotations on the left in my (very old) Adobe Reader. Not yet
+% tested with evince
+ date=\DateForSamples
+ }%
+
+\colorlet{etocsnippet}{blue}
+\newcommand\marginattach[1]{% #1 is from some legacy mark-up and is ignored
+ \noindent Depending on your PDF viewer\normalmarginpar
+ \marginpar
+ {%
+ \textattachfile[description={in section \the\value{section}}]%
+ {etocsnippet-\snippetno.tex}%
+ {\textcolor{etocsnippet}{etocsnippet-\snippetno.tex}}%
+ },
+ clicking on the margin filename may allow to extract it.%
+ \stepcounter{snippet}%
+}
+% Sadly, on non-attachement supporting viewers such as Skim.app,
+% the filename is not even searchable : entering "etocsnippet"
+% in the PDF viewer search form does not find the margin texts.
+
+% But I did not want to add to the filename the section number,
+% or perhaps even the page number (which could have been perilous
+% and I did not want to have to test and experiment, as I have
+% done enough for today with these code snippets).
+
+% In Acrobat the description field gives rise to some "tooltip"
+% display on hover, which displays the description field.
+
+\newcounter{snippet}%[section]
+\stepcounter{snippet}
+\makeatletter
+\newcommand\snippetno{%
+ \ifnum\value{snippet}<10 0\fi\the\value{snippet}%
+%%% emulating former manual mark-up (with reset at each section) but I drop this
+%%% \ifnum\value{snippet}>0 -\@Alph{\numexpr\value{snippet}+\@ne\relax}\fi
+}
+\makeatother
\begin{document}%\layout
\rmfamily
@@ -1103,17 +1219,21 @@ etoc-im-me-di-ate-set-local-top
\fi
\ifnum\tikztreelevel=2
% hard-coded section numbers for branching
+ % il y a un décalage de 3 avec les numéros de sections numérotées
\if1\ifnum\tikznumberofcurrentgrandchild>2
\ifnum\tikznumberofcurrentgrandchild<6 0%
\else
- \ifnum\tikznumberofcurrentgrandchild>21
- \ifnum\tikznumberofcurrentgrandchild<28 0%
+ \ifnum\tikznumberofcurrentgrandchild>20 % était 21 mais
+ % \etocsetlocaltop déplacé
+ \ifnum\tikznumberofcurrentgrandchild<27 0% était 28 mais
+ % \etocsetlocaltop déplacé
\else
- \ifnum\tikznumberofcurrentgrandchild>51
+ \ifnum\tikznumberofcurrentgrandchild>50 % était 51
\ifnum\tikznumberofcurrentgrandchild<58 0%
\fi\fi\fi\fi\fi\fi
1%
-% le "9+" choisi manuellement jusqu'à obtenir quelque chose de bien
+ % ceci correspond aux sections qui seront sur le bord rectangulaire
+ % le "9+" choisi manuellement jusqu'à obtenir quelque chose de bien
\pgfmathsetmacro\tikzoffsetofcurrentchild{(\tikzsiblingdistance)*(7+\tikznumberofcurrentgrandchild
+\tikzdeltaofcurrentgrandchild)}%
\ifdim\tikzoffsetofcurrentchild pt<\tikzlevelheight
@@ -1143,30 +1263,32 @@ etoc-im-me-di-ate-set-local-top
%\fi
\fi\fi\fi\fi
\else
- % NEW BRANCH ADDED AT 1.09f
+ % les sections spéciales pas mises sur bord rectangulaires mais à
+ % distance constante du parent
+ % NEW BRANCH ADDED AT 1.09f
\ifnum\tikznumberofcurrentgrandchild<6
\tikzset{level distance=8cm}% TikZ est tout de même assez génial dans l'interface
\fi
\pgftransformrotate {\ifnum\tikznumberofcurrentgrandchild<6 -12
- \else\ifnum\tikznumberofcurrentgrandchild<28 180
+ \else\ifnum\tikznumberofcurrentgrandchild<27 180
\else0\fi\fi +
\pgfkeysvalueof{/tikz/sibling angle}*\tikznumberofcurrentgrandchild}%
\pgftransformxshift {\the\tikzleveldistance}%
\ifnum\tikznumberofcurrentgrandchild=5
\global\advance\tikzdeltaofcurrentgrandchild by-3
\fi
- \ifnum\tikznumberofcurrentgrandchild=27
+ \ifnum\tikznumberofcurrentgrandchild=26 % était 27 mais déplacement \etoclocaltop
\global\advance\tikzdeltaofcurrentgrandchild by-6
\fi
\ifnum\tikznumberofcurrentgrandchild=57
- \global\advance\tikzdeltaofcurrentgrandchild by-6
+ \global\advance\tikzdeltaofcurrentgrandchild by-7 % était -6
\fi
\fi
\global\advance\tikznumberofcurrentgrandchild by1
\fi
}
-%version circulaire utilisée avec les version 1.08a--1.09e du manuel.
+%version circulaire utilisée avec les versions 1.08a--1.09e du manuel.
% \def\tikzmycustomgrowth {%
% \pgftransformreset
% \ifnum\tikztreelevel=1
@@ -1232,6 +1354,8 @@ etoc-im-me-di-ate-set-local-top
% title page toc
% 1.09f uses a prepend for last part so we need to delay
% start of tree construction in \treetok
+% MEMO: le gap entre fin et début se situe donc entre Errors and Catastrophes
+% et Timestamp, sibling distance doit être ajusté manuellement
\treetok{}
\makeatletter
\etocsettocstyle
@@ -1293,15 +1417,12 @@ etoc-im-me-di-ate-set-local-top
% 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},%
-% % distance par rapport au CENTRE ! (avec le code tel qu'en ce moment)
-% 39 hard coded mais je pourrais aussi le calculer
-%
% 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...)
level 2/.append style={level width=21cm,
level height=30cm,
- sibling distance=2.21cm,% ajusté à la
+ sibling distance=2.22cm,% ajusté à la
% main... dépend de ce qui qu'on conserve par
% les depth tags...
% 1.09f pour essayer certaines parties en circulaire
@@ -1316,7 +1437,7 @@ etoc-im-me-di-ate-set-local-top
}% end of \hbox
\endgroup% fin de la défintion de la mind map pour la page de titre
-\noindent\null
+\noindent\null\par\vskip-5cm\hbox{\hypertarget{FRONTPAGE}{}}\vskip5cm
% On l'envoie au shipout
\AddToShipoutPictureFG*{\put(.5\paperwidth,.5\paperheight)
@@ -1336,29 +1457,57 @@ etoc-im-me-di-ate-set-local-top
{\noindent
\bfseries\Large
\leaders\hrule height1pt\hfill
- \MakeUppercase{Table of Contents}\let\thefootnote\empty
+ TABLE OF CONTENTS\let\thefootnote\empty
\footnote{Documentation (\etocdocdate) generated from the source file
with timestamp ``\etocdtxtimestamp''.}\setcounter{footnote}{0}%
}
\pdfbookmark[1]{Table of contents}{MAINTOC}%
+%\begin{framed}
+\begingroup\footnotesize\itshape
+ Starting with 1.08h, 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
+ \textbf{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.
+At 1.09h the formerly used icon in the text body has been replaced by the
+filename itself, placed in the page margin.
+
+ In some PDF viewers side panels may provide a convenient clickable list of
+ all these \textbf{attachments annotations}.
+
+\endgroup
+%\end{framed}
+% https://helpx.adobe.com/acrobat/using/comments.html
+
+% I move colours mostly used only after stopeventually
+\definecolor{etocnamecolor}{RGB}{228,57,0}
+\colorlet{verbcolor}{Maroon}
+\colorlet{privatecommentcolor}{cyan}
+\colorlet{macrocodecommentcolor}{gray}
+\colorlet{macrocodenewmacrocolor}{verbcolor}
+\colorlet{macrocodelinktouserdoccolor}{etocnamecolor}% and bold face
+\colorlet{macrocodelinktosectioncolor}{DarkBlue}% and bold face
+\colorlet{macrocodelinktocodelinecolor}{DarkBlue}
+\colorlet{macrocodenoncscolor}{Green}
+
+%\ifnum\NoSourceCode=0
\begin{framed}
- Starting with |1.08h|, 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 \emph{file attachement annotations}. Each file is represented
- by an icon after the verbatim rendering of the corresponding code.
- Clicking suitably on the icon will open a dialog to open or save the
- file contents. This is much better than copy-paste which loses
- indentation. There is also in some viewer a \emph{Comment pane} which can
- be opened on the right side of the main window and which provides a
- convenient clickable list of all these \emph{attachments annotations}.
-
- PDF viewers unable to make these attachments accessible to the
- user may replace the clickable icons by some blank space.
+ Throughout the documentation the command names displayed
+ {\textcolor{RoyalBlue}{with this colour}} are doubly hyperlinked: the left
+ half of the name links to the user documentation, the second half links 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
\end{framed}
-% https://helpx.adobe.com/acrobat/using/comments.html
+%\fi
\begingroup
\etocsetlevel{subsection}{3}
@@ -1391,14 +1540,14 @@ etoc-im-me-di-ate-set-local-top
based on a multi-column format, with, optionally, a ruled title or framed
contents.
- The \csa{tableofcontents} command may be used arbitrarily many times%
+ The \toc command may be used arbitrarily many times%
%
-\footnote{Except if \texttt{\string\etockeeporiginaltableofcontents}
- (\textcolor{Green}{\bfseries New with 1.09d}) is issued in the preamble
- after package loading. Then the macro \texttt{\string\etoctableofcontents},
- not \texttt{\string\tableofcontents}, must be used if the \etoc features
- are to apply to the global TOC. This was added to fix a compatiblity issue
- with \texttt{listings}'s \texttt{\string\lstlistoflistings}, as it needs the
+\footnote{\label{etockeeporiginaltableofcontents}%
+ If \csb{etockeeporiginaltableofcontents} is issued in the preamble
+ after package loading, then \toc keeps the non-\etoc meaning and one must
+ use \csb{etoctableofcontents} in its place to get the \etoc features. This
+ was added to fix a compatiblity issue with \ctanpkg{listings}'s
+ \texttt{\string\lstlistoflistings}, as it needs the
\texttt{\string\tableofcontents} macro to keep its original meaning.}
%
and it
@@ -1423,12 +1572,25 @@ etoc-im-me-di-ate-set-local-top
\section{Foreword}
-Popular packages dealing with TOCs include |tocloft|, |titletoc|
-and |minitoc|. Why another one? I started \etoc
+%\ifnum\NoSourceCode=0
+\begin{framed}
+ Throughout the documentation the command names displayed
+ {\textcolor{RoyalBlue}{with this colour}} are doubly hyperlinked: the left
+ half of the name links to the user documentation, the second half links 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
+\end{framed}
+%\fi
+
+Popular packages dealing with TOCs include \ctanpkg{tocloft}, \ctanpkg{titletoc}
+and \ctanpkg{minitoc}. Why another one? I started \etoc
for my own use, and found out only later about these mentioned
packages.
-As is well explained in the |tocloft| package documentation,
+As is well explained in the \ctanpkg{tocloft} package documentation,
the standard \LaTeX{} layout for the Table of Contents is
buried in the class definitions. In particular, most of the
lengths therein are hardcoded, and the only way for the user
@@ -1436,7 +1598,7 @@ to change them is to recopy the class definitions into the
document and then change them to obtain what is desired
(within suitable \csa{makeatletter} and \csa{makeatother}).
The more reasonable alternative is to use a dedicated package such as
-|tocloft| or to use another flexible document class.
+\ctanpkg{tocloft} or to use another flexible document class.
However, although now things are hopefully not hard-coded, one
still has to go through the package or class interface. This
@@ -1452,8 +1614,8 @@ manner: they are made available via the \csb{etocname},
\csb{etocnumber}, and \csb{etocpage} commands.
\etoc appears to be (at least partially) compatible with the
-|article|, |book|, |report|, |scrartcl|, |scrbook|, |scrreprt| and
-|memoir| classes.
+|article|, |book|, |report|, \ctanpkg{scrartcl}, \ctanpkg{scrbook}, \ctanpkg{scrreprt} and
+\ctanpkg{memoir} classes.
\section{License}
@@ -1479,7 +1641,7 @@ manner: they are made available via the \csb{etocname},
Not quite. The simplest way is to use |enumerate| environments,
with the customizing facilities of packages such as
-|enumitem|,\footnote{\url{http://ctan.org/pkg/enumitem}} to
+\ctanpkg{enumitem}, to
display the data fetched by \etoc from the |.toc| file. The data
consists of the \emph{name} (\csb{etocname}), \emph{number}
(\csb{etocnumber}), and \emph{page number} (\csb{etocpage}) as
@@ -1616,7 +1778,7 @@ the second is executed after the TOC contents.
\etoc provides four (customizable) higher level toc styles:
\csb{etocmulticolstyle}, \csb{etoctocstyle},
\csb{etocruledstyle}, and \csb{etocframedstyle}. All use the
-|multicol| package with a default of two columns
+\ctanpkg{multicol} package with a default of two columns
(single-column mode is obtained with the optional argument |[1]|).
These commands must be followed either by \toc or \localtoc.
@@ -1625,18 +1787,25 @@ These commands must be followed either by \toc or \localtoc.
\label{etoctoclines}
\label{etocstandardlines}
-Both for the ``line styles'' and the ``toc display style'', it is
-possible to switch into a compatibility mode which uses the
-defaults from the
-document class.\footnote{for the ``toc display style''
- \etoc checks if it knows the class, and if not defaults to
- the |article| class layout. It will also check if
- \texttt{tocloft} has customized the TOC title.}
-This is activated by:\\
-\makebox[5.2cm][l]{\csb{etocstandardlines}}
- |% `line entries' as without \usepackage{etoc}|\\
-\makebox[5.2cm][l]{\csb{etocstandarddisplaystyle}}
- |% `toc display' as without \usepackage{etoc}|
+Both for the ``line styles'' and the ``toc display style'', \etoc defaults to
+a compatibility mode which uses the defaults from the document
+class.%
+%
+\footnote{\label{fn:compat}for the ``toc display style'' \etoc checks if it knows the class,
+ and then uses emulation code which was added manually to its source, and
+ if not it defaults to the |article| class layout. No automated way to recover
+ the global toc display for arbitrary document classes is implemented. But \etoc
+ will detect if \ctanpkg{tocloft} has customized the TOC title.}
+%
+This can always be re-activated by:\\
+% \makebox[5.2cm][l]{\csb{etocstandardlines}}
+% |% `line entries' as without \usepackage{etoc}|\\
+% \makebox[5.2cm][l]{\csb{etocstandarddisplaystyle}}
+% |% `toc display' as without \usepackage{etoc}|
+\csb{etocstandardlines}\hfill
+|% `line entries' as without \usepackage{etoc}|\\
+\csb{etocstandarddisplaystyle}\hfill
+|% `toc display' as without \usepackage{etoc}|
If the command \csb{etocsetstyle} has \emph{not been used in the
@@ -1644,7 +1813,7 @@ preamble} the package will be at |\begin{document}| in this
compatibility mode: hence just adding \csa{usepackage\{etoc\}}
should hopefully not change anything to the look of a
previously existing document, under the |article|, |book|,
- |report|, |scrartcl|, |scrbook|, |scrreprt| and |memoir|
+ |report|, \ctanpkg{scrartcl}, \ctanpkg{scrbook}, \ctanpkg{scrreprt} and \ctanpkg{memoir}
classes.
Any use of \csb{etocsetstyle} in the \emph{preamble or body} of
@@ -1656,13 +1825,13 @@ preamble} the package will be at |\begin{document}| in this
with the help of \csb{etocsetstyle}, if their scope was not
limited to a group or environment.
- The command \csb{etocdefaultlines} resets the line styles as
+ The command \csb{etocdefaultlines} sets the line styles to custom ones
pre-defined internally by \etoc and described in
\autoref{etocdefaultlines}.
Even if \csb{etocsetstyle} has been used, the global display style
-remains initially as defined by the document class (or the
-|tocloft| package); one needs to use the command
+remains initially as defined by the document class or the
+\ctanpkg{tocloft} package (but see footnote\footref{fn:compat}); one needs to use the command
\csb{etocsettocstyle} or its variants to exit from this
compatibility mode at the ``toc display style'' level. It will be
re-activated if use if made of \csb{etocstandarddisplaystyle}.
@@ -1671,11 +1840,12 @@ See further \autoref{sec:anothercompat}.
\section{A first example}
\label{sec:firstexample}
+\label{invisiblelocaltableofcontents}
Let us present a first example of specification for line styles.
Immediately after the start of \autoref{part:overview} we inserted in the
source file:
-\centeredline{|\invisiblelocaltableofcontents \label{toc:overview}|} This
+\centeredline{\csb{invisiblelocaltableofcontents} |\label{toc:overview}|} This
sets-up the label |toc:overview|, and we can use it at any location in the
document: \centeredline{|\tableofcontents \ref{toc:overview}|} And as we used
|\invisible...|,\footnote{this is a shortcut for setting temporarily the
@@ -1683,7 +1853,7 @@ document: \centeredline{|\tableofcontents \ref{toc:overview}|} And as we used
and not even the heading.} the local TOC will exist only through its clones
elsewhere in the document.
-\begin{filecontentsdef}{etocsnippet-\the\value{section}.tex}{\foo}
+\begin{filecontentsdef}{etocsnippet-\snippetno.tex}{\foo}
\begingroup\parindent 0pt \parfillskip 0pt \leftskip 0cm \rightskip 1cm
\etocsetstyle {section}
{}
@@ -1740,8 +1910,33 @@ which was inspired from what \LaTeX2e's |\@dottedtocline| macro does.
Here is how it was produced:
\filecontentsprint\foo
-\attachfile[description={demo \the\value{section}}]{etocsnippet-\the\value{section}.tex}
-
+% vendredi 18 novembre 2022
+% very strange problem/bug with \marginpar which did not work
+% prior to add \normalmarginpar. Whether or not using any
+% extra text. Unless using \normalmarginpar, the test text HELLO
+% was placed in left not right margin and beyond page borders,
+% one saw only last O. Strange.
+% I do not understand what is happening.
+% > \normalmarginpar=macro:
+% ->\global \@mparbottom \z@ \@reversemarginfalse .
+% l.1753 \show\normalmarginpar
+% ?
+% > 0.0pt.
+% l.1754 \showthe\@mparbottom
+% % 0.0pt
+% The \@mparbottom is already 0pt... but one has strangely
+% > \if@reversemargin=\iftrue.
+% l.1765 \makeatletter\show\if@reversemargin
+% \makeatother
+% ?
+% Why is it currently \iftrue?
+% The strange placement happens whether or not I put some text
+% before using \marginpar.
+% \marginpar
+% {\textattachfile[description={demo \the\value{section}}]{etocsnippet-\the\value{section}.tex}{\textcolor{blue}{HELLO}}}
+%
+%
+\marginattach{}
\section{A second example}
\label{sec:secondexample}
@@ -1753,7 +1948,7 @@ is done via the technique of \emph{depth tags}, described in
layout is a bit like the one of the \hyperref[toc:main]{main document
TOC}, although the line styles are coded very differently.
-\begin{filecontentsdef}{etocsnippet-\the\value{section}.tex}{\foo}
+\begin{filecontentsdef}{etocsnippet-\snippetno.tex}{\foo}
\begingroup
\newcommand*{\DotsAndPage}
{\nobreak\leaders\hbox{\bfseries\normalsize\hbox to .75ex {\hss.\hss}}%
@@ -1808,7 +2003,7 @@ layout is a bit like the one of the \hyperref[toc:main]{main document
The code:
\filecontentsprint\foo
-\attachfile[description={demo \the\value{section}}]{etocsnippet-\the\value{section}.tex}
+\marginattach{}
\section{A Beautiful Thesis example}
@@ -1820,7 +2015,7 @@ sub-sections in an average length memoir. The line style specifications have
some redundancy for clarity, and do not care about what to do at possible page
breaks. Also, they do not worry about potential multi-column use.
-\begin{filecontentsdef}{etocsnippet-\the\value{section}.tex}{\foo}
+\begin{filecontentsdef}{etocsnippet-\snippetno.tex}{\foo}
\begingroup % we start a group to keep the style changes local
\newlength{\tocleftmargin} \setlength{\tocleftmargin}{5cm}
\newlength{\tocrightmargin} \setlength{\tocrightmargin}{1cm}
@@ -1854,7 +2049,7 @@ breaks. Also, they do not worry about potential multi-column use.
\filecontentsexec\foo
\filecontentsprint\foo
-\attachfile[description={demo \the\value{section}}]{etocsnippet-\the\value{section}.tex}
+\marginattach{}
\section{Linked list of the main package commands}
@@ -1872,7 +2067,7 @@ breaks. Also, they do not worry about potential multi-column use.
% Je sépare les macros les plus essentielles pour les mettre en avant
\begin{framed}\multicolsep0pt\relax
- \begin{multicols}{3}\parindent0pt\relax
+ \begin{multicols}{3}\parindent0pt\relax\let\csb\csb
\flushleft
\csb{tableofcontents}\par
(optional \csa{ref} or \csa{label})\par
@@ -1899,7 +2094,7 @@ breaks. Also, they do not worry about potential multi-column use.
%\parshape 1 -1.5cm \dimexpr\linewidth+3cm\relax
%\begin{minipage}{\dimexpr\linewidth+3cm\relax}
-\begin{multicols}{2}\parindent0pt\relax
+\begin{multicols}{2}\parindent0pt\relax\let\csb\csb
\csb{etocaftercontentshook}\par
\csb{etocaftertitlehook}\par
\csb{etocaftertochook}\par
@@ -1916,11 +2111,9 @@ breaks. Also, they do not worry about potential multi-column use.
\csb{etocimmediatedepthtag.toc}\par
\csb{etocimmediatesettocdepth.toc}\par
\csb{etocimmediatetoccontentsline}\par
- \csb{etocimmediatesetlocaltop.toc}\par
\csb{etocinline}\par
\csb{etoclink}\par
\csb{etoclocalframed}\par
- \csb{etoclocaltop}\par
\csb{etoclocalmulticol}\par
\csb{etoclocalruled}\par
\csb{etocmulticolstyle}\par
@@ -1934,7 +2127,6 @@ breaks. Also, they do not worry about potential multi-column use.
\csb{etocruledstyle}\par
\csb{etocruled}\par
\csb{etocsetlevel}\par
- \csb{etocsetlocaltop.toc}\par
\csb{etocsetnexttocdepth}\par
\csb{etocsetstyle}\par
\csb{etocsettagdepth}\par
@@ -1960,7 +2152,7 @@ breaks. Also, they do not worry about potential multi-column use.
\end{multicols}
%\end{minipage}\par
-The above is not an exhaustive list of all the package user commands, although
+The above is not an exhaustive list of all the package user commands. And
for legacy arbitrary reasons some of the more obscure commands are included
here.
@@ -1977,14 +2169,20 @@ here.
\etocstandardlines
\localtableofcontents
-\section{The \toc, \localtoc and \localtocwrdp commands}
+\section{The \csbhyp{tableofcontents}, \csbhyp{localtableofcontents} and
+ \csbhyp{localtableofcontentswithrelativedepths} commands}
\label{tableofcontents}
+\label{etoctableofcontents}
\label{localtableofcontents}
\label{localtableofcontentswithrelativedepth}
-\begin{description}
+\begin{description}\let\csb\csb
\item[\toc] can be used arbitrarily many times in the document. Styling either
- globally the TOC or its individual entries is customizable at any time in the document.
+ globally the TOC or its individual entries is customizable at any time in
+ the document.
+
+ \csb{etoctableofcontents} is a synonym to \etoc's \toc. See
+ footnote\footref{etockeeporiginaltableofcontents} on page \pageref{etockeeporiginaltableofcontents}.
\item[\localtoc] will print local tables of
contents: \emph{i.e.} all sections and sub-units inside a
given chapter, or all subsubsections and lower inside a given
@@ -2038,7 +2236,7 @@ current value of the |tocdepth| counter is obeyed. As an
example the table of contents of
\autoref{part:custom} is in a \hyperref[toc:d]{float} which appears
\vpageref{toc:d}.
-\begin{filecontentsdef}{etocsnippet-\the\value{section}.tex}{\foo}
+\begin{filecontentsdef}{etocsnippet-\snippetno.tex}{\foo}
\begin{figure}[ht!]
\centering
\begingroup
@@ -2055,7 +2253,8 @@ example the table of contents of
\filecontentsexec\foo
We used this: \filecontentsprint\foo
-\attachfile[description={demo \the\value{section}}]{etocsnippet-\the\value{section}.tex} In the above example, not
+\marginattach{}
+In the above example, not
only did we use |\ref{toc:c}| to print here the distant (local) table of
contents which has been labeled |toc:c| but we added a (possibly confusing)
|\label{toc:d}|. This is done for the down-to-earth reason of being able
@@ -2074,7 +2273,7 @@ This original local table of contents is to be found \vpageref{toc:c}.
\label{sec:tocdepth}
The intrinsic levels manipulated by \etoc are numeric: from
-|-2| (which corresponds to |book| in the |memoir| class)
+|-2| (which corresponds to |book| in the \ctanpkg{memoir} class)
down (from the big to the small)
to |5| (|subparagraph|). But the assignment of a numeric level
to a given name can be modified at any time with the command
@@ -2103,7 +2302,7 @@ explained further in \autoref{part:surprising}.
relevance to the \textbf{|tocdepth|} counter in the standard
classes and are recapitulated in this table: \centeredline{
\fbox{\begin{tabular}{rc}
- (|memoir| class) book&-2\\ part&-1\\ chapter&0 \\
+ (\ctanpkg{memoir} class) book&-2\\ part&-1\\ chapter&0 \\
section&1\\ subsection&2 \\
subsubsection&3 \\ paragraph&4 \\ subparagraph& 5
\end{tabular}}}
@@ -2126,6 +2325,7 @@ table of contents of all the paragraphs from the document!
\section{The \csbhyp{etocsettocdepth} and \csbhyp{etocsetnexttocdepth} commands}
\label{etocsettocdepth}
\label{etocsetnexttocdepth}
+\label{invisibletableofcontents}
The |tocdepth| counter has no bearing on what gets written to the |.toc| file;
its action is only on the actual typesetting of the table of
@@ -2144,13 +2344,15 @@ numeric (from |-3| to |5|) or a division name such as |subsection| or
corresponding to a document division).
This does the appropriate |\setcounter{tocdepth}{numeric_level}|.
-As is explained in the next subsection, |tocdepth| is used by |hyperref|, and
+As is explained in the next subsection, |tocdepth| is used by \ctanpkg{hyperref}, and
one must take steps to prevent its changes from influencing the bookmarks, too.
So, \etoc has \csb {etocsetnexttocdepth}\marg{level} whose influence ceases
-immediately after the next table of contents. Thus, |\invisibletableofcontents|
-is essentially |\etocsetnexttocdepth{none}\tableofcontents|.
+immediately after the next table of contents. The package defines
+\csb{invisibletableofcontents}
+essentially as
+\centeredline{\csb{etocsetnexttocdepth}|{none}|\csb{tableofcontents}}
-The simplest course is thus to have after |\begin{document}| and before the
+The simplest organization is probably to have after |\begin{document}| and before the
first |\tableofcontents| a single instance of the \csb{etocsettocdepth}
command, with argument the deepest level (or most commonly used deepest level)
among the tables of contents of the document, and to use locally,
@@ -2181,7 +2383,7 @@ The simplest course is thus to have after |\begin{document}| and before the
When modifying the counter |tocdepth| for the purposes of
multiple uses of \toc or \localtoc, one should be aware that
-package |hyperref| by default takes into account the
+package \ctanpkg{hyperref} by default takes into account the
\emph{current} value of the |tocdepth| counter to decide
whether the |pdf| file will contain a bookmark corresponding
to sectioning commands encountered in the source file. Thus,
@@ -2190,10 +2392,10 @@ value after having temporarily modified it for a given table of
contents.
Or, there is the \emph{bookmarksdepth=n} option of package
-|hyperref|, with \emph{n} the desired document bookmarks
+\ctanpkg{hyperref}, with \emph{n} the desired document bookmarks
maximal depth, which can be numeric or the name of a level known to
-|hyperref|. This documentation previously passed |bookmarksdepth=3| as
-option to |hyperref|, so even if |tocdepth| was left to |1|
+\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
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
@@ -2206,8 +2408,12 @@ systematically and there was no need for |bookmarksdepth=3| anymore.
\label{etocimmediatesettocdepth.toc}
This command \csb{etocsettocdepth.toc} implements some functionality of
-|tocvsec2|\footnote{\url{http://ctan.org/pkg/tocvsec2}. I thank Denis \textsc{Bitouzé} for drawing
- my attention to the incompatibility of this package with \etoc.}, a package
+\ctanpkg{tocvsec2}%
+%
+\footnote{I thank Denis \textsc{Bitouzé} for drawing
+ my attention to the incompatibility of this package with \etoc.},
+%
+a package
which however was incompatible with \etoc (it can still be used for its
|secnumdepth|-related commands, but its |toc|-related activities will get
canceled by \etoc) and more-or-less designed for a single table of contents.
@@ -2273,7 +2479,7 @@ re-activate it. The package does initially \csb{etocobeytoctocdepth}.
% \begin{enumerate*}[label={(\roman*)}]
% \item the second argument to \csb{etocsetlevel} must be numeric,
% \item it can not be set to |-3| (which would be necessary if one wanted to
-% exclude an entire Book from a TOC in a |memoir| document with multiple such
+% exclude an entire Book from a TOC in a \ctanpkg{memoir} document with multiple such
% Books \dots admittedly a possibly rare case!),
% \item it is a bit of a hack as |partIII| is not a real division unit, but just
% a \emph{tag}.
@@ -2463,58 +2669,6 @@ empty, this does mean that \etoc considered the just encountered local table
of contents to be empty (for that run) and thus printed nothing (not even a
|\par|).
-% pas traduit
-\section{The \csbhyp{etoclocaltop} command}
-\label{etoclocaltop}
-
-\textbf{New with 1.09 (2019/03/09)}.
-
-Within either the TOC style
-(\csb{etocsettocstyle}) or the local title styles (\csb{etocsetstyle}), the
-control sequence \csb{etoclocaltop} is made equivalent for the duration of
-\csb{localtableofcontents} to a numeric (self-delimiting) denotation of the
-current top level.
-
-Thus: it will in numeric contexts (|\ifnum|, |\ifcase|, ...) represent zero
-for a local TOC corresponding to chapter, or one if in a section, or two if in
-a subsection, etc..., assuming of course here that the default levels are
-obeyed (see \autoref{sec:tocdepth}).
-
-\begin{framed}
- \csb{etoclocaltop} from inside the TOC heading (first argument of
- \csb{etocsettocstyle}) has the correct value \emph{only under
- \csb{etocchecksemptiness} regime}. Special circumstances correspond to
- some special values:
- \begin{description}[nolistsep]
- \item[|-3|] (|-\thr@@|)\newline
- signals that \etoc considers the local TOC to be
- ``unknown''; this happens at the last local TOC, for the first \LaTeX\ run
- after adding a new \localtoc to the document. In doubt, \etoc assumes the
- TOC will prove non empty, hence it prints (independently of whether the
- check for emptiness was activated or not) the heading as specified by
- \csb{etocsettocstyle}. Thus, check if \csb{etoclocaltop} gives |-3| as a
- a \meta{number} to detect that situation from within the first argument of
- \csb{etocsettocstyle}, if desired.
- \item[|-1000|](|-\@m|)\newline is in case of a \localtoc
- being considered ``known'' (although it may still refer to the data in the
- |.toc| file from the previous run) but without the check for emptiness
- having been executed.
- \item[|-10000|](|-\@M|)\newline is the value when accessed from the title
- of a global TOCs.
- \end{description}
-\end{framed}
-\begin{framed}
- When executed from within a local table of contents \textbf{line styles}
- (\csb{etocsetstyle}), \csb{etoclocaltop} always will hold the correct value,
- whether or not the emptiness check was executed.
-
- For a global table of contents however, it will always keep the value |-3|.
-\end{framed}
-
-Attention! \cs{etoclocaltop} is only to be queried; modifying it is strictly
-forbidden and falls under the most rigorous prosecution allowed by federal
-law.
-
\section{Adding commands to the \texorpdfstring{\texttt{.toc}}{.toc} file}
\label{sec:addingtotoc}
@@ -2541,7 +2695,7 @@ document and to use where needed something like:
\tableofcontents
\let\myclearpage\relax
\end{verbatim}
-The |memoir| class has the command \csa{settocdepth} which
+The \ctanpkg{memoir} class has the command \csa{settocdepth} which
writes a \csa{changetoc\-depth} command inside the |.toc| file.
This will impact the typesetting by \etoc of \emph{all} tables
of contents, with (possibly) unexpected results: imagine the
@@ -2551,9 +2705,9 @@ 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.
-As the |memoir| class by itself allows multiple\toc
+As the \ctanpkg{memoir} class by itself allows multiple\toc
these issues already arise there,
- independently of \etoc, see page 170 of the |memoir|
+ independently of \etoc, see page 170 of the \ctanpkg{memoir}
manual.
For this specific issue, the commands \csb{etocsettocdepth.toc},
@@ -2591,7 +2745,7 @@ I use the following trick: either in the preamble using
I found out experimentally that the option |hidelinks| could
indeed be set many times with |\hypersetup| (this is not the
- case of all |hyperref| options).
+ case of all \ctanpkg{hyperref} options).
\clearpage
@@ -2612,7 +2766,7 @@ and \autoref{part:globalcmds}.
As a further example we now print the local table of contents
of \autoref{part:globalcmds}. First we will test the compatibility mode.\footnote{the
-present document uses the |scrartcl| class, and we check here that
+present document uses the \ctanpkg{scrartcl} class, and we check here that
the \etoc compatibility mode does respect the customizing done via the
class commands.} The original was invisibly defined with a label at the
beginning of \autoref{part:globalcmds}.
@@ -2648,7 +2802,7 @@ Well, there is actually an alternative. It is possible to use the
order to achieve effects like the following, all things being otherwise equal to
the document class defaults:
\begin{enumerate}[noitemsep]
-\item get the |hyperref| link to encapsulate only the names, but not the numbers
+\item get the \ctanpkg{hyperref} link to encapsulate only the names, but not the numbers
of each entry of the table of contents,
\item use the document class style for chapters and sections, but modify it only
for subsections,
@@ -2662,7 +2816,8 @@ automatically in \csb{etocsavedsectiontocline}, \csb{etocsavedchaptertocline}
etc... the meaning of the \LaTeX\ |\l@section|, |\l@chapter|, etc... macros as
they were at the time the TOC is typeset.
-\begin{filecontentshere}{etocsnippet-\the\value{section}-A.tex}
+%\showthe\catcode`\-
+\begin{filecontentshere}{etocsnippet-\snippetno.tex}
\makeatletter
\newcommand{\MyStandardTOC}{%
\begingroup
@@ -2685,7 +2840,8 @@ they were at the time the TOC is typeset.
\endgroup}
\makeatother
\end{filecontentshere}
-\attachfile[description={demo \the\value{section}-A}]{etocsnippet-\the\value{section}-A.tex}
+\marginattach{-A}
+%\showthe\catcode`\-
One can add to the above arbitrary text formatting commands, for example
replace |\etocpage| by |\textcolor{blue}{\etocpage}|.
@@ -2694,16 +2850,16 @@ If the document has only one table of contents then there is no need
to put the commands inside a macro, or even inside a group.\footnote{and if
moreover one just wants to keep the same layout as in the default, one may
question why using \etoc... there is \emph{one} good reason: numbers and names
-are separately \texttt{hyperref} links, whereas normally there is only one link
+are separately \ctanpkg{hyperref} links, whereas normally there is only one link
holding both the number and the name corresponding to one toc entry.} With these
commands
\etoc will construct a TOC completely identical to what would have been done by
-one of the document class: |article|, |book|, |scrartcl|, |scrbook|.\footnote{For the
-|memoir| class, one needed prior to \etoc |1.08k| a bit more: each of the command \csa{booknumberline},
+one of the document class: |article|, |book|, \ctanpkg{scrartcl}, \ctanpkg{scrbook}.\footnote{For the
+\ctanpkg{memoir} class, one needed prior to \etoc |1.08k| a bit more: each of the command \csa{booknumberline},
\csa{partnumberline} and \csa{chapternumberline} had to be saved. They can now
be used directly in the line styles, because their meanings are not modified
anymore by \etoc during its TOC typesetting.}
-The number and the name of each entry are each separately an |hyperref| link, as
+The number and the name of each entry are each separately an \ctanpkg{hyperref} link, as
is always the case with \etoc, when not in compatibility mode. Replacing
\csb{etocnumber} with \csb{etocthenumber} will give a TOC where the numbers are
not links anymore, but the names still are. Or one may decide to use \csb{etocthename}
@@ -2711,13 +2867,13 @@ and keep an hyperlinked number with
\csb{etocnumber}.
Here is a subtler example where one only marginally modifies the
-sections (adding color to the number and removing the |hyperref| link) and keeps
+sections (adding color to the number and removing the \ctanpkg{hyperref} link) and keeps
the subsections as in the default, \emph{except} for those of one specific
section, for which the layout is completely modified:
\MyQuasiStandardTOC{\ref{toc:overview}}
\bigskip
This example only has sections and subsections, and the code used in \csa{MyStandardTOC} was:
-\begin{filecontentshere}{etocsnippet-\the\value{section}-B.tex}
+\begin{filecontentshere}{etocsnippet-\snippetno.tex}
\etocsetstyle{section}{}
{\ifnum\etocthenumber=4
\etocsetstyle{subsection}
@@ -2741,12 +2897,12 @@ This example only has sections and subsections, and the code used in \csa{MyStan
{\etocsavedsectiontocline{\numberline{{\color{cyan}\etocthenumber}}\etocname}{\etocpage}}
{}%
\end{filecontentshere}
-\attachfile[description={demo \the\value{section}-B}]{etocsnippet-\the\value{section}-B.tex}
+\marginattach{-B}
Notice the page head-mark added by this standard TOC. Sections and subsections
are printed exactly as in the default (except for the subsections of one
specific user-chosen section and except for the color of the section numbers),
with no need to specify explicitely any length, font or other formatting
-instructions. But we had to examine the |scrartcl| sources to determine what to
+instructions. But we had to examine the \ctanpkg{scrartcl} sources to determine what to
use for \csa{leftskip} and \csa{rightskip} for our customized section
entries.
@@ -2757,9 +2913,9 @@ As explained in \autoref{subs:compat}: without explicit use of an
hand regarding the ``toc line styles''. It is sometimes asked by users (for
example those using \etoc for its \csb{localtableofcontents}) how to stay
close to but not completely identical with the design implemented by the
-standard classes, such as |book|. I can recommend package |tocloft| for this,
+standard classes, such as |book|. I can recommend package \ctanpkg{tocloft} for this,
as it is compatible with \etoc (see \autoref{subs:tocloft}) and thus \etoc will
-obey the |tocloft| customizations (as long as no use has been made of
+obey the \ctanpkg{tocloft} customizations (as long as no use has been made of
\csb{etocsetstyle}). It is also possible to modify only the style for, say,
sections and leave the parts, chapters, subsections as in the document class,
via the technique from \autoref{sec:anothercompat}.
@@ -2791,7 +2947,7 @@ besides, with the \csa{TOCcomputenumwidths} from
\autoref{sec:thirdexampleextra} these macros will actually hold a dimension
using |pt| as dimensional unit.
-\begin{filecontentshere}{etocsnippet-\the\value{section}-A.tex}
+\begin{filecontentshere}{etocsnippet-\snippetno.tex}
% it will be easy to globally shift the TOC horizontally if needed
\def\TOCleftmargin {0pt}
\def\TOCrightmargin {2.55em}% like LaTeX's \@tocrmarg
@@ -2889,7 +3045,7 @@ using |pt| as dimensional unit.
}
\makeatother
\end{filecontentshere}
-\attachfile[description={demo \the\value{section}-A}]{etocsnippet-\the\value{section}-A.tex}
+\marginattach{-A}
Nota Bene: the code deliberately handles the non-numbered sectioning units
unlike the way of the standard document classes (particularly regarding the
alignment of multi-line headings.)
@@ -2902,7 +3058,7 @@ TOC, or rather before using \localtoc. If one wants a full
TOC at end of document one will naturally have to issue again
\csa{TOCglobalstyle} there.
-\begin{filecontentshere}{etocsnippet-\the\value{section}-B.tex}
+\begin{filecontentshere}{etocsnippet-\snippetno.tex}
\makeatletter
\newcommand*\TOClocalstyle {%
\etocsettocstyle
@@ -2949,7 +3105,7 @@ TOC at end of document one will naturally have to issue again
}% end of \TOClocalstyle
\makeatother
\end{filecontentshere}
-\attachfile[description={demo \the\value{section}-B}]{etocsnippet-\the\value{section}-B.tex}
+\marginattach{-B}
As mentioned previously, this handles non-numbered (multi-line) sectioning
units somewhat differently from what happens in the standard document classes.
@@ -2974,7 +3130,7 @@ line styles and some colors added (it has been put in a float which appears
% environment. This bug has nothing to do with \etoc.}
% RETIRÉ le 28 avril 2015 pour 1.08f
-\begin{filecontentshere}{etocsnippet-\the\value{section}-A.tex}
+\begin{filecontentshere}{etocsnippet-\snippetno.tex}
\etocdefaultlines
\begingroup
\renewcommand{\etoccolumnsep}{2em}
@@ -3007,7 +3163,7 @@ line styles and some colors added (it has been put in a float which appears
\end{figure}
\endgroup
\end{filecontentshere}
-\attachfile[description={demo \the\value{section}-A}]{etocsnippet-\the\value{section}-A.tex}
+\marginattach{-A}
\filecontentsexec\filecontentsheremacro
@@ -3060,7 +3216,7 @@ code is used also for \hyperref[toc:clone]{this other toc}.
% attention car \ref{toc:floating} fera référence au compteur de
% toutes les toc, pas visibletoc.
-\begin{filecontentshere}{etocsnippet-\the\value{section}.tex}
+\begin{filecontentshere}{etocsnippet-\snippetno.tex}
\begin{figure}[htbp!]\centering
\colorlet{subsecnum}{black}
\colorlet{secbackground}{green!30}
@@ -3138,7 +3294,7 @@ code is used also for \hyperref[toc:clone]{this other toc}.
(\emph{cf.} \hyperref[toc:clone]{this other toc})}
\end{figure}
\end{filecontentshere}
-\attachfile[description={demo \the\value{section}}]{etocsnippet-\the\value{section}.tex}
+\marginattach{}
\filecontentsexec\filecontentsheremacro
@@ -3161,7 +3317,7 @@ many matters do not seem to be widely shared).
%%%% dvipdfmx does not know how to handle completely. Apart from that the output
%%%% is ok, thus no need to try seriously to avoid them.
-\begin{filecontentsdef}{etocsnippet-\the\value{section}.tex}{\foo}
+\begin{filecontentsdef}{etocsnippet-\snippetno.tex}{\foo}
\begingroup
\newsavebox{\forsubsections}
\etocsetstyle{part}{\upshape. \etocskipfirstprefix}
@@ -3191,7 +3347,7 @@ many matters do not seem to be widely shared).
The code used:
\filecontentsprint\foo
-\attachfile[description={demo \the\value{section}}]{etocsnippet-\the\value{section}.tex}
+\marginattach{}
\clearpage
@@ -3264,10 +3420,10 @@ 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 |hyperref| package,
+ 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 |hyperref| that the bookmark level is `unknown').\footnote{%
+ of \ctanpkg{hyperref} that the bookmark level is `unknown').\footnote{%
The package provides a starred variant
\staritb{etoctoccontentsline}, which does allow the creation
of bookmarks and has a third mandatory argument which is the
@@ -3296,7 +3452,7 @@ it here we just wrote:\par\smallskip
Here are the implementation details:
\begingroup
-\begin{filecontentshere}{etocsnippet-\the\value{section}.tex}
+\begin{filecontentshere}{etocsnippet-\snippetno.tex}
< in the preamble >
\newcounter{visibletoc}
\renewcommand{\etocaftertitlehook}
@@ -3319,7 +3475,7 @@ Here is the numbered and linked list of all tables of contents which are
displayed within this document: \tableofcontents.
\endgroup
\end{filecontentshere}
-\attachfile[description={demo \the\value{section}}]{etocsnippet-\the\value{section}.tex}
+\marginattach{}
\endgroup
After |\etocsetstyle{visibletoc}{..}{..}{..}{..}|, all future TOCs (not in
@@ -3363,8 +3519,8 @@ the exercise number would then have been available via \csb{etocnumber}, and
\csb{etocname} would have been empty. It doesn't matter which one of the two
methods is used. The \etoc command \csb{etoctoccontentsline}|{..}{..}| is
provided as a substitute to \csa{addcon\-tentsline}|{toc}{..}{..}|: this is to
-avoid the patching which is done by |hyperref| to \csa{addcontentsline} in its
-process of creation of bookmarks. If one wants to authorize |hyperref| to create
+avoid the patching which is done by \ctanpkg{hyperref} to \csa{addcontentsline} in its
+process of creation of bookmarks. If one wants to authorize \ctanpkg{hyperref} to create
bookmarks at a specific level \meta{n}, one can use (here with \meta{n}$=$|2|)
the starred variant \starit{etoctoccontentsline} which has an additional
argument:
@@ -3375,12 +3531,12 @@ argument:
The counter |exerci| is already
incremented by the |exerci| theorem environment, and
provides the correct destination for the link added by package
-|hyperref|. The command \csa{exercisetotoc} adds for each exercise a line
+\ctanpkg{hyperref}. The command \csa{exercisetotoc} adds for each exercise a line
to the |.toc| file, corresponding to a fictitious document
unit with name `|exercise|'. A
four-column list, including the sections, can then be
typeset with the following code:
-\begin{filecontentshere}{etocsnippet-\the\value{section}.tex}
+\begin{filecontentshere}{etocsnippet-\snippetno.tex}
\etocsetnexttocdepth{2} % sections are at level 1 and will show up
\begingroup
\etocsetlevel{exercise}{2} % but:
@@ -3398,7 +3554,7 @@ typeset with the following code:
\tableofcontents
\endgroup
\end{filecontentshere}
-\attachfile[description={demo \the\value{section}}]{etocsnippet-\the\value{section}.tex}
+\marginattach{}
A related command \csb{etocimmediatetoccontentsline} (and its starred version)
is also provided. For discussion and the meaning of ``immediate'', refer to
@@ -3406,8 +3562,8 @@ the analogous case of \csb{etocimmediatedepthtag.toc}.
\section{The TOC as a tree}\label{tocastree}
-Using |tikz|\footnote{\url{http://ctan.org/pkg/pgf}} and the package
-|forest|\footnote{\url{http://ctan.org/pkg/forest}} we shall display the table
+Using \ctanpkg{tikz} and the package
+\ctanpkg{forest} we shall display the table
of contents of this part as a tree. The technique is to
use the \etoc modified command \toc not for typesetting, but to
prepare a macro, or rather here a \emph{token list} variable, with all the
@@ -3422,7 +3578,7 @@ commands in \csa{treetok} would be of no use: to which number or name would they
then refer to, in a delayed execution?
We need to store, not the macro names, but the macro contents. And also we wish
-to maintain the correct |hyperref| hyperlinks.\footnote{This manual up to the
+to maintain the correct \ctanpkg{hyperref} hyperlinks.\footnote{This manual up to the
version of May 14, 2013 used package |tikz-qtree| but there were problems with
hyperlinks. No such problem arises either when using |forest| or the native
|tikz| syntax for trees (which will be illustrated in the next section).} The
@@ -3464,7 +3620,7 @@ which will be given the contents of |\treetok|.
\let\appendtotok\relax
-\begin{filecontentsdef}{etocsnippet-\the\value{section}.tex}{\foo}
+\begin{filecontentsdef}{etocsnippet-\snippetno.tex}{\foo}
% \newtoks\treetok % put this (uncommented) preferably in the preamble
% \newtoks\tmptok % (idem)
@@ -3530,7 +3686,7 @@ The resulting tree has been put in a \hyperref[toc:forest]{float}, which
appears \vpageref[above]{toc:forest}. Here is the
code used for its production:
\filecontentsprint\foo
-\attachfile[description={demo \the\value{section}}]{etocsnippet-\the\value{section}.tex}
+\marginattach{}
Why |\hypersetup{hidelinks}|? as explained in
\autoref{ssec:hidelinks}, I prefer the links in TOCs not to be
colorized, nor framed, so this document inserts a command
@@ -3543,7 +3699,7 @@ originating in
|\etocthelinkedname|, etc\dots{} will be executed in the normal
environment for links (which, in this document, is to colorize
them). Rather than having \etoc's code try to guess what the current ``style''
-for links is (a concept not really provided by |hyperref| it
+for links is (a concept not really provided by \ctanpkg{hyperref} it
seems) and store it in |\etocthelinkedname|, etc\dots, I opted for
the simpler solution to leave it up to the user to recreate
whatever conditions are desired. So here it is necessary to re-issue
@@ -3581,7 +3737,7 @@ contents of this (or another) document part, only a \csa{sectiontok} and a
\csa{subsectiontok} will be needed.
-\begin{filecontentshere}{etocsnippet-\the\value{section}.tex}
+\begin{filecontentshere}{etocsnippet-\snippetno.tex}
% \newtoks\treetok % put this (uncommented) preferably in the preamble
% \newtoks\sectiontok
% \newtoks\subsectiontok
@@ -3627,7 +3783,7 @@ contents of this (or another) document part, only a \csa{sectiontok} and a
\end{tikzpicture}
\end{figure}
\end{filecontentshere}
-\attachfile[description={demo \the\value{section}}]{etocsnippet-\the\value{section}.tex}
+\marginattach{}
\filecontentsexec\filecontentsheremacro
@@ -3709,7 +3865,7 @@ example was motivated on |2015/03/11| by
\let\appendtotok\relax
\expandafter\let\csname c@partco\endcsname\relax
-\begin{filecontentsdef}{etocsnippet-\the\value{section}.tex}{\foo}
+\begin{filecontentsdef}{etocsnippet-\snippetno.tex}{\foo}
\begingroup
% \newtoks\treetok % done in preamble
% \newtoks\parttok
@@ -3836,7 +3992,7 @@ example I excluded some sections from the display, using the technique of the
appears \vpageref{toc:mindmap}.
\filecontentsprint\foo
-\attachfile[description={demo \the\value{section}}]{etocsnippet-\the\value{section}.tex}
+\marginattach{}
An interesting alternative is to use \etoc rather to convert the entire TOC
into a TikZ tree (perhaps excluding some parts) and print it out to a file
from which it can be recovered and manipulated directly by the author of the
@@ -3856,7 +4012,7 @@ suitable tikz picture. See also
for an elaboration of this.
-\section{The TOC as a table}
+\section{The TOC as a (long) table}
\label{sec:tocastable}
With release |1.08| it is easier to typeset a TOC as a table. It is
@@ -3885,7 +4041,7 @@ conditions and a few caveats:
Here is an example of a TOC as a |longtable| (yes this is only \emph{one} table),
as is possible relatively simply now with |1.08|. The code follows.
-\begin{filecontentsdef}{etocsnippet-\the\value{section}-A.tex}{\foo}
+\begin{filecontentsdef}{etocsnippet-\snippetno.tex}{\foo}
\begingroup
\etocglobaldefs % necessary for \etocname etc... to survive &
\makeatletter
@@ -3951,7 +4107,7 @@ as is possible relatively simply now with |1.08|. The code follows.
\filecontentsexec\foo
\filecontentsprint\foo
-\attachfile[description={demo \the\value{section}-A}]{etocsnippet-\the\value{section}-A.tex}
+\marginattach{-A}
Examining the code above the reader will wonder why the |\\| are
always given first in \meta{prefix+contents} and not, as is more
intuitive, rather last. In some favorable cases (but almost never
@@ -3996,7 +4152,7 @@ For the hardliner's old way see \autoref{ssec:tocastableold}.
Here is also a much simpler example. It is a local table of
contents.
-\begin{filecontentsdef}{etocsnippet-\the\value{section}-B.tex}{\foo}
+\begin{filecontentsdef}{etocsnippet-\snippetno.tex}{\foo}
\begin{center}
\etocsetstyle{section}
{}
@@ -4021,7 +4177,7 @@ contents.
\filecontentsexec\foo
\filecontentsprint\foo
-\attachfile[description={demo \the\value{section}-B}]{etocsnippet-\the\value{section}-B.tex}
+\marginattach{-B}
\section{A TOC self-adjusting widths for its typesetting}
\label{sec:thirdexampleextra}
@@ -4029,7 +4185,7 @@ contents.
This is a continuation of \autoref{sec:thirdexample}. The goal is to adjust
automatically the ``numwidths'' used for typesetting the unit numbers in the
(local) tables of contents.
-\begin{filecontentshere}{etocsnippet-\the\value{section}.tex}
+\begin{filecontentshere}{etocsnippet-\snippetno.tex}
\makeatletter
\newcommand*\TOCcompute@numwidths [2]{% #1=empty/"local", #2=minimal indent
\begingroup
@@ -4084,7 +4240,7 @@ automatically the ``numwidths'' used for typesetting the unit numbers in the
}%
\makeatother
\end{filecontentshere}
-\attachfile[description={demo \the\value{section}}]{etocsnippet-\the\value{section}.tex}
+\marginattach{}
The optional parameter to \csa{TOCcomputenumwidths} specifies the minimal
indent. In case nothing is numbered you may wish a higher value than |0.5em|.
For each local table of contents to have its own width computations, the macro
@@ -4102,7 +4258,7 @@ Notes:
simultaneously compute the numwidths and then typeset the (local) table of
contents.
\item if you want to adjust the |tocdepth| recall from
- \autoref{ssec:bookmarksdepth} that it influences |hyperref| hence you may
+ \autoref{ssec:bookmarksdepth} that it influences \ctanpkg{hyperref} hence you may
need to use a group |\begingroup...\endgroup|. Or, one can use
\csb{etocsetnexttocdepth}\marg{level} but (with the code as here) this must
then be issued twice, once for \csa{TOCcomputelocalnumwidths}, once for
@@ -4131,7 +4287,7 @@ Notes:
% with xcolor, as xcolor modifies \fbox
% (try \section{\fbox{A}} with and without xcolor). The fix
% was to \protect the \fbox used in the |enumitem| label.
-% Strangely enough, with |hyperref| active, the problem did
+% Strangely enough, with \ctanpkg{hyperref} active, the problem did
% not show up. Anyhow I now use \fcolorbox rather than \fbox
% and there is no problem anymore. Also I don't have now to
% use \normalcolor which already needed protection.
@@ -4184,7 +4340,7 @@ obtained in the following manner:%
\csa{rmfamily} instead.}
\begingroup\small
-\begin{filecontentshere}{etocsnippet-\the\value{section}.tex}
+\begin{filecontentshere}{etocsnippet-\snippetno.tex}
\etocsetstyle{section}
{\begin{enumerate}}
{\normalsize\bfseries\rmfamily\item}
@@ -4204,7 +4360,7 @@ obtained in the following manner:%
{\etocname}
{.\hfil\par\endgroup\pagebreak[3]}
\end{filecontentshere}
-\attachfile[description={demo \the\value{section}}]{etocsnippet-\the\value{section}.tex}
+\marginattach{}
\endgroup
These provisory style definitions rely on the automatic
@@ -4225,13 +4381,13 @@ where no provision is made for them and added the definitive:
\end{verbatim}
This is also the situation with the default package line styles!
-Each \csb{etocsetstyle} command has five mandatory arguments:\\
-\hbox to \linewidth
-{\hfil\csb{etocsetstyle}\color{blue}\marg{levelname}%
- \marg{start}\marg{prefix}\marg{contents}\marg{finish}\hfil}
+Each \csb{etocsetstyle} command has five mandatory arguments:
+\centeredline
+{\csb{etocsetstyle}\color{blue}\marg{levelname}%
+ \marg{start}\marg{prefix}\marg{contents}\marg{finish}}
The initially recognized \meta{levelname}'s are the sectioning
levels of the standard document classes: from \emph{part} (or
-\emph{book} which is used by the |memoir| class) down to
+\emph{book} which is used by the \ctanpkg{memoir} class) down to
\emph{subparagraph}.
The \meta{start} code is executed when a toc entry of that level is
@@ -4244,10 +4400,10 @@ typeset by executing first the \meta{prefix} code and then the
The (robust) commands \csb{etocname}, \csb{etocnumber} and \csb{etocpage} are
provided for use inside the \meta{prefix} and \meta{contents} parts of the
\csb{etocsetstyle} specification. They represent of course, the name, number,
-and page number of the corresponding toc entry. If package |hyperref| is
+and page number of the corresponding toc entry. If package \ctanpkg{hyperref} is
active in the document and has added hyperlinks to the TOC data, then these
links are kept in the commands \csb{etocname}, \csb{etocnumber} and
-\csb{etocpage} (this last one will have a link only if |hyperref| was passed
+\csb{etocpage} (this last one will have a link only if \ctanpkg{hyperref} was passed
option \emph{linktoc=all}.)%
%
\footnote{In case of \emph{linktoc=page}, only \csb{etocpage} is an hyperlink;
@@ -4306,7 +4462,7 @@ an unnumbered section (which ended up in the table of
contents via an \csa{addcontentsline} command).\footnote{as
seen we use \csa{fcolorbox} rather than \csa{fbox}. Due
to some redefinition made by package |xcolor|, had we used
- \csa{fbox} (and not used |hyperref|) we would have needed
+ \csa{fbox} (and not used \ctanpkg{hyperref}) we would have needed
\csa{protect}\csa{fbox}.}
The \csb{etocifnumbered}\marg{A}\marg{B} command executes
@@ -4346,7 +4502,7 @@ The command \csb{etocifnumbered} is robust; \csb{etocxifnumbered}
It is sometimes desirable to have access to the name, number and page
number without the hyperref link data: something similar to the starred
-variant of the \csa{ref} command, when package |hyperref| is used. For
+variant of the \csa{ref} command, when package \ctanpkg{hyperref} is used. For
example one may wish to use the unit or page number in some kind of
numeric context, or change its formatting. This is provided by
\csb{etocthename}, \csb{etocthenumber}, and \csb{etocthepage}.
@@ -4360,14 +4516,14 @@ preceded by |\protect|.
The command \csb{etoclink}\marg{text} can be used in the line style
specifications in a manner analogous to \csb{etocname}, \csb{etocnumber} and
-\csb{etocpage}. It creates a link (if such a link was added by |hyperref| to
+\csb{etocpage}. It creates a link (if such a link was added by \ctanpkg{hyperref} to
the |.toc| file entry) whose target is the corresponding document unit and
whose name is the given \meta{text} mandatory argument.
-Hence |\etoclink{\etocthename}| is under default conditions of |hyperref| like
+Hence |\etoclink{\etocthename}| is under default conditions of \ctanpkg{hyperref} like
the original |\etocname|, because the latter is already hyperlinked. Under
\emph{linktoc=page} context |\etoclink{\etocthename}| adds the hyperlink which
-is missing from \csb{etocname}. Similarly under the default |hyperref|
+is missing from \csb{etocname}. Similarly under the default \ctanpkg{hyperref}
condition (\emph{linktoc=section}) \csb{etocpage} is not an hyperlink, but one
can use |\etoclink{\etocthepage}|.
@@ -4381,21 +4537,43 @@ The command \csb{etoclink} is robust. Since |etoc 1.08j| it contains the link
destination in an already expanded form, so for example can be used even after
a |&| in a tabular construction, if \csb{etocglobaldefs} was issued.
-\section{The \csbhyp{etocthelinkedname}, \csbhyp{etocthelinkednumber},
-\csbhyp{etocthelinkedpage} and \csbhyp{etocthelink} commands}
+
+% Sadly the [] syntax influences both the header and the entry in the TOC
+% Which is clearly a design limitation of LaTeX.
+% Ah! I see it seems KOMA has a way out there is \scr@osectarg
+% I had to dig a bit into scrartcl.cls and then make a divination
+% of where to look in the pdf, once I had gone through the barrier
+% of the html opener (why? as the documentation is not in html format!)
+
+% Another special feature of KOMA-Script is the handling of the optional
+% argument of the sectioning commands \part, \chapter, etc. down to
+% \subparagraph. You can change its function and meaning with the options
+% headings=optiontohead, headings=optiontotoc and headings=optiontoheadandtoc.
+
+% Mais j'ai déjà utilisé parfois le [] pour vraiment impacter la toc
+% Donc je dois faire manuellement
+\makeatletter\scr@activate@xsection{1}\makeatother
+% [] goes to head but {} to toc
+
+% What would really be useful is an option for the length of {} to be measured
+% and opt for [] only if does not fit on one header line
+\section[The \csbhyp{etocthelinkedname} et al.\protect\@{} commands]
+ {The \csbhyp{etocthelinkedname}, \csbhyp{etocthelinkednumber},
+ \csbhyp{etocthelinkedpage} and \csbhyp{etocthelink} commands}
\label{etocthelinkedname}
\label{etocthelinkednumber}
\label{etocthelinkedpage}
\label{etocthelink}
+\makeatletter\scr@activate@xsection{0}\makeatother
These macros are fragile and contain the link destination in already expanded
form. So their meaning can be stored for delayed usage. For example this is
done here when doing the \hyperref[tocastree]{examples with trees}.
Notice though that \csb{etocthelinkednumber} and \csb{etocthelinkedname} are
-hyperlinks only if |hyperref| was configured to let the heading name be
-linked (this is the default). So under |hyperref| option \emph{linktoc=page},
+hyperlinks only if \ctanpkg{hyperref} was configured to let the heading name be
+linked (this is the default). So under \ctanpkg{hyperref} option \emph{linktoc=page},
both \csb{etocthelinkednumber} and \csb{etocthelinkedname} are no different
from respectively \csb{etocthenumber} and \csb{etocthename}.
@@ -4420,7 +4598,7 @@ Obsolete example of \begingroup
{\end{itemize*}.}%
\etocsetnexttocdepth {section}%
\etocsettocstyle {a table of contents done as an inline
- \texttt{enumitem} environment: }{}%
+ \ctanpkg{enumitem} environment: }{}%
\etocinline\tableofcontents \ref{toc:globalcmds}
\endgroup
@@ -4449,7 +4627,7 @@ anymore here for \csb{etocthelinkedname}, as \csb{etocname} works.
Example of
\begingroup\etocglobaldefs % <-- NEW mit etoc 1.08.
\etocsetstyle {section}
- {\begin{itemize*}[itemjoin={{; }}, itemjoin*={{, und }}]}
+ {\begin{itemize*}[itemjoin={{; }}, itemjoin*={{, and }}]}
{}
{\item [{\bfseries\etocnumber.}] \etocname\ (\emph{p. \etocpage })}
{\end{itemize*}.}%
@@ -4462,14 +4640,14 @@ Example of
Example of
\begingroup\etocglobaldefs % <-- NEW mit etoc 1.08.
\etocsetstyle {section}
- {\begin{itemize*}[itemjoin={{; }}, itemjoin*={{, und }}]}
+ {\begin{itemize*}[itemjoin={{; }}, itemjoin*={{, and }}]}
{}
{\item [{\bfseries\etocnumber.}]
\etocname\ (\emph{p. \etocpage })}
{\end{itemize*}.}%
\etocsetnexttocdepth {section}%
\etocsettocstyle {a table of contents done as an inline
- \texttt{enumitem} environment: }{}%
+ \ctanpkg{enumitem} environment: }{}%
\etocinline\tableofcontents \ref{toc:globalcmds}
\endgroup
@@ -4532,7 +4710,7 @@ These level assignments can be modified at anytime: see
technique. As one
further example, let's mention here that the \hyperref[toc:main]{main table of
contents} of this document was typeset following these instructions:
-\begin{filecontentshere}{etocsnippet-\the\value{section}.tex}
+\begin{filecontentshere}{etocsnippet-\snippetno.tex}
\etocsettocdepth {subsubsection} % set the initial tocdepth
\etocdefaultlines % use the package default line styles. At this early stage in
% the document they had not yet been modified by \etocsetstyle
@@ -4549,7 +4727,7 @@ contents} of this document was typeset following these instructions:
\tableofcontents \label{toc:main}
\endgroup
\end{filecontentshere}
-\attachfile[description={demo \the\value{section}}]{etocsnippet-\the\value{section}.tex}
+\marginattach{}
In this way, the subsections used the style originally designed for
subsubsections, the subsubsections were not printed. Without this modification,
the appearance would have been very different: the package line styles were
@@ -4582,7 +4760,7 @@ Let us switch to the color red, and also add this command to the |.toc| file:
\subsection{This is a (pale) red subsection for illustrative purposes}
-Actually, this title here was printed black, due to the way the |scrartcl| class
+Actually, this title here was printed black, due to the way the \ctanpkg{scrartcl} class
works (it would have been red in the |article| class), but we are more
interested in how it looks in the tables of contents: it does appear red in the
\hyperref[toc:main]{main table of contents} at the beginning of
@@ -4618,7 +4796,7 @@ file.
\addtocontents{toc}{\string\normalcolor}
Back to black. Note that this scope problem arises in real life in a
-multi-lingual document, as the |babel| package writes to the |.toc| file the
+multi-lingual document, as the \ctanpkg{babel} package writes to the |.toc| file the
language changes occurring in the document.
@@ -4654,8 +4832,7 @@ shortcuts: \etocruled[1]{Title} (or \etoclocalruled[1]{Title})
\label{etocsettocstyle}
This is a command with two mandatory arguments:\\
-\centerline{\csb{etocsettocstyle}\marg{before\_toc}%
-\marg{after\_toc}}
+\centeredline{\csb{etocsettocstyle}\marg{before\_toc}\marg{after\_toc}}
The \marg{before\_toc} part is responsible for typesetting the
heading, for example it can be something like
\starit{section}|{\contentsname}|.
@@ -4706,9 +4883,9 @@ The commands to be described next \csb{etocmulticolstyle},
\label{etocmulticol}
\label{etoclocalmulticol}
-This is a command with one optional and one mandatory argument:\\
-\centerline{\csb{etocmulticolstyle}%
- \oarg{number\_of\_columns}\marg{heading}} The
+This is a command with one optional and one mandatory argument:
+\centeredline{\csb{etocmulticolstyle}\oarg{number\_of\_columns}\marg{heading}}
+The
\meta{number\_of\_columns} can go from 1 to 10 (it defaults to 2; if its
value is 1, naturally no |multicols| environment is then created). The
\meta{heading} will typically be some `vertical' material like:
@@ -4726,8 +4903,8 @@ configured:
After \csb{etocmulticolstyle} all future \csa{tableofcontents} will use the
specified style, if it does not get changed in-between. A shortcut for
just one table of contents and
-no impact on the styles of later TOCs is:\\
-\centerline{\csb{etocmulticol}\oarg{number\_of\_columns}\marg{heading}}
+no impact on the styles of later TOCs is:
+\centeredline{\csb{etocmulticol}\oarg{number\_of\_columns}\marg{heading}}
And there is also
\csb{etoclocalmulticol}\oarg{number\_of\_columns}\marg{heading}.
@@ -4767,7 +4944,7 @@ which does not uppercase.
\label{etoclocalruled}
The general format of \csb{etocruledstyle} is:\\
-\centerline{\csb{etocruledstyle}%
+\centeredline{\csb{etocruledstyle}%
\oarg{number of columns}\marg{title of the toc}}
\noindent
The title is horizontal material (the |LR| mode of
@@ -4787,10 +4964,10 @@ the \hyperref[toc:a]{start of the second part of this
As a shortcut to set the style with \csb{etocruledstyle} and
then issue a
-\csa{tableofcontents}, all inside a group
+\toc, all inside a group
so that future table of contents will not be
-affected, there is:\\
-\centerline{\csb{etocruled}\oarg{number\_of\_columns}\marg{title}}
+affected, there is:
+\centeredline{\csb{etocruled}\oarg{number\_of\_columns}\marg{title}}
And the local form will be \csb{etoclocalruled}.
\subsection{The commands \csbhyp{etocframedstyle}, \csbhyp{etocframed}, and \csbhyp{etoclocalframed}}
@@ -4798,11 +4975,11 @@ And the local form will be \csb{etoclocalruled}.
\label{etocframed}
\label{etoclocalframed}
-Same mechanism:\\
-\centerline{\csb{etocframedstyle}%
+Same mechanism:
+\centeredline{\csb{etocframedstyle}%
\oarg{number\_of\_columns}\marg{title}}
-and the accompanying shortcut:\\
-\centerline{\csb{etocframed}\oarg{number\_of\_columns}\marg{title}} The
+and the accompanying shortcut:
+\centeredline{\csb{etocframed}\oarg{number\_of\_columns}\marg{title}} The
shortcut is used if one does not want to modify the style of the next
TOCs (the other way is to put the whole thing inside braces or a
|\begingroup...\endgroup|; there is also \csb{etoclocalframed} for a
@@ -4818,9 +4995,9 @@ border are specified via suitable |\renewcommand|'s (see
A |minipage| is used, hence the produced table of contents isn't
compatible with a page break. For allowing page breaks, use of
the commands of
-\href{http://ctan.org/pkg/mdframed}{mdframed}\footnote{\url{http://ctan.org/pkg/mdframed}}
+\ctanpkg{mdframed}
or
-\href{http://ctan.org/pkg/tcolorbox}{tcolorbox}\footnote{\url{http://ctan.org/pkg/tcolorbox}}
+\ctanpkg{tcolorbox}
in the arguments of \csb{etocsettocstyle}
is recommended.
@@ -4878,6 +5055,8 @@ class should be obeyed, too.
\subsubsection{The commands \csbhyp{etocarticlestyle}, \csbhyp{etocbookstyle},
\dots}
+\label{etocarticlestyle}
+\label{etocbookstyle}
These are the commands used internally by \etoc in compatibility mode
depending on the document class. For example \csb{etocarticlestyle} instructs
@@ -4927,14 +5106,15 @@ document.
The first line tells essentially to use |\section*{\contentsname}|, and the
second line says to insert the title in the |.toc| file itself (thus to be
-displayed by the main table of contents). Notice that |hyperref| package will
+displayed by the main table of contents). Notice that \ctanpkg{hyperref} package will
then automatically create suitable anchor and one should \emph{not} use
explicitly \cs{phantomsection} here (it would let the anchor be located below
not above the title).
-With this set-up issuing \localtoc|*| will ignore the \csb{etocaftertitlehook}
+% problème avec \xspace
+With this set-up issuing \localtoc\unskip|*| will ignore the \csb{etocaftertitlehook}
hence not send the local toc title to the |.toc| file. This mimicks the
-|memoir| class behavior, and can also be used with it. For more on |memoir|
+\ctanpkg{memoir} class behavior, and can also be used with it. For more on \ctanpkg{memoir}
class with \etoc, see \autoref{ssec:memoir}.
There are further hook macros:
@@ -5045,7 +5225,9 @@ can be followed with optional labels or references:\par
\medskip
-New with |1.08e|: \localtoc \csa{ref}|{toc:far}| as synonym for \toc
+%New with |1.08e|:
+
+\localtoc \csa{ref}|{toc:far}| acts the same as \toc
\csa{ref}|{toc:far}|.
% (obsolète depuis 1.08e)
@@ -5102,7 +5284,7 @@ medium series; we modify the \csb{etocfontone} command for that. Also we use dot
leaders which are less spread out than in the package default.
-\begin{filecontentshere}{etocsnippet-\the\value{section}.tex}
+\begin{filecontentshere}{etocsnippet-\snippetno.tex}
\etocruledstyle[2]{\normalfont\normalsize\rmfamily\itshape
\fbox{\parbox{.6\linewidth}{
\leftskip 0pt plus .5fil
@@ -5123,13 +5305,40 @@ leaders which are less spread out than in the package default.
\tableofcontents
\endgroup
\end{filecontentshere}
-\attachfile[description={demo \the\value{section}}]{etocsnippet-\the\value{section}.tex}
+\marginattach{}
\filecontentsexec\filecontentsheremacro
\section{Customizing \etoc}
\subsection{Customizing the \etoc pre-defined line styles}
+\label{etocfontminustwo}
+\label{etocfontminusone}
+\label{etocfontzero}
+\label{etocfontone}
+\label{etocfonttwo}
+\label{etocfontthree}
+\label{etocsepminustwo}
+\label{etocsepminusone}
+\label{etocsepzero}
+\label{etocsepone}
+\label{etocseptwo}
+\label{etocsepthree}
+\label{etocminustwoleftmargin}
+\label{etocminustworightmargin}
+\label{etocminusoneleftmargin}
+\label{etocminusonerightmargin}
+\label{etocbaselinespreadminustwo}
+\label{etocbaselinespreadminusone}
+\label{etocbaselinespreadzero}
+\label{etocbaselinespreadone}
+\label{etocbaselinespreadtwo}
+\label{etocbaselinespreadthree}
+\label{etoctoclineleaders}
+\label{etocabbrevpagename}
+\label{etocpartname}
+\label{etocbookname}
+
We will simply list the relevant commands as defined in the
package. Customizing them goes through suitable
@@ -5176,7 +5385,7 @@ within \etoc. As already explained, when
itself very discrete and acts only at the global level, and
the TOC entries are (hopefully) formatted as would have
happened in the absence of \etoc.\footnote{with the
- KOMA-script classes, we noticed that
+ \ctanpkg{KOMA-script} classes, we noticed that
\csb{etocstandarddisplaystyle} was apparently needed for the
KOMA options |toc=left| to be active at the level of the line entries.}
@@ -5194,6 +5403,27 @@ switching off the compatibility mode.
\subsection{Customizing the toc display styles}
\label{ssec:customdisplay}
+\label{etocabovetocskip}
+\label{etocbelowtocskip}
+\label{etoccolumnsep}
+\label{etocmulticolsep}
+\label{etocmulticolpretolerance}
+\label{etocmulticoltolerance}
+\label{etocdefaultnbcol}
+%\label{etocinnertopsep}% déjà défini
+\label{etoctoprule}
+\label{etoctoprulecolorcmd}
+\label{etocinnerleftsep}
+\label{etocinnerrightsep}
+\label{etocinnerbottomsep}
+\label{etocleftrule}
+\label{etocrightrule}
+\label{etocbottomrule}
+\label{etocleftrulecolorcmd}
+\label{etocrightrulecolorcmd}
+\label{etocbottomrulecolorcmd}
+\label{etocbkgcolorcmd}
+\label{etocframedmphook}
Again we list the relevant macros, what they do should be
legible from their names. Note that \csa{renewcommand}'s and
@@ -5249,8 +5479,8 @@ in |ex|'s or |em|'s as in this example:
\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{etocruledtoc} or
-\csb{etocframedtoc} which will be used for the meaning of the
+the title argument to \csb{etocruled} or
+\csb{etocframed} which will be used for the meaning of the
`1ex'. Of course also the other rule commands can have their
dimensions in font relative units, but their values are
decided on the basis of the font in effect just before the
@@ -5272,7 +5502,7 @@ this example so we included the title as part of the
\meta{start} code at section level, to get it \emph{inside}
the frame.
-\begin{filecontentshere}{etocsnippet-\the\value{section}.tex}
+\begin{filecontentshere}{etocsnippet-\snippetno.tex}
\begingroup
\definecolor{subsecnum}{RGB}{13,151,225}
\definecolor{secbackground}{RGB}{0,177,235}
@@ -5344,7 +5574,7 @@ the frame.
\tableofcontents \label{toc:clone} \ref{toc:globalcmds}
\endgroup
\end{filecontentshere}
-\attachfile[description={demo \the\value{section}}]{etocsnippet-\the\value{section}.tex}
+\marginattach{}
\filecontentsexec\filecontentsheremacro
% 1.07l on the occasion of traduction into German documentation
@@ -5384,6 +5614,58 @@ use or not colors is left to the user.
%\section{... and tricks}
+% pas traduit
+\section{The \csbhyp{etoclocaltop} command}
+\label{etoclocaltop}
+
+%\textbf{New with 1.09 (2019/03/09)}.
+
+Within either the TOC style
+(\csb{etocsettocstyle}) or the local title styles (\csb{etocsetstyle}), the
+control sequence \csb{etoclocaltop} is made equivalent for the duration of
+\csb{localtableofcontents} to a numeric (self-delimiting) denotation of the
+current top level.
+
+Thus: it will in numeric contexts (|\ifnum|, |\ifcase|, ...) represent zero
+for a local TOC corresponding to chapter, or one if in a section, or two if in
+a subsection, etc..., assuming of course here that the default levels are
+obeyed (see \autoref{sec:tocdepth}).
+
+\begin{framed}
+ \csb{etoclocaltop} from inside the TOC heading (first argument of
+ \csb{etocsettocstyle}) has the correct value \emph{only under
+ \csb{etocchecksemptiness} regime}. Special circumstances correspond to
+ some special values:
+ \begin{description}[nolistsep]
+ \item[|-3|] (|-\thr@@|)\newline
+ signals that \etoc considers the local TOC to be
+ ``unknown''; this happens at the last local TOC, for the first \LaTeX\ run
+ after adding a new \localtoc to the document. In doubt, \etoc assumes the
+ TOC will prove non empty, hence it prints (independently of whether the
+ check for emptiness was activated or not) the heading as specified by
+ \csb{etocsettocstyle}. Thus, check if \csb{etoclocaltop} gives |-3| as a
+ a \meta{number} to detect that situation from within the first argument of
+ \csb{etocsettocstyle}, if desired.
+ \item[|-1000|](|-\@m|)\newline is in case of a \localtoc
+ being considered ``known'' (although it may still refer to the data in the
+ |.toc| file from the previous run) but without the check for emptiness
+ having been executed.
+ \item[|-10000|](|-\@M|)\newline is the value when accessed from the title
+ of a global TOCs.
+ \end{description}
+\end{framed}
+\begin{framed}
+ When executed from within a local table of contents \textbf{line styles}
+ (\csb{etocsetstyle}), \csb{etoclocaltop} always will hold the correct value,
+ whether or not the emptiness check was executed.
+
+ For a global table of contents however, it will always keep the value |-3|.
+\end{framed}
+
+Attention! \cs{etoclocaltop} is only to be queried; modifying it is strictly
+forbidden and falls under the most rigorous prosecution allowed by federal
+law.
+
\section[The \csbhyp{etocsetlocaltop.toc} command]
{The \csbhyp{etocsetlocaltop.toc} and
\csbhyp{etocimmediatesetlocaltop.toc} commands}
@@ -5574,18 +5856,18 @@ sections and subsections it has. Well, each one of this paragraph is a
table of contents! We designed a macro \csa{thispartstats} to do that.
It uses ``storage'' boxes to keep the information about the first and
last section or subsection. Using boxes is the simplest manner to
-encapsulate the |hyperref| link for later use (whether there is one or
+encapsulate the \ctanpkg{hyperref} link for later use (whether there is one or
none). However, one cannot modify then the font or the color.
% (using the
% \TeX{} primitive \csa{setbox} rather than the \LaTeX{} \csa{sbox} would
% allow to change the color of the un-boxed saved box)
If such a need
arises, one must switch from using boxes to using macros, and store the
-|hyperref| data for later use as was done in the code presented in
+\ctanpkg{hyperref} data for later use as was done in the code presented in
\autoref{sec:molecule}. We present also this second method.
But first, the code of \csa{thispartstats}:\par
-\begin{filecontentshere}{etocsnippet-\the\value{section}-A.tex}
+\begin{filecontentshere}{etocsnippet-\snippetno.tex}
\newsavebox\firstnamei \newsavebox\firstnumberi
\newsavebox\lastnamei \newsavebox\lastnumberi
\newsavebox\firstnameii \newsavebox\firstnumberii
@@ -5597,32 +5879,33 @@ But first, the code of \csa{thispartstats}:\par
\setcounter{mycounti}{0}%
\setcounter{mycountii}{0}%
\def\thispartstatsauxi{%
- \sbox{\firstnamei}{\etocname}%
- \sbox{\firstnumberi}{\etocnumber}%
+ \sbox{\firstnamei}{\footnotesize\etocname}%
+ \sbox{\firstnumberi}{\footnotesize\etocnumber}%
\def\thispartstatsauxi{}}%
\def\thispartstatsauxii{%
- \sbox{\firstnameii}{\etocname}%
- \sbox{\firstnumberii}{\etocnumber}%
+ \sbox{\firstnameii}{\footnotesize\etocname}%
+ \sbox{\firstnumberii}{\footnotesize\etocnumber}%
\def\thispartstatsauxii{}}%
\begingroup
\etocsetstyle{subsection} {} {}
{\thispartstatsauxii
\stepcounter{mycountii}%
- \sbox{\lastnameii}{\etocname}%
- \sbox{\lastnumberii}{\etocnumber}} {}%
+ \sbox{\lastnameii}{\footnotesize\etocname}%
+ \sbox{\lastnumberii}{\footnotesize\etocnumber}} {}%
\etocsetstyle{section} {} {}
{\thispartstatsauxi
\stepcounter{mycounti}%
- \sbox{\lastnamei}{\etocname}%
- \sbox{\lastnumberi}{\etocnumber}}
- {Here are some statistics for this part: it contains \arabic{mycounti}
+ \sbox{\lastnamei}{\footnotesize\etocname}%
+ \sbox{\lastnumberi}{\footnotesize\etocnumber}}
+ {{\footnotesize\itshape
+ 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.
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
- subsection is \unhbox\lastnameii{} and its number is \unhbox\lastnumberii.}%
+ subsection is \unhbox\lastnameii{} and its number is \unhbox\lastnumberii.\par}}%
\etocinline % cancels the automatic \par automatically before the TOC
\etocsettocstyle {}{}
\etocsetnexttocdepth{2}%
@@ -5630,10 +5913,10 @@ But first, the code of \csa{thispartstats}:\par
\endgroup
}
\end{filecontentshere}
-\attachfile[description={demo \the\value{section}-A}]{etocsnippet-\the\value{section}-A.tex}
+\marginattach{-A}
And now, the variant with macros rather than boxes (this variant as it
stands here is for using within a section).
-\begin{filecontentshere}{etocsnippet-\the\value{section}-B.tex}
+\begin{filecontentshere}{etocsnippet-\snippetno.tex}
\makeatletter
\newcommand*\firstsubname {} \newcommand*\lastsubname {}
\newcommand*\firstsubnumber {} \newcommand*\lastsubnumber {}
@@ -5662,7 +5945,7 @@ stands here is for using within a section).
}
\makeatother
\end{filecontentshere}
-\attachfile[description={demo \the\value{section}-B}]{etocsnippet-\the\value{section}-B.tex}
+\marginattach{-B}
\section{Using depth tags}
\label{ssec:tocwithdepthtags}
@@ -5688,7 +5971,7 @@ underneath the numbers contrarily to the code from
lengths (now that this has been done once, it can be recycled easily) we
get:
-\begin{filecontentsdef}{etocsnippet-\the\value{section}.tex}{\foo}
+\begin{filecontentsdef}{etocsnippet-\snippetno.tex}{\foo}
\etocsetnexttocdepth {all}
\begingroup
\parindent 0pt \leftskip 0cm \rightskip .75cm \parfillskip -\rightskip
@@ -5757,7 +6040,7 @@ get:
\filecontentsexec\foo
\filecontentsprint\foo
-\attachfile[description={demo \the\value{section}}]{etocsnippet-\the\value{section}.tex}
+\marginattach{}
\section{Typesetting the TOC as a table (the old way)}
\label{ssec:tocastableold}
@@ -5801,7 +6084,7 @@ external macros inserted in the |.toc| file by other packages.
Note: rather than |\toks| registers it would be easier here to use \eTeX{}
\csa{unexpanded} primitive. See for example \autoref{sec:mindmap}.
-\begin{filecontentshere}{etocsnippet-\the\value{section}.tex}
+\begin{filecontentshere}{etocsnippet-\snippetno.tex}
\newtoks\toctabletok
\newcommand*\appendtotok[2]{% #1=toks variable, #2=macro, expands once #2
#1\expandafter\expandafter\expandafter {\expandafter\the\expandafter #1#2}}
@@ -5849,20 +6132,18 @@ Note: rather than |\toks| registers it would be easier here to use \eTeX{}
\the\toctabletok
\endgroup
\end{filecontentshere}
-\attachfile[description={demo \the\value{section}}]{etocsnippet-\the\value{section}.tex}
+\marginattach{}
\clearpage
\etocdepthtag.toc {etocandworld}
\part{\etoc and the outside world}
-\section{Compatibility with other packages}
-
-\subsection{Generalities}
+\section{Constraints on the \texttt{.toc} file constitution}
The contents of the |.toc| file (if it already exists) are read into memory by
-\etoc once, at the time of |\begin{document}|.\footnote{New with |1.07m|.
- Earlier versions read the |.toc| file at the time of
+\etoc once, at the time of |\begin{document}|.\footnote{%
+ Versions earlier than |1.07m| read the |.toc| file at the time of
\csa{usepackage\{etoc\}}. Thanks to Denis Bitouzé who signaled a Babel
related problem, which turned out to be caused by this.}
@@ -5888,7 +6169,8 @@ Also a |\else| immediately following \csa{tableofcontents} or
\centeredline{|\renewcommand\tableofcontents{\oldtableofcontents foo}|}
as this will make the |\label/\ref| mechanism impossible.
- Rather use \centeredline{|\renewcommand\etocaftertochook{foo}|} and there
+ Rather, redefine \csb{etocaftertochook}
+\centeredline{|\renewcommand\etocaftertochook{foo}|} and there
is also \csb{etocaftercontentshook} which is executed a bit
earlier\footnotemark{} just before the closing part of the toc display
style (and thus still within a group.)
@@ -5912,92 +6194,53 @@ Also a |\else| immediately following \csa{tableofcontents} or
not use the \csa{contentsline} macro or if the \csa{contentsline} macro
does not invoke the \csa{l@<divisionunit>} macros.
-\subsection{Compatibility with \texttt{beamer}}
-
-For the very reasons mentioned right before, \etoc is incompatible with the
-|beamer| class. However, if |beamer| is used in an article mode, i.e., with
-the article class in conjunction with the |beamerarticle| package, then \etoc
-should work.
-
-\subsection{Compatibility with \texttt{Babel}}
-
-\begin{framed}
- One must load \etoc \emph{after} \texttt{babel}. This is in order for
- |babel|'s shorthands to be active at the time when \etoc loads the |.toc|
- file.
-\end{framed}
-
-\subsection{Compatibility with \texttt{hyperref}}
-
-Please inform the author in case of issues: \etoc was from the start designed
-to be |100%| compatible with package |hyperref|.
-
-The macros \csb{etocname}, \csb{etocnumber}, and \csb{etocpage} contain the
-|hyperref| links, if present (note that the \emph{linktoc=all} option of
-|hyperref| tells it to put a link also in the page number corresponding to a
-given toc entry). For example, the tables of contents of the present document
-are all fully linked. It doesn't matter whether \etoc or |hyperref| is loaded
-first.
-
-% \typeout{ICI}
-% \showhyphens{Compatibility}
-% [] \T1/txss/m/n/10.95 Com-pat-i-bil-ity
-
-% 2015/11/12
-% Pour une raison que j'ignore dans la TOC principale j'ai un problème avec
-% cette sous-section.
-
-\subsection{Com\-pat\-i\-bil\-ity with \texttt{multicol}}
-
-\etoc loads the package |multicol|.
-
-\subsection{Compatibility with \texttt{tocloft}}\label{subs:tocloft}
-
-Release |1.07k| added compatibility with package
-|tocloft|:\footnote{\url{http://ctan.org/pkg/tocloft}} steps are
-taken to prevent the redefinition of |\tableofcontents| done by
-|tocloft| at |\begin{document}|.
-%
-As long as \etoc is left in compatibility mode the customization done by
-|tocloft| will be obeyed, for both the line styles and the TOC title.
-One may still benefit from the \emph{depth tags} management by \etoc,
-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 |tocloft| for another one, if |\tableofcontents| follows
-\csb{etocstandardlines} and \csb{etocstandarddisplaystyle}. In this
-compatibility mode |\etocsetlevel{division unit}{6}| will render
-invisible the chosen division level, but exchanging levels is otherwise
-not possible.
-
-\begin{framed}
- One should load \etoc \emph{after} \texttt{tocloft}. A warning is
- issued if otherwise, because if \etoc is loaded before it will realize that at
- the time of |\begin{document}| and trick \texttt{tocloft} into believing
- having been loaded with the |titles| option.
-\end{framed}
-
-It is possible to modify midway in the document the macros \csa{l@section},
-\csa{l@subsection} ... but the effect will be seen only in table of contents
-typeset by \etoc in compatibility mode (and of course after those
-customizations). It will have no effect on true \etoc TOCs.
+\section{Compatibility with document classes}
+
+\etoc has mainly been tested with the |article| and |book| standard classes.
+Some compatibility layer with the \ctanpkg{KOMA-script} and \ctanpkg{memoir} classes was added at
+|1.05| of |2012/12/01|. Such compatibilty layer regards what this
+documentation calls the global display style: when \etoc gets activated
+because the user employed some \csb{etocsetstyle}|{section}| (etc), i.e.\@ it
+is not used purely in compatibility mode (which happens I guess for
+\csb{localtableofcontents} functionality as it does not require reading the
+user manual), \etoc tries in absence of usage by the user of
+\csb{etocsettocstyle} to create itself a ``TOC display style'' emulating the
+default behaviour of the document class. There does not seem to be an easy
+way to extract this in an automated manner dynamically, so it is basically
+some manual work which the author initiated in 2012 and which got sporadically
+updated since.
+
+\subsection{Compatibility with the \ctanpkg{KOMA-script} classes}
+\label{etocscrartclstyle}
+\label{etocscrbookstyle}
+\label{etocscrreprtstyle}
+
+Not really tested. But nominally supported, as the code contains this
+\begin{verbatim}
+\@ifclassloaded{scrartcl}
+ {\renewcommand*\etocstandarddisplaystyle{\etocscrartclstyle}}{}
+\end{verbatim}
+and \cs{etocscrartclstyle} tries to emulate the global display style of the
+\cs{tableofcontents} command with the class \ctanpkg{scrartcl}. It was last updated
+at |1.09f|.
-\subsection{Compatibility with the \texttt{memoir} class}
+\subsection{Compatibility with the \ctanpkg{memoir} class}
\label{ssec:memoir}
\label{etocmemoirtoctotocfmt}
\label{etocmemoirstyle}
-Release |1.07l| has also improved the compatibility with the |memoir| class: its
+Release |1.07l| has also improved the compatibility with the \ctanpkg{memoir} class: its
|appendix| level has been made known to \etoc. It is at the same level as
|chapter|, thus the chapter line style should possibly do a test for some user
defined boolean whose activation may be added to the |.toc| file at the suitable
location via |\addtocontents{toc}{..}|, if one needs to distinguish the two
kinds of divisions.
-The |memoir| mechanism relative to \toc versus \toc|*| is obeyed
+The \ctanpkg{memoir} mechanism relative to \toc versus \toc|*| is obeyed
automatically, and applies with \localtoc too.
But, attention, this means that \localtoc should preferentially be used with
-the |*|. Else the |memoir| mechanism will insert a specific line in the
+the |*|. Else the \ctanpkg{memoir} mechanism will insert a specific line in the
|.toc| file, using by default the |chapter| sectioning level. But \etoc has
already written to the |.toc| file an instruction that the user wants a local
table of contents. As a result, the fake |chapter| will let \etoc consider
@@ -6012,8 +6255,8 @@ mechanism instructs to compile once more, and we end in a never stabilizing
conundrum.
Thus we see that the fact that \localtoc by default use like the global \toc a
-chapter style is inconvenient. One can use the |memoir| macros to modify this:
-according to |memoir| documentation, |\tocheadstart| and |\printtoctitle| seem
+chapter style is inconvenient. One can use the \ctanpkg{memoir} macros to modify this:
+according to \ctanpkg{memoir} documentation, |\tocheadstart| and |\printtoctitle| seem
to be the most relevant. If you do that you will probably want the added line
in |.toc| file to use |{section}| not |{chapter}|. \etoc provides to this
effect \csb{etocmemoirtoctotocfmt}\marg{kind}\marg{name} whose first argument
@@ -6024,12 +6267,12 @@ appropriate. Hence
\etocmemoirtoctotocfmt{section}{\contentsname}
\end{verbatim}
seems the natural choice in this context as an addition to the customizing the
-|memoir| toc related macros to achieve a section like rendering (for more
-details on the latter, please refer to |memoir| manual). This is appropriate
+\ctanpkg{memoir} toc related macros to achieve a section like rendering (for more
+details on the latter, please refer to \ctanpkg{memoir} manual). This is appropriate
for local TOCs in chapters. Adapt to finer sectioning levels.
Another approach is to overrule the \etoc
-default under |memoir| like this
+default under \ctanpkg{memoir} like this
\begin{verbatim}
\etocarticlestyle % means to use \section*{\contentsname} (and marks)
\renewcommand{\etocaftertitlehook}{\addcontentsline{toc}{section}{\contentsname}}
@@ -6041,34 +6284,105 @@ use \localtoc after a \csa{chapter}. But if you want one after a
\csa{section}, you should modify \csb{etocaftertitlehook} to assign
|subsection| level to the \localtoc own styling.
+\subsection{Compatibility with \ctanpkg{beamer}}
+
+For the reasons mentioned already regarding the constraints on the |.toc| file
+constitution, \etoc is incompatible with the
+\ctanpkg{beamer} class. However, if \ctanpkg{beamer} is used in an article mode, i.e., with
+the article class in conjunction with the \ctanpkg{beamerarticle} package, then \etoc
+should work.
+
+\section{Compatibility with other packages}
+
+\subsection{Compatibility with \ctanpkg{babel}}
+
+\begin{framed}
+ One must load \etoc \emph{after} \ctanpkg{babel}. This is in order for
+ \ctanpkg{babel}'s shorthands to be active at the time when \etoc loads the |.toc|
+ file.
+\end{framed}
+
+\subsection{Compatibility with \ctanpkg{hyperref}}
+
+Please inform the author in case of issues: \etoc was from the start designed
+to be |100%| compatible with package \ctanpkg{hyperref}.
+
+The macros \csb{etocname}, \csb{etocnumber}, and \csb{etocpage} contain the
+\ctanpkg{hyperref} links, if present (note that the \emph{linktoc=all} option of
+\ctanpkg{hyperref} tells it to put a link also in the page number corresponding to a
+given toc entry). For example, the tables of contents of the present document
+are all fully linked. It doesn't matter whether \etoc or \ctanpkg{hyperref} is loaded
+first.
+
+% \typeout{ICI}
+% \showhyphens{Compatibility}
+% [] \T1/txss/m/n/10.95 Com-pat-i-bil-ity
+
+% 2015/11/12
+% Pour une raison que j'ignore dans la TOC principale j'ai un problème avec
+% cette sous-section.
+
+\subsection{Com\-pat\-i\-bil\-ity with \ctanpkg{multicol}}
+
+\etoc loads the package \ctanpkg{multicol}.
+
+\subsection{Compatibility with \ctanpkg{tocloft}}\label{subs:tocloft}
-\subsection{Compatibility with package \texttt{tocvsec2}}
+Release |1.07k| added compatibility with package
+\ctanpkg{tocloft}: steps are
+taken to prevent the redefinition of |\tableofcontents| done by
+\ctanpkg{tocloft} at |\begin{document}|.
+%
+As long as \etoc is left in compatibility mode the customization done by
+\ctanpkg{tocloft} will be obeyed, for both the line styles and the TOC title.
+One may still benefit from the \emph{depth tags} management by \etoc,
+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{etocstandarddisplaystyle}. In this
+compatibility mode |\etocsetlevel{division unit}{6}| will render
+invisible the chosen division level, but exchanging levels is otherwise
+not possible.
+
+\begin{framed}
+ One should load \etoc \emph{after} \ctanpkg{tocloft}. A warning is
+ issued if otherwise, because if \etoc is loaded before it will realize that at
+ the time of |\begin{document}| and trick \ctanpkg{tocloft} into believing
+ having been loaded with the |titles| option.
+\end{framed}
+
+It is possible to modify midway in the document the macros \csa{l@section},
+\csa{l@subsection} ... but the effect will be seen only in table of contents
+typeset by \etoc in compatibility mode (and of course after those
+customizations). It will have no effect on true \etoc TOCs.
+
+\subsection{Compatibility with \ctanpkg{tocvsec2}}
\etoc used to be incompatible with package
- |tocvsec2|\footnote{\url{http://ctan.org/pkg/tocvsec2}}; it now cohabits, sort
- of, as it deactivates |tocvsec2|'s modification of |\tableofcontents|
+ \ctanpkg{tocvsec2}; it now cohabits, sort
+ of, as it deactivates \ctanpkg{tocvsec2}'s modification of |\tableofcontents|
and also cancels its other |toc|-related macros, but
reimplements partially their functionality with \csb{etocsettocdepth.toc}. By
the way, at least two latex runs are necessary for new uses of this command in
a document to have an effect in tables of contents.
-\subsection{Compatibility with package \texttt{tableof}}
+\subsection{Compatibility with \ctanpkg{tableof}}
It is possible to use simultaneously \etoc and
-{\color{niceone}|tableof|}\footnote{\url{http://ctan.org/pkg/tableof}}. Release
-|1.08| of \etoc requires at least version |1.4a| of |tableof|. If
+\ctanpkg{tableof}. Release
+|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 |tableof|. {\color{niceone}|tableof|} command \csa{nexttocwithtags}
+package \ctanpkg{tableof}. {\color{niceone}\ctanpkg{tableof}} command \csa{nexttocwithtags}
should work as expected.
-{\color{niceone}|tableof|} commands \csa{tableof}, \csa{tablenotof}, ... will
+\ctanpkg{tableof} commands \csa{tableof}, \csa{tablenotof}, ... will
typeset the (a priori global) table of contents according to the document
-class defaults, obeying the \etoc depth tags; as explained in the |tableof|
+class defaults, obeying the \etoc depth tags; as explained in the \ctanpkg{tableof}
documentation they do not typeset a TOC title. They should \emph{not} be used
in case \csb{etocglobaldefs} was issued before, except if its scope has been
terminated since then, or \csb{etoclocaldefs} has cancelled its influence.
-\subsection{Compatibility with package \texttt{tocstyle}}
+\subsection{Compatibility with \ctanpkg{tocstyle}}
Unknown. (not tested a.t.t.o.w).
@@ -6076,8 +6390,8 @@ Unknown. (not tested a.t.t.o.w).
\section{\TeX nical matters}
The \csb{etocname}, \csb{etocnumber}, \csb{etocpage} commands are protected
-against premature expansion. They contain suitable |hyperref| links if package
-|hyperref| is loaded and active for the TOC. The commands \csb{etoclink} and
+against premature expansion. They contain suitable \ctanpkg{hyperref} links if package
+\ctanpkg{hyperref} is loaded and active for the TOC. The commands \csb{etoclink} and
\csb{etocifnumbered} are also protected against premature expansion. Also
\csb{etociffirst} and \csb{etoctoccontentsline}.
@@ -6098,22 +6412,24 @@ The correct local table of
contents will be displayed only on the second compilation.
-\section{Errors and catastrophes}
+%%% de-\section this for matters of avoiding too cramped mindmap TOC
+%%%\section{Errors and catastrophes}
After using \csb{etocsetstyle} for one level, the remaining
uncustomized levels use the \etoc default styles (those
which are activated by \csb{etocdefaultlines}). One has to
- make sure that all levels needed for the next table of
+ make sure that \textbf{all levels} needed for the next table of
contents are mutually compatible: in particular the \etoc
default line styles expect each to be started in ``vertical mode''.
When using multiple \toc commands in a document, one should beware from
adding typesetting instructions directly in the |.toc| file, as they will be
- executed by \etoc for all TOCs: even for a \localtoc it doesn't matter if
- that instruction seems to concern material outside of its scope, it will get
- executed nevertheless. If absolutely necessary extra commands in the |.toc|
- file should be configured in such a way that they can be activated or
- deactivated easily from the document source, as need be.
+ executed by \etoc for \textbf{all TOCs}: even for a \localtoc it doesn't
+ matter if that instruction seems to concern material outside of its scope,
+ it will get executed nevertheless. If absolutely necessary to add extra
+ commands to the |.toc| file, make it in such a way that they can be
+ activated or deactivated easily from the document source, e.g.\@ via some
+ booleans.
As is usual with toc and labels, after each change, one has
to run latex a certain number of times to let the produced
@@ -6126,6 +6442,46 @@ contents will be displayed only on the second compilation.
\localtableofcontents
+% IL FAUT METTRE AVANT \section{Timestamps} SINON FOUTU
+% (non plus maintenant puisque j'utilise \botmark pas \firstmark
+% dans le \rightmark)
+% 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
+\renewcommand *{\sectionmark }[1]{%
+ \markboth
+ {\unexpanded{\ifodd\value{page}(\hyperref[imp]{implementation},
+ \hyperlink{FRONTPAGE}{user manual
+ front page})\hfill\fi
+ \hyperref[changelog]{\thesection. Change history}%
+ \ifodd\value{page}\else\hfill(\hyperref[imp]{implementation},
+ \hyperlink{FRONTPAGE}{user manual
+ front page})\fi}}%
+ {\unexpanded{\ifodd\value{page}(\hyperref[imp]{implementation},
+ \hyperlink{FRONTPAGE}{user manual
+ front page})\hfill\fi
+ \hyperref[changelog]{\thesection. Change history}%
+ \ifodd\value{page}\else\hfill(\hyperref[imp]{implementation},
+ \hyperlink{FRONTPAGE}{user manual
+ front page})\fi}}%
+}
+\else\error
+% faudrait cependant que je réfléchisse à quoi faire exactement en oneside
+% mais comme ceci ne peut arriver que si quelqu'un customise etoc.tex
+% ce qui n'arrivera JAMAIS, je laisse tomber
+\renewcommand *{\sectionmark }[1]{%
+ \markright
+ {\unexpanded{\ifodd\value{page}(\hyperref[imp]{implementation},
+ \hyperlink{FRONTPAGE}{user manual
+ front page})\hfill\fi
+ \hyperref[changelog]{\thesection. Change history}%
+ \ifodd\value{page}\else\hfill(\hyperref[imp]{implementation},
+ \hyperlink{FRONTPAGE}{user manual
+ front page})\fi}}%
+}
+\fi
+\makeatother
\section{Timestamp}
This is the documentation as of \texttt{\etocdocdate}, printed from the
@@ -6138,7 +6494,7 @@ version is \texttt{\etocpkgversion}, of \texttt{\etocpkgdate}.
\renewcommand\lowast{{\normalsize\raisebox{-.4\height}{*}}}
\small
- \section{Change history}
+ \section{Change history}\label{changelog}
\setlength{\columnsep}{\etoccolumnsep}
@@ -6199,7 +6555,14 @@ version is \texttt{\etocpkgversion}, of \texttt{\etocpkgdate}.
\def {\ifvmode\advance\jfverbadim.5em\relax\else\expandafter\jfverbaspace\fi}}\x
\makeatother
\begin{jfverbatim}
-1.09g [2022/11/17]^
+1.09h [2022/11/20]^
+
+ Documentation improvements. In particular, attached code snippets
+ are now visible via their filenames in the page margins. Also,
+ command names are doubly hyperlinked: first half links to the devoted
+ part of the user manual, second half links to the implementation part.
+
+~1.09g [2022/11/17]^
Compatibility hotfix with recent hyperref 7.00u of 2022-11-13.
Thanks to Denis Bitouzé for signaling the breakage to the author.
@@ -6692,7 +7055,61 @@ version is \texttt{\etocpkgversion}, of \texttt{\etocpkgdate}.
\small
-\section{Implementation}
+% 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
+\renewcommand *{\sectionmark }[1]{%
+ \markboth
+ {\unexpanded{{%
+% counteract some changes done by my macrocode hooks
+% so we must make sure it is in a scope limiting context
+% (perhaps it is already, will not check, wasted already
+% too much time on this header matter) November 2022
+ \hypersetup{linkcolor=RoyalBlue}%
+ \ifodd\value{page}(\hyperref[changelog]{change log},
+ \hyperlink{FRONTPAGE}{user manual
+ front page})\hfill\fi
+ \hyperref[imp]{\thesection. Implementation}%
+ \ifodd\value{page}\else\hfill(\hyperref[changelog]{change log},
+ \hyperlink{FRONTPAGE}{user manual
+ front page})\fi
+ }}%
+ }
+ {\unexpanded{{%
+ \hypersetup{linkcolor=RoyalBlue}%
+ \ifodd\value{page}(\hyperref[changelog]{change log},
+ \hyperlink{FRONTPAGE}{user manual
+ front page})\hfill\fi
+ \hyperref[imp]{\thesection. Implementation}%
+ \ifodd\value{page}\else\hfill(\hyperref[changelog]{change log},
+ \hyperlink{FRONTPAGE}{user manual
+ front page})\fi
+ }}%
+ }%
+}
+\else
+% faudrait cependant que je réfléchisse à quoi faire exactement en oneside
+% mais comme ceci ne peut arriver que si quelqu'un customise etoc.tex
+% ce qui n'arrivera JAMAIS, je laisse tomber
+\renewcommand *{\sectionmark }[1]{%
+ \markright
+ {\unexpanded{{%
+ \hypersetup{linkcolor=RoyalBlue}%
+ \ifodd\value{page}(\hyperref[changelog]{change log},
+ \hyperlink{FRONTPAGE}{user manual
+ front page})\hfill\fi
+ \hyperref[imp]{\thesection. Implementation}%
+ \ifodd\value{page}\else\hfill(\hyperref[changelog]{change log},
+ \hyperlink{FRONTPAGE}{user manual
+ front page})\fi
+ }}%
+ }%
+}
+\fi
+\makeatother
+
+\section{Implementation}\label{imp}
% ce \noindent est obsolète 2022/08/26 à cause des hooks à macrocode plus bas
% transférés depuis xint.dtx. Il est doublement obsolète car je rajoute un
@@ -6772,16 +7189,16 @@ version is \texttt{\etocpkgversion}, of \texttt{\etocpkgdate}.
%%% \catcode`^ 11 \catcode`_ 11 }
%%% \def\xintexprMakePrivateLetters{\xintMakePrivateLetters \catcode`! 11 }
%%% \let\MakePrivateLetters\xintMakePrivateLetters
-\definecolor{xintnamecolor}{RGB}{228,57,0}
-\colorlet{verbcolor}{Maroon}
-%
-\colorlet{privatecommentcolor}{cyan}
-\colorlet{macrocodecommentcolor}{gray}
-\colorlet{macrocodenewmacrocolor}{verbcolor}
-\colorlet{macrocodelinktouserdoccolor}{xintnamecolor}% and bold face
-\colorlet{macrocodelinktosectioncolor}{DarkBlue}% and bold face
-\colorlet{macrocodelinktocodelinecolor}{DarkBlue}
-\colorlet{macrocodenoncscolor}{Green}
+% \definecolor{etocnamecolor}{RGB}{228,57,0}
+% \colorlet{verbcolor}{Maroon}
+%
+% \colorlet{privatecommentcolor}{cyan}
+% \colorlet{macrocodecommentcolor}{gray}
+% \colorlet{macrocodenewmacrocolor}{verbcolor}
+% \colorlet{macrocodelinktouserdoccolor}{etocnamecolor}% and bold face
+% \colorlet{macrocodelinktosectioncolor}{DarkBlue}% and bold face
+% \colorlet{macrocodelinktocodelinecolor}{DarkBlue}
+% \colorlet{macrocodenoncscolor}{Green}
\def\xintdocMacrocodeFallbackColorCmd{\normalcolor}
\odef\init@crossref{\init@crossref%
\everypar{\refstepcounter{CodelineNo}%
@@ -6851,11 +7268,11 @@ version is \texttt{\etocpkgversion}, of \texttt{\etocpkgdate}.
{\xintdocMacrocodeFallbackColorCmd\special@escape@char\macro@namepart}%
\else
\ifcsname alreadydefined-\macro@namepart\endcsname
- \hyperref[xintmacro-\macro@namepart]{\special@escape@char\macro@namepart}%
+ \hyperref[etocmacro-\macro@namepart]{\special@escape@char\macro@namepart}%
\else
% this will make a rather large number of macro names in the string pool...
\global\expandafter\let\csname alreadydefined-\macro@namepart\endcsname\@empty
- \label{xintmacro-\macro@namepart}%
+ \label{etocmacro-\macro@namepart}%
\stepcounter{xintMacroCnt}%
% try to link to a labeled reference in the user documentation (xint-all.pdf)
\ifcsname r@\xintdoclabelprefix\macro@namepart\endcsname
@@ -6885,11 +7302,11 @@ version is \texttt{\etocpkgversion}, of \texttt{\etocpkgdate}.
\if0\ifx\next\scan@macro0\else\ifx\next\lowast0\else1\fi\fi
\expandafter\in@\expandafter{\expandafter.\macro@namepart,}%
{.def,.edef,.let,.gdef,.xdef,%
- .chardef,.newif,.newtoks,.newcommand,}%.odef,.oodef,.fdef,}%
+ .chardef,.newif,.newtoks,.newcommand,.DeclareRobustCommand,}%.odef,.oodef,.fdef,}%
\ifin@\labelmacro@allowedtrue\fi
\fi
- \ifcsname r@xintmacro-\macro@namepart\endcsname
- \hyperref[xintmacro-\macro@namepart]{\special@escape@char\macro@namepart}%
+ \ifcsname r@etocmacro-\macro@namepart\endcsname
+ \hyperref[etocmacro-\macro@namepart]{\special@escape@char\macro@namepart}%
\else
{\xintdocMacrocodeFallbackColorCmd\special@escape@char\macro@namepart}%
\fi
@@ -6954,6 +7371,44 @@ functioning, because the historical evolution is the way the author can
remember and understand the code. There are a few precious isolated
paragraphs which may prove vaguely useful to people not the author.
+\etoc,\marginpar{\footnotesize\rmfamily\itshape\raggedright This
+ paragraph and the next were added very late in the history of the package, at
+ 1.09h.\par} when not left in compatibility mode, hijacks the \cs{contentsline}
+expansion so as to not execute \cs{l@chapter}, \cs{l@section} etc..., but
+rather (via \cs{Etoc@lxyz}), to parse the data and extract from it the name,
+number and page number. Indeed, for legacy reasons the \LaTeX{} |.toc| data
+is \emph{not structured}, but incorporates already to some extent typesetting
+macros. This part of \etoc maneuvers is fragile as 1) it requires the |.toc|
+file to be built from \cs{contentsline} entries, and 2) of course it will be
+easily broken by changes to how data is stored there. Fortunately this
+happens rarely. The |7.00u| release of \ctanpkg{hyperref} was such an instance.
+
+The other
+core part of \etoc present from day one of the package is that
+it creates (but only virtually, and dynamically, not statically) a tree-like
+structure of the sectioning levels present in the |.toc| file. It could be
+fun to actually implement officially such a tree (where the children of a
+sectioning title are the sectioning levels at a greater depth such as
+subsections versus a section). Let us recall that \LaTeX{} provides zero
+means to know from a subsection for example, what is the title of the section containing
+it, or chapter, or part. To do this one has to create a really structured
+document which neither core \LaTeX{} nor the main document classes do. This
+remark was given for document body, but it also applies to |.toc| data. But
+\etoc adds at least some kind of follow-up to the successive encountered
+sectioning titles, and is thus able, to ``on-the-fly'' add some kind of
+structure and follow the succession of levels. Ultimately this is why the
+\cs{etocsetstyle} offers \marg{start} and \marg{finish} parts in additions to
+\marg{contents} (which I divided into a \marg{prefix} and a \marg{contents}).
+At some point one could imagine that a really \emph{structured} document (in
+opposition to what core \LaTeX{} from thirty years ago up to nowadays has to
+offer) would store in the |.toc| data directly a tree structure, where each
+node would have attributes name, number, page number, completely separated
+from any typesetting. Once this exists then basically \etoc disappears. In
+brief, once \etoc ideas will have permeated the society, it will disappear as
+its was born only to palliate the absence of real structure in the |.toc| file
+(absence inherited from the absence of real structure in a \LaTeX{} document
+body).
+
% 9 avril 2015 (1.08d) pour forcer indentation après macrocode
% par un effet particulier si avant macrocode un enumerate, inefficient,
% mais vraiment pas envie d'investiguer.
@@ -6972,6 +7427,8 @@ paragraphs which may prove vaguely useful to people not the author.
% \makeatother
+% This is obsolete as 1.09g of 2022/11/17 has removed this hack, also
+% for colorizing reasons from 1.09n.
% November 2012
% I don't want to have to type at this location (far from the top of the
% file) explicitly the package version or version date, as it is
@@ -6996,7 +7453,7 @@ paragraphs which may prove vaguely useful to people not the author.
% \begin{macrocode}
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{etoc}
-[2022/11/17 v1.09g Completely customisable TOCs (JFB)]
+[2022/11/20 v1.09h Completely customisable TOCs (JFB)]
\RequirePackage{multicol}
\DeclareOption*{\PackageWarning{etoc}{Option `\CurrentOption' is unknown.}}
\ProcessOptions\relax
@@ -7012,7 +7469,7 @@ paragraphs which may prove vaguely useful to people not the author.
% \end{macrocode}
% |\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} |tableof| if the latter is loaded too.
+% preamble, it must come \emph{after} \ctanpkg{tableof} if the latter is loaded too.
% \begin{macrocode}
\let\Etoc@global\@empty % 1.08 2015/03/10
\def\etocglobaldefs{\let\Etoc@global\global\let\tof@global\global}
@@ -7170,9 +7627,9 @@ paragraphs which may prove vaguely useful to people not the author.
%^^A I wonder since when. No time to lose on checking that.
%^^A Answer: 2020-02-27 ltdefns.dtx 1.5g |\@gobblethree|: Macro added
%
-% |1.09g| adapts to |hyperref| depending on
+% |1.09g| adapts to \ctanpkg{hyperref} depending on
% whether the latter is at |7.00u| or earlier. Indeed internal changes to
-% |hyperref| at |7.00u| broke \etoc. Thanks to Denis~\textsc{Bitouzé} for
+% \ctanpkg{hyperref} at |7.00u| broke \etoc. Thanks to Denis~\textsc{Bitouzé} for
% reporting the issue.
% \begin{macrocode}
\AtBeginDocument{%
@@ -7590,11 +8047,11 @@ paragraphs which may prove vaguely useful to people not the author.
% START OF MAINLY OBSOLETE COMMENTS
%
% |2013/03/07|: up to |1.06| \etoc defined only \csa{etocname}, \csa{etocnumber} and
-% \csa{etocpage}. The |hyperref| added data is recycled in the simplest
+% \csa{etocpage}. The \ctanpkg{hyperref} added data is recycled in the simplest
% manner, prefixing it with \csa{leavevmode}. The included
% \csa{Hy@tocdestname} is (was, see below |1.07f| and |1.08a|) left
% unexpanded. We have to spend some time with delimited macros to dis-entangle
-% the |.toc| data, and reconstruct the possible |hyperref| data. If the page
+% the |.toc| data, and reconstruct the possible \ctanpkg{hyperref} data. If the page
% number is not hyperlinked, \csa{etocpage} does \emph{not} add the link found
% possibly in the name.
%
@@ -7673,7 +8130,7 @@ paragraphs which may prove vaguely useful to people not the author.
% Potential (but rather exotic) brace removal problems avoided at |1.08n|.
%
% |1.09g| delays definition of \cs{Etoc@getthepage} to \cs{AtBeginDocument} to
-% check if |hyperref| is at version |7.00u 2022-11-13| or later, as that
+% check if \ctanpkg{hyperref} is at version |7.00u 2022-11-13| or later, as that
% version replaced \cs{hyper@linkstart} with \cs{protected} macro
% \cs{Hy@toclinkstart} which furthermore requires one more expansion step.
% Formerly, the \cs{ifEtoc@hyperref} test was executed via the expansion of
@@ -7749,9 +8206,10 @@ paragraphs which may prove vaguely useful to people not the author.
\futurelet\Etoc@getnb@token\Etoc@getnb
}
% \end{macrocode}
-% |1.09g| adds an \cs{Etoc@getnb@a} which defaults to \cs{Etoc@getnb@nohyp}
-% and gets defined only at begin document to adapt to |hyperref| depending on
-% whether the latter is at |7.00u| or earlier.
+% |1.09g| adds an \cs{Etoc@getnb@a} which
+% gets defined only at begin document to adapt to \ctanpkg{hyperref} depending on
+% whether the latter is at |7.00u| or earlier. In absence of \ctanpkg{hyperref}
+% it is \cs{let} to \cs{Etoc@getnb@nohyp}.
% \begin{macrocode}
\def\Etoc@getnb {%
\ifx\Etoc@getnb@token\bgroup
@@ -7779,11 +8237,11 @@ paragraphs which may prove vaguely useful to people not the author.
% whole thing. And I added a |\futurelet|-based brace detection in
% |\Etoc@getnb| so here |#1| is guaranteed not braced now.
%
-% |1.08n| tries to handle reasonably the |\nonumberline| of KOMA-script.
+% |1.08n| tries to handle reasonably the |\nonumberline| of \ctanpkg{KOMA-script}.
% If it expands to |\numberline{}|, \etoc will thus consider the line
% numbered with an empty number.
%
-% At |1.09f| complications to get rid of a KOMA-script |\nonumberline|
+% At |1.09f| complications to get rid of a \ctanpkg{KOMA-script} |\nonumberline|
% even though its meaning is |\empty| then, but for case of delayed use.
% \begin{macrocode}
\def\Etoc@getnb@nohyp #1{%
@@ -7860,10 +8318,21 @@ paragraphs which may prove vaguely useful to people not the author.
% in this branch (hyperref does not brace the hyperlink). So we ignore
% the |\ifEtoc@bracedname| setting.
%
-% At |1.09f| complications to get rid of a KOMA-script |\nonumberline|
+% At |1.09f| complications to get rid of a \ctanpkg{KOMA-script} |\nonumberline|
% even though its meaning is |\empty| then, but for case of delayed use.
+%
+% At |1.09h| I converted the |#5#6| into |#5|, the |#5#6| had been kept
+% around for ages here, perhaps a legacy of early versions, anyway
+% here the macro really wants the |#4| anyhow only (and |#3|) and there
+% can be only one \cs{etoc@}.
+%
+% The |7.00u| \ctanpkg{hyperref} has modified the mark-up, but \cs{Etoc@getnb@a}
+% defined at begin document has caused the expansion of \cs{Hy@toclinkstart}
+% so we are back to the |<7.00u| situation; and \cs{Hy@toclinkend} is anyhow
+% gobbled as part of |#5| as was formerly \cs{hyper@linkend} so we don't have
+% to worry about that \ctanpkg{hyperref} change.
% \begin{macrocode}
-\def\Etoc@getnb@hyp #1#2#3#4#5#6\etoc@ {%
+\def\Etoc@getnb@hyp #1#2#3#4#5\etoc@ {%
\edef\Etoc@tmp {{#3}}%
\Etoc@global\edef\etocthelink ##1{\noexpand\hyperlink {#3}{##1}}%
\Etoc@global\def\etocthename {#4}% temporary definition
@@ -7961,7 +8430,7 @@ paragraphs which may prove vaguely useful to people not the author.
\def\Etoc@getit@nameisbraced {\futurelet\Etoc@getit@token\Etoc@getit }
% \end{macrocode}
% |1.09g| delays defining \cs{Etoc@getit} to at begin document to adapt to
-% |hyperref| depending on whether the latter is at |7.00u| or earlier.
+% \ctanpkg{hyperref} depending on whether the latter is at |7.00u| or earlier.
% \begin{macrocode}
\def\Etoc@getit@nohyp #1\hspace#2#3\etoc@ {%
\ifx\relax#2%
@@ -7998,8 +8467,11 @@ paragraphs which may prove vaguely useful to people not the author.
% For |1.08p| fix of hyperref's extra brace (see |\Etoc@@getnb|,
% |\Etoc@@getit|), this branch should not suffer the issue, hence I
% don't bother checking |\ifEtoc@bracedname| status.
+%
+% At |1.09h| the |#5#6| becomes |#5|, the |#5#6| was for some legacy reason
+% I guess, but here the macro really wants the |#4| anyhow only (and |#3|).
% \begin{macrocode}
-\def\Etoc@getit@hyp #1#2#3#4#5#6\etoc@ {%
+\def\Etoc@getit@hyp #1#2#3#4#5\etoc@ {%
\edef\Etoc@tmp {{#3}}%
\Etoc@global\edef\etocthelink ##1{\noexpand\hyperlink \Etoc@tmp{##1}}%
\Etoc@global\def\etocthename {#4}% temporary definition
@@ -8535,7 +9007,7 @@ paragraphs which may prove vaguely useful to people not the author.
% |1.07g| defines |\etoctableofcontents| to be able to undo the evil and
% brutal doings of some packages with |\tableofcontents|.
%
-% |1.08| patches |tableof|'s influence. Version |1.4a| or later of |tableof|
+% |1.08| patches \ctanpkg{tableof}'s influence. Version |1.4a| or later of \ctanpkg{tableof}
% is needed.
% \begin{macrocode}
\let\etocaftertitlehook \@empty
@@ -8551,10 +9023,10 @@ paragraphs which may prove vaguely useful to people not the author.
\Etoc@tocdepthset % new with 1.08h (\etocsetnexttocdepth)
\begingroup % closed in \Etoc@t@bleofcontents or \Etoc@localtableofcontents
% \end{macrocode}
-% Prior to its release |1.4c|, |tableof| added a group pair via |\tof@begin|
+% Prior to its release |1.4c|, \ctanpkg{tableof} added a group pair via |\tof@begin|
% and |\tof@finish|. This was removed at |1.4c|. So no need to do anything now
% here about silencing |\tof@begingroup| and |\tof@endgroup|: they are
-% inserted only in the |tableof| private copy of the |.toc| file which is
+% inserted only in the \ctanpkg{tableof} private copy of the |.toc| file which is
% used by its own table of contents typesetting command.
%
% |1.08i| removes definition of |\etoc@startlocaltoc| from here. It is done
@@ -8579,7 +9051,7 @@ paragraphs which may prove vaguely useful to people not the author.
\Etoc@tocdepthset % new with 1.08h (\etocsetnexttocdepth)
\begingroup % closed in \Etoc@t@bleofcontents or \Etoc@localtableofcontents
% \end{macrocode}
-% Same comment relative to |tableof|. No need to do anything here.
+% Same comment relative to \ctanpkg{tableof}. No need to do anything here.
% \begin{macrocode}
\@ifstar
{\let\Etoc@aftertitlehook\@empty\Etoc@localtable@fcontents}
@@ -8687,24 +9159,24 @@ paragraphs which may prove vaguely useful to people not the author.
% \end{macrocode}
% |\contentsline| was set to |\Etoc@etoccontentsline| by a non-global |\let|,
% and it will recover its normal value from exiting a scope limiting group.
-% But |tableof| (since |1.4a|) under |\etocglobaldefstrue| does a global
+% But \ctanpkg{tableof} (since |1.4a|) under |\etocglobaldefstrue| does a global
% redefinition of |\contentsline|. Its |\tof@finish| then does a global
% restore of |\contentsline|, but it will be to the \etoc set
% value. |\tof@finish| is active only if either the table of contents was
% typeset using |\tableof|, |\tablenotof|, |\tableoftaggedcontents|, or
% |\nextocwithtags| was used. If not active it is either undefined (no
-% package |tableof|) or |\@empty|. Prior to |tableof| |1.4c|, the
+% package \ctanpkg{tableof}) or |\@empty|. Prior to \ctanpkg{tableof} |1.4c|, the
% |\tof@finish| closed a group and could be undefined as well, but not if
% |\etocglobaldefstrue|.
%
% \etoc |1.09c| tested here only equality to |\@empty| to decide if it is
% needed to globally restore |\contentsline| but this meant the global restore
-% was done systematically in case of absence of package |tableof|.
+% was done systematically in case of absence of package \ctanpkg{tableof}.
%
% If rather than |\@empty| the |\tof@finish| fall-back was |\relax| we could
% use here |\@ifundefined| to check in one go (matters of speaking because
% expansion of |\@ifundefined| is not in "one-go"). Maybe I should update
-% |tableof|, but for time being I will simply add an extra test. All this is
+% \ctanpkg{tableof}, but for time being I will simply add an extra test. All this is
% probably lots of time on irrelevant issue.
% \begin{macrocode}
\ifx\Etoc@global\global
@@ -8738,13 +9210,6 @@ paragraphs which may prove vaguely useful to people not the author.
\expandafter\def
\csname Etoc@end@\csname Etoc@#1@\endcsname\endcsname {#5}%
}
-% \end{macrocode}
-% Since the |1.09f 2022/08/30| release, some syntax highlighting is
-% done ; but for some reason the \cs{etocfontone} below is colorized
-% not like others. For |1.09g 2022/11/17| hotfix release due to
-% breaking change in |hyperref 7.00u 2022-11-13| I simply do not have time to
-% investigate the matter... will be for next time. If there is one!
-% \begin{macrocode}
\def\etocfontminustwo {\normalfont \LARGE \bfseries}
\def\etocfontminusone {\normalfont \large \bfseries}
\def\etocfontzero {\normalfont \large \bfseries}
@@ -8783,12 +9248,12 @@ paragraphs which may prove vaguely useful to people not the author.
% Versions earlier than |1.08b| (and since |1.05 2012/12/01|) defined
% \csa{etocpartname} (for use by \etoc's own line styles) to expand to
% \csa{partname}. But this didn't make sense in the context for example of
-% |babel| and |frenchb|, because \csa{frenchpartname} does things depending on
-% the current value of the counter |part|. The code in recent |frenchb| (but
+% \ctanpkg{babel} and \ctanpkg{babel-french}, because \csa{frenchpartname} does things depending on
+% the current value of the counter |part|. The code in recent \ctanpkg{babel-french} (but
% not yet |v2.5a| when |\etocpartname| was introduced) constructs control
% sequences |\ordinali|, etc... If the part counter is zero, this gives
% |\ordinal|. Usually this is not defined, hence no error happens (as it is
-% constructed via |\csname|), but under class |memoir| the bug showed up. All
+% constructed via |\csname|), but under class \ctanpkg{memoir} the bug showed up. All
% this to explain that I found out about this long lasting problem only on
% |2015/03/14|. Probably a sign that \etoc's own line styles are rarely
% used...
@@ -9284,7 +9749,7 @@ paragraphs which may prove vaguely useful to people not the author.
\parskip \cftparskip \@nameuse {cfttocbeforelisthook}}
{\@nameuse {cfttocafterlisthook}\endgroup\restorefromonecol}}
% \end{macrocode}
-% |1.09c| (|2020/05/15|) does an update as KOMA-script has deprecated
+% |1.09c| (|2020/05/15|) does an update as \ctanpkg{KOMA-script} has deprecated
% |\iftocfeature|. Thanks to Bilel Omrani for report. I did not check
% if cloning of KOMA code required some further updates.
%
@@ -9305,7 +9770,7 @@ paragraphs which may prove vaguely useful to people not the author.
% \end{macrocode}
% |1.09f| adds this \csa{list@fname} definition hunk although
% \csa{listoftocname} is presumably always defined. Only to match
-% closely KOMA-script code.
+% closely \ctanpkg{KOMA-script} code.
% \begin{macrocode}
\@ifundefined{listoftocname}%
{\def\list@fname{\listofname~toc}}%
@@ -9347,7 +9812,7 @@ paragraphs which may prove vaguely useful to people not the author.
{%
% \end{macrocode}
% At |1.09f| I considered adding this \csa{BeforeClosingMainAux} hunk
-% to the second argument of \csa{etocsettocstyle}-emulation of KOMA-script.
+% to the second argument of \csa{etocsettocstyle}-emulation of \ctanpkg{KOMA-script}.
% But:
% \begin{itemize}
% \item there seems to be no interface to \csa{tocbasic@end@toc@file},
@@ -9423,7 +9888,7 @@ paragraphs which may prove vaguely useful to people not the author.
\Etoc@redefetocstyle{chapter}}{}
% \end{macrocode}
%|1.07k (2014/03/06)| adds the |appendix| to the list of known levels if class
-%|memoir| is detected.
+%\ctanpkg{memoir} is detected.
% \begin{macrocode}
\@ifclassloaded{memoir}
{\etocsetlevel{appendix}{0}%
@@ -9432,12 +9897,12 @@ paragraphs which may prove vaguely useful to people not the author.
\renewcommand*\etocstandarddisplaystyle{\etocmemoirstyle}
\Etoc@redefetocstyle{chapter}}{}
% \end{macrocode}
-%|1.07k (2014/03/06)| adds the compatibility with the |tocloft| package; in
-% compatibility mode etoc will obey the |tocloft| customisation for the division
+%|1.07k (2014/03/06)| adds the compatibility with the \ctanpkg{tocloft} package; in
+% compatibility mode etoc will obey the \ctanpkg{tocloft} customisation for the division
% headings as well as for the toc title.
%
-%|1.07l (2014/04/02)| fixes the bug from the |tocloft| compatibility layer which
-%was |memoir| incompatible: |memoir| has its version of |tocloft| which doesn't
+%|1.07l (2014/04/02)| fixes the bug from the \ctanpkg{tocloft} compatibility layer which
+%was \ctanpkg{memoir} incompatible: \ctanpkg{memoir} has its version of \ctanpkg{tocloft} which doesn't
%have the |\if@cftnctoc| boolean.
% \begin{macrocode}
\def\etoctocloftstyle {%
@@ -9522,15 +9987,15 @@ paragraphs which may prove vaguely useful to people not the author.
{\@ifstar{\Etoc@addcontentsline@@immediately}{\Etoc@addtocontents@immediately}}
% \end{macrocode}
% All the following added for version |1.07g [2013/10/13]|. Motivated by
-% a demand about |tovsec2|. But it is impossible to make |tocvsec2|
-% compatible, if not re-doing all `toc' macros in |tocvsec2|
+% a demand about |tovsec2|. But it is impossible to make \ctanpkg{tocvsec2}
+% compatible, if not re-doing all `toc' macros in \ctanpkg{tocvsec2}
% (|1.3, 2011/08/07|). I do not retain the stack idea, which does not convince
% me as useful. The empty line in the |.toc| file is put there by
-% |tocvsec2| (see its code line 143).
+% \ctanpkg{tocvsec2} (see its code line 143).
%
% I take this opportunity to add to the start of the toc file
% |\let\etoc@startlocaltoc\@gobble| in case |etoc| is not detected, I should
-% possibly have done that long ago (like I did in |tableof|).
+% possibly have done that long ago (like I did in \ctanpkg{tableof}).
%
% In |1.07h| I decide that I should not have used |\Etoc@| but |\etoc@| for
% |\Etoc@settocdepth|. So I now use lowercase and add a temporary line for
@@ -9628,8 +10093,8 @@ paragraphs which may prove vaguely useful to people not the author.
{\@namedef{Etoc@depthof@#1}{\@nameuse{Etoc@#2@@}}}%
}
% \end{macrocode}
-% We must cancel all |tocvsec2| toc-related actions. But a check must be done
-% for the memoir class, as its |tocvsec2| emulation does not have the
+% We must cancel all \ctanpkg{tocvsec2} toc-related actions. But a check must be done
+% for the memoir class, as its \ctanpkg{tocvsec2} emulation does not have the
% incompatible things etoc needs to revert. This extra check added with etoc
% |1.07l|. Release |1.08g| modifies the info message under class memoir (and
% downgrades it from warning to info).
diff --git a/macros/latex/contrib/etoc/etoc.pdf b/macros/latex/contrib/etoc/etoc.pdf
index 1cf82dd474..e498315e2d 100644
--- a/macros/latex/contrib/etoc/etoc.pdf
+++ b/macros/latex/contrib/etoc/etoc.pdf
Binary files differ