diff options
32 files changed, 646 insertions, 758 deletions
diff --git a/Master/texmf-dist/doc/latex/etoc/README.md b/Master/texmf-dist/doc/latex/etoc/README.md index d0d1f1ea320..b452990b348 100644 --- a/Master/texmf-dist/doc/latex/etoc/README.md +++ b/Master/texmf-dist/doc/latex/etoc/README.md @@ -1,6 +1,6 @@ <!-- --> - Source: etoc.dtx (1.1b) + Source: etoc.dtx (1.1c) Author: Jean-Francois Burnol Info: Completely customisable TOCs License: LPPL 1.3c @@ -97,6 +97,31 @@ etoc.sty, etoc.tex, etoc.pdf, etoc.dvi. RECENT CHANGES ============== +1.1c \[2023/01/20\] +------------------- + +Fix a brace removal bug in the construction of `\etocname`. It +remained without visible effects in documents using `hyperref` and +default settings, thanks to the hyperlink wrapper, but e.g. +`\section{{\color{blue}Blue}}` in a document not using `hyperref`, +and not using etoc only in "compatibility mode", could cause a +color leak in the table of contents. + +With the KOMA-script numberline toc feature, unnumbered entries in +TOCs typeset via etoc user-defined or package provided line styles +but using compatibility mode for the global display style were +(knowingly) considered to be numbered with an empty number. They +are now considered by `\etocifnumbered` to be not numbered and the +empty `\etocnumber` will carry no hyperlink. + +Fix a 1.1a regression in the context of KOMA-script unnumbered TOC +entries: `\etocthelinkedname` could lose its hyperlink. + +Continue internal trimming of old code branches which became +un-needed after the 1.1a refactoring. Add relatively decent +code comments to accompany the 1.1a-c refactoring. Update +warning messages to use more consistently LaTeX's templates. + 1.1b \[2023/01/15\] ------------------- @@ -117,7 +142,7 @@ other commands to extract hyperlinking information, if any. With this release etoc decides earlier according to [hyperref](https://ctan.org/pkg/hyperref) linktoc status whether section names and page numbers -should be hyperlinked, and add links itself via `\hyperlink`. +should be hyperlinked, and adds links itself via `\hyperlink`. etoc is thus now immune to the details of how hyperref patches the `\contentsline` command, which is not executed anymore. Overall, the code is greatly simplified. @@ -130,7 +155,9 @@ Deprecation of `\etocsavedsectiontocline` and similarly named commands. They are not needed as `\l@section` et al. are with this release left unmodified during the table of contents typesetting. -LaTeX kernel from `2020/10/01` or later is required. +LaTeX kernel from `2020/10/01` or later is required (to allow +assuming the `\contentsline` entries in the TOC file always have +four arguments). 1.09i \[2022/11/21\] -------------------- diff --git a/Master/texmf-dist/doc/latex/etoc/etoc.pdf b/Master/texmf-dist/doc/latex/etoc/etoc.pdf Binary files differindex e6bca78501a..8029b61f1f7 100644 --- a/Master/texmf-dist/doc/latex/etoc/etoc.pdf +++ b/Master/texmf-dist/doc/latex/etoc/etoc.pdf diff --git a/Master/texmf-dist/doc/latex/etoc/etoc.tex b/Master/texmf-dist/doc/latex/etoc/etoc.tex index 54e57bdd2ae..bcb321cdb16 100644 --- a/Master/texmf-dist/doc/latex/etoc/etoc.tex +++ b/Master/texmf-dist/doc/latex/etoc/etoc.tex @@ -1,12 +1,14 @@ %% %% Package: etoc -%% Version: 1.1b +%% Version: 1.1c %% License: LPPL 1.3c %% Copyright (C) 2012-2023 Jean-Francois Burnol %% <jfbu at free dot fr> -%% run pdflatex thrice on this file etoc.tex to produce the documentation -%% etoc.pdf, with source code included. -%% +%% To produce the documentation etoc.pdf with source code included: +%% latexmk -pdf etoc.tex +%% Or +%% pdflatex etoc.tex +%% enough times. For customizations see comments and classe options below. \chardef\Withdvipdfmx 0 % replace 0 by 1 for using latex+dvipdfmx \chardef\NoSourceCode 0 % replace 0 by 1 for the doc *without* the source code \NeedsTeXFormat{LaTeX2e} diff --git a/Master/texmf-dist/doc/latex/etoc/etocsnippet-01.tex b/Master/texmf-dist/doc/latex/etoc/etocsnippet-01.tex index 53a498bf046..ccf2140a7e6 100644 --- a/Master/texmf-dist/doc/latex/etoc/etocsnippet-01.tex +++ b/Master/texmf-dist/doc/latex/etoc/etocsnippet-01.tex @@ -1,6 +1,6 @@ %% LaTeX2e file `etocsnippet-01.tex' %% generated by the `filecontentsdef' environment -%% from source `etoc' on 2023/01/16. +%% from source `etoc' on 2023/01/21. %% \begingroup\parindent 0pt \parfillskip 0pt \leftskip 0cm \rightskip 1cm \etocsetstyle {section} diff --git a/Master/texmf-dist/doc/latex/etoc/etocsnippet-02.tex b/Master/texmf-dist/doc/latex/etoc/etocsnippet-02.tex index 90362aa1767..eaf16b0895c 100644 --- a/Master/texmf-dist/doc/latex/etoc/etocsnippet-02.tex +++ b/Master/texmf-dist/doc/latex/etoc/etocsnippet-02.tex @@ -1,6 +1,6 @@ %% LaTeX2e file `etocsnippet-02.tex' %% generated by the `filecontentsdef' environment -%% from source `etoc' on 2023/01/16. +%% from source `etoc' on 2023/01/21. %% \begingroup \newcommand*{\DotsAndPage} diff --git a/Master/texmf-dist/doc/latex/etoc/etocsnippet-03.tex b/Master/texmf-dist/doc/latex/etoc/etocsnippet-03.tex index 10580f89c01..e0d0e8ca795 100644 --- a/Master/texmf-dist/doc/latex/etoc/etocsnippet-03.tex +++ b/Master/texmf-dist/doc/latex/etoc/etocsnippet-03.tex @@ -1,6 +1,6 @@ %% LaTeX2e file `etocsnippet-03.tex' %% generated by the `filecontentsdef' environment -%% from source `etoc' on 2023/01/16. +%% from source `etoc' on 2023/01/21. %% \begingroup % we start a group to keep the style changes local \newlength{\tocleftmargin} \setlength{\tocleftmargin}{5cm} diff --git a/Master/texmf-dist/doc/latex/etoc/etocsnippet-04.tex b/Master/texmf-dist/doc/latex/etoc/etocsnippet-04.tex index 5cfee48a88b..204f5cc0fc3 100644 --- a/Master/texmf-dist/doc/latex/etoc/etocsnippet-04.tex +++ b/Master/texmf-dist/doc/latex/etoc/etocsnippet-04.tex @@ -1,6 +1,6 @@ %% LaTeX2e file `etocsnippet-04.tex' %% generated by the `filecontentsdef' environment -%% from source `etoc' on 2023/01/16. +%% from source `etoc' on 2023/01/21. %% \begin{figure}[ht!] \centering diff --git a/Master/texmf-dist/doc/latex/etoc/etocsnippet-05.tex b/Master/texmf-dist/doc/latex/etoc/etocsnippet-05.tex index 8d7b0932472..026dcc39479 100644 --- a/Master/texmf-dist/doc/latex/etoc/etocsnippet-05.tex +++ b/Master/texmf-dist/doc/latex/etoc/etocsnippet-05.tex @@ -1,6 +1,6 @@ %% LaTeX2e file `etocsnippet-05.tex' %% generated by the `filecontentshere' environment -%% from source `etoc' on 2023/01/16. +%% from source `etoc' on 2023/01/21. %% \makeatletter \newcommand{\MyStandardTOC}{% diff --git a/Master/texmf-dist/doc/latex/etoc/etocsnippet-06.tex b/Master/texmf-dist/doc/latex/etoc/etocsnippet-06.tex index cfc604b7d2c..d6726052ce7 100644 --- a/Master/texmf-dist/doc/latex/etoc/etocsnippet-06.tex +++ b/Master/texmf-dist/doc/latex/etoc/etocsnippet-06.tex @@ -1,6 +1,6 @@ %% LaTeX2e file `etocsnippet-06.tex' %% generated by the `filecontentshere' environment -%% from source `etoc' on 2023/01/16. +%% from source `etoc' on 2023/01/21. %% \makeatletter \newcommand*{\MyQuasiStandardTOC}[1]{% diff --git a/Master/texmf-dist/doc/latex/etoc/etocsnippet-07.tex b/Master/texmf-dist/doc/latex/etoc/etocsnippet-07.tex index 41ec6f1f2f9..fa6fd85870c 100644 --- a/Master/texmf-dist/doc/latex/etoc/etocsnippet-07.tex +++ b/Master/texmf-dist/doc/latex/etoc/etocsnippet-07.tex @@ -1,6 +1,6 @@ %% LaTeX2e file `etocsnippet-07.tex' %% generated by the `filecontentshere' environment -%% from source `etoc' on 2023/01/16. +%% from source `etoc' on 2023/01/21. %% % it will be easy to globally shift the TOC horizontally if needed \def\TOCleftmargin {0pt} diff --git a/Master/texmf-dist/doc/latex/etoc/etocsnippet-08.tex b/Master/texmf-dist/doc/latex/etoc/etocsnippet-08.tex index ba86d24b1d1..a21e70d24e9 100644 --- a/Master/texmf-dist/doc/latex/etoc/etocsnippet-08.tex +++ b/Master/texmf-dist/doc/latex/etoc/etocsnippet-08.tex @@ -1,6 +1,6 @@ %% LaTeX2e file `etocsnippet-08.tex' %% generated by the `filecontentshere' environment -%% from source `etoc' on 2023/01/16. +%% from source `etoc' on 2023/01/21. %% \makeatletter \newcommand*\TOClocalstyle {% diff --git a/Master/texmf-dist/doc/latex/etoc/etocsnippet-09.tex b/Master/texmf-dist/doc/latex/etoc/etocsnippet-09.tex index 10fe39026ac..853659bfb8a 100644 --- a/Master/texmf-dist/doc/latex/etoc/etocsnippet-09.tex +++ b/Master/texmf-dist/doc/latex/etoc/etocsnippet-09.tex @@ -1,6 +1,6 @@ %% LaTeX2e file `etocsnippet-09.tex' %% generated by the `filecontentshere' environment -%% from source `etoc' on 2023/01/16. +%% from source `etoc' on 2023/01/21. %% \etocdefaultlines \begingroup diff --git a/Master/texmf-dist/doc/latex/etoc/etocsnippet-10.tex b/Master/texmf-dist/doc/latex/etoc/etocsnippet-10.tex index 70f97f734e5..b17c17d9cc9 100644 --- a/Master/texmf-dist/doc/latex/etoc/etocsnippet-10.tex +++ b/Master/texmf-dist/doc/latex/etoc/etocsnippet-10.tex @@ -1,6 +1,6 @@ %% LaTeX2e file `etocsnippet-10.tex' %% generated by the `filecontentshere' environment -%% from source `etoc' on 2023/01/16. +%% from source `etoc' on 2023/01/21. %% \begin{figure}[htbp!]\centering \colorlet{subsecnum}{black} diff --git a/Master/texmf-dist/doc/latex/etoc/etocsnippet-11.tex b/Master/texmf-dist/doc/latex/etoc/etocsnippet-11.tex index 584c57cb171..1a2ee57d2b6 100644 --- a/Master/texmf-dist/doc/latex/etoc/etocsnippet-11.tex +++ b/Master/texmf-dist/doc/latex/etoc/etocsnippet-11.tex @@ -1,6 +1,6 @@ %% LaTeX2e file `etocsnippet-11.tex' %% generated by the `filecontentsdef' environment -%% from source `etoc' on 2023/01/16. +%% from source `etoc' on 2023/01/21. %% \begingroup \newsavebox{\forsubsections} diff --git a/Master/texmf-dist/doc/latex/etoc/etocsnippet-12.tex b/Master/texmf-dist/doc/latex/etoc/etocsnippet-12.tex index c13553b914b..6daaaf779b9 100644 --- a/Master/texmf-dist/doc/latex/etoc/etocsnippet-12.tex +++ b/Master/texmf-dist/doc/latex/etoc/etocsnippet-12.tex @@ -1,6 +1,6 @@ %% LaTeX2e file `etocsnippet-12.tex' %% generated by the `filecontentshere' environment -%% from source `etoc' on 2023/01/16. +%% from source `etoc' on 2023/01/21. %% < in the preamble > \newcounter{visibletoc} diff --git a/Master/texmf-dist/doc/latex/etoc/etocsnippet-13.tex b/Master/texmf-dist/doc/latex/etoc/etocsnippet-13.tex index 1b6b598da60..a45ae4e1b69 100644 --- a/Master/texmf-dist/doc/latex/etoc/etocsnippet-13.tex +++ b/Master/texmf-dist/doc/latex/etoc/etocsnippet-13.tex @@ -1,6 +1,6 @@ %% LaTeX2e file `etocsnippet-13.tex' %% generated by the `filecontentshere' environment -%% from source `etoc' on 2023/01/16. +%% from source `etoc' on 2023/01/21. %% \etocsetnexttocdepth{2} % sections are at level 1 and will show up \begingroup diff --git a/Master/texmf-dist/doc/latex/etoc/etocsnippet-14.tex b/Master/texmf-dist/doc/latex/etoc/etocsnippet-14.tex index 7ad32459670..ba0dd1581cd 100644 --- a/Master/texmf-dist/doc/latex/etoc/etocsnippet-14.tex +++ b/Master/texmf-dist/doc/latex/etoc/etocsnippet-14.tex @@ -1,6 +1,6 @@ %% LaTeX2e file `etocsnippet-14.tex' %% generated by the `filecontentsdef' environment -%% from source `etoc' on 2023/01/16. +%% from source `etoc' on 2023/01/21. %% % \newtoks\treetok % put this (uncommented) preferably in the preamble % \newtoks\tmptok % (idem) diff --git a/Master/texmf-dist/doc/latex/etoc/etocsnippet-15.tex b/Master/texmf-dist/doc/latex/etoc/etocsnippet-15.tex index 03671957db0..5c6619b2ebb 100644 --- a/Master/texmf-dist/doc/latex/etoc/etocsnippet-15.tex +++ b/Master/texmf-dist/doc/latex/etoc/etocsnippet-15.tex @@ -1,6 +1,6 @@ %% LaTeX2e file `etocsnippet-15.tex' %% generated by the `filecontentshere' environment -%% from source `etoc' on 2023/01/16. +%% from source `etoc' on 2023/01/21. %% % \newtoks\treetok % put this (uncommented) preferably in the preamble % \newtoks\sectiontok diff --git a/Master/texmf-dist/doc/latex/etoc/etocsnippet-16.tex b/Master/texmf-dist/doc/latex/etoc/etocsnippet-16.tex index 6909341f3eb..1d24860f4e9 100644 --- a/Master/texmf-dist/doc/latex/etoc/etocsnippet-16.tex +++ b/Master/texmf-dist/doc/latex/etoc/etocsnippet-16.tex @@ -1,6 +1,6 @@ %% LaTeX2e file `etocsnippet-16.tex' %% generated by the `filecontentsdef' environment -%% from source `etoc' on 2023/01/16. +%% from source `etoc' on 2023/01/21. %% \begingroup % \newtoks\treetok % done in preamble diff --git a/Master/texmf-dist/doc/latex/etoc/etocsnippet-17.tex b/Master/texmf-dist/doc/latex/etoc/etocsnippet-17.tex index 424c74d7601..6661c40b12a 100644 --- a/Master/texmf-dist/doc/latex/etoc/etocsnippet-17.tex +++ b/Master/texmf-dist/doc/latex/etoc/etocsnippet-17.tex @@ -1,6 +1,6 @@ %% LaTeX2e file `etocsnippet-17.tex' %% generated by the `filecontentsdef' environment -%% from source `etoc' on 2023/01/16. +%% from source `etoc' on 2023/01/21. %% \begingroup \etocglobaldefs % necessary for \etocname etc... to survive & diff --git a/Master/texmf-dist/doc/latex/etoc/etocsnippet-18.tex b/Master/texmf-dist/doc/latex/etoc/etocsnippet-18.tex index 6ab1ba41faf..9414dcbe37c 100644 --- a/Master/texmf-dist/doc/latex/etoc/etocsnippet-18.tex +++ b/Master/texmf-dist/doc/latex/etoc/etocsnippet-18.tex @@ -1,6 +1,6 @@ %% LaTeX2e file `etocsnippet-18.tex' %% generated by the `filecontentsdef' environment -%% from source `etoc' on 2023/01/16. +%% from source `etoc' on 2023/01/21. %% \begin{center} \etocsetstyle{section} diff --git a/Master/texmf-dist/doc/latex/etoc/etocsnippet-19.tex b/Master/texmf-dist/doc/latex/etoc/etocsnippet-19.tex index 8847e6515be..f26f28713a6 100644 --- a/Master/texmf-dist/doc/latex/etoc/etocsnippet-19.tex +++ b/Master/texmf-dist/doc/latex/etoc/etocsnippet-19.tex @@ -1,6 +1,6 @@ %% LaTeX2e file `etocsnippet-19.tex' %% generated by the `filecontentshere' environment -%% from source `etoc' on 2023/01/16. +%% from source `etoc' on 2023/01/21. %% \makeatletter \newcommand*\TOCcompute@numwidths [2]{% #1=empty/"local", #2=minimal indent diff --git a/Master/texmf-dist/doc/latex/etoc/etocsnippet-20.tex b/Master/texmf-dist/doc/latex/etoc/etocsnippet-20.tex index 07e04920931..20f3d797004 100644 --- a/Master/texmf-dist/doc/latex/etoc/etocsnippet-20.tex +++ b/Master/texmf-dist/doc/latex/etoc/etocsnippet-20.tex @@ -1,6 +1,6 @@ %% LaTeX2e file `etocsnippet-20.tex' %% generated by the `filecontentshere' environment -%% from source `etoc' on 2023/01/16. +%% from source `etoc' on 2023/01/21. %% \etocsetstyle{section} {\begin{enumerate}} diff --git a/Master/texmf-dist/doc/latex/etoc/etocsnippet-21.tex b/Master/texmf-dist/doc/latex/etoc/etocsnippet-21.tex index 451faf776a9..5827d81d277 100644 --- a/Master/texmf-dist/doc/latex/etoc/etocsnippet-21.tex +++ b/Master/texmf-dist/doc/latex/etoc/etocsnippet-21.tex @@ -1,6 +1,6 @@ %% LaTeX2e file `etocsnippet-21.tex' %% generated by the `filecontentshere' environment -%% from source `etoc' on 2023/01/16. +%% from source `etoc' on 2023/01/21. %% \etocsettocdepth {subsubsection} % set the initial tocdepth \etocdefaultlines % use the package default line styles. At this early stage in diff --git a/Master/texmf-dist/doc/latex/etoc/etocsnippet-22.tex b/Master/texmf-dist/doc/latex/etoc/etocsnippet-22.tex index b8a760beb97..aefa80b73d4 100644 --- a/Master/texmf-dist/doc/latex/etoc/etocsnippet-22.tex +++ b/Master/texmf-dist/doc/latex/etoc/etocsnippet-22.tex @@ -1,6 +1,6 @@ %% LaTeX2e file `etocsnippet-22.tex' %% generated by the `filecontentshere' environment -%% from source `etoc' on 2023/01/16. +%% from source `etoc' on 2023/01/21. %% \etocruledstyle[2]{\normalfont\normalsize\rmfamily\itshape \fbox{\parbox{.6\linewidth}{ diff --git a/Master/texmf-dist/doc/latex/etoc/etocsnippet-23.tex b/Master/texmf-dist/doc/latex/etoc/etocsnippet-23.tex index 4cdd6973d2c..1a291c0426e 100644 --- a/Master/texmf-dist/doc/latex/etoc/etocsnippet-23.tex +++ b/Master/texmf-dist/doc/latex/etoc/etocsnippet-23.tex @@ -1,6 +1,6 @@ %% LaTeX2e file `etocsnippet-23.tex' %% generated by the `filecontentshere' environment -%% from source `etoc' on 2023/01/16. +%% from source `etoc' on 2023/01/21. %% \begingroup \definecolor{subsecnum}{RGB}{13,151,225} diff --git a/Master/texmf-dist/doc/latex/etoc/etocsnippet-24.tex b/Master/texmf-dist/doc/latex/etoc/etocsnippet-24.tex index f52d6a013ef..2b1b015c1e2 100644 --- a/Master/texmf-dist/doc/latex/etoc/etocsnippet-24.tex +++ b/Master/texmf-dist/doc/latex/etoc/etocsnippet-24.tex @@ -1,6 +1,6 @@ %% LaTeX2e file `etocsnippet-24.tex' %% generated by the `filecontentshere' environment -%% from source `etoc' on 2023/01/16. +%% from source `etoc' on 2023/01/21. %% \newsavebox\firstnamei \newsavebox\firstnumberi \newsavebox\lastnamei \newsavebox\lastnumberi diff --git a/Master/texmf-dist/doc/latex/etoc/etocsnippet-25.tex b/Master/texmf-dist/doc/latex/etoc/etocsnippet-25.tex index 4b780b60e59..0926c9356be 100644 --- a/Master/texmf-dist/doc/latex/etoc/etocsnippet-25.tex +++ b/Master/texmf-dist/doc/latex/etoc/etocsnippet-25.tex @@ -1,6 +1,6 @@ %% LaTeX2e file `etocsnippet-25.tex' %% generated by the `filecontentshere' environment -%% from source `etoc' on 2023/01/16. +%% from source `etoc' on 2023/01/21. %% \makeatletter \newcommand*\firstsubname {} \newcommand*\lastsubname {} diff --git a/Master/texmf-dist/doc/latex/etoc/etocsnippet-26.tex b/Master/texmf-dist/doc/latex/etoc/etocsnippet-26.tex index 8565761f2c5..b760b6ecf76 100644 --- a/Master/texmf-dist/doc/latex/etoc/etocsnippet-26.tex +++ b/Master/texmf-dist/doc/latex/etoc/etocsnippet-26.tex @@ -1,6 +1,6 @@ %% LaTeX2e file `etocsnippet-26.tex' %% generated by the `filecontentsdef' environment -%% from source `etoc' on 2023/01/16. +%% from source `etoc' on 2023/01/21. %% \etocsetnexttocdepth {all} \begingroup diff --git a/Master/texmf-dist/doc/latex/etoc/etocsnippet-27.tex b/Master/texmf-dist/doc/latex/etoc/etocsnippet-27.tex index 1135a6a0e4d..fb9958afa7b 100644 --- a/Master/texmf-dist/doc/latex/etoc/etocsnippet-27.tex +++ b/Master/texmf-dist/doc/latex/etoc/etocsnippet-27.tex @@ -1,6 +1,6 @@ %% LaTeX2e file `etocsnippet-27.tex' %% generated by the `filecontentshere' environment -%% from source `etoc' on 2023/01/16. +%% from source `etoc' on 2023/01/21. %% \newtoks\toctabletok \newcommand*\appendtotok[2]{% #1=toks variable, #2=macro, expands once #2 diff --git a/Master/texmf-dist/source/latex/etoc/etoc.dtx b/Master/texmf-dist/source/latex/etoc/etoc.dtx index 9512121efbe..98ed8726ab5 100644 --- a/Master/texmf-dist/source/latex/etoc/etoc.dtx +++ b/Master/texmf-dist/source/latex/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: <15-01-2023 at 11:56:19 CET>}% +\def\etocdtxtimestamp {Time-stamp: <20-01-2023 at 21:03:03 CET>}% %</none> %<*!readme> %% %% Package: etoc -%% Version: 1.1b +%% Version: 1.1c %% License: LPPL 1.3c %% Copyright (C) 2012-2023 Jean-Francois Burnol %% <jfbu at free dot fr> %</!readme> %<*none> -\def\etocpkgdate {2023/01/15} -\def\etocdocdate {2023/01/15} -\def\etocpkgversion {1.1b} +\def\etocpkgdate {2023/01/20} +\def\etocdocdate {2023/01/20} +\def\etocpkgversion {1.1c} \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.1b +% Version: 1.1c % License: LPPL 1.3c % Copyright (C) 2012-2023 Jean-Francois Burnol <jfbu at free dot fr> % @@ -60,7 +60,7 @@ %<*readme> <!-- --> - Source: etoc.dtx (1.1b) + Source: etoc.dtx (1.1c) Author: Jean-Francois Burnol Info: Completely customisable TOCs License: LPPL 1.3c @@ -157,6 +157,31 @@ etoc.sty, etoc.tex, etoc.pdf, etoc.dvi. RECENT CHANGES ============== +1.1c \[2023/01/20\] +------------------- + +Fix a brace removal bug in the construction of `\etocname`. It +remained without visible effects in documents using `hyperref` and +default settings, thanks to the hyperlink wrapper, but e.g. +`\section{{\color{blue}Blue}}` in a document not using `hyperref`, +and not using etoc only in "compatibility mode", could cause a +color leak in the table of contents. + +With the KOMA-script numberline toc feature, unnumbered entries in +TOCs typeset via etoc user-defined or package provided line styles +but using compatibility mode for the global display style were +(knowingly) considered to be numbered with an empty number. They +are now considered by `\etocifnumbered` to be not numbered and the +empty `\etocnumber` will carry no hyperlink. + +Fix a 1.1a regression in the context of KOMA-script unnumbered TOC +entries: `\etocthelinkedname` could lose its hyperlink. + +Continue internal trimming of old code branches which became +un-needed after the 1.1a refactoring. Add relatively decent +code comments to accompany the 1.1a-c refactoring. Update +warning messages to use more consistently LaTeX's templates. + 1.1b \[2023/01/15\] ------------------- @@ -177,7 +202,7 @@ other commands to extract hyperlinking information, if any. With this release etoc decides earlier according to [hyperref](https://ctan.org/pkg/hyperref) linktoc status whether section names and page numbers -should be hyperlinked, and add links itself via `\hyperlink`. +should be hyperlinked, and adds links itself via `\hyperlink`. etoc is thus now immune to the details of how hyperref patches the `\contentsline` command, which is not executed anymore. Overall, the code is greatly simplified. @@ -190,7 +215,9 @@ Deprecation of `\etocsavedsectiontocline` and similarly named commands. They are not needed as `\l@section` et al. are with this release left unmodified during the table of contents typesetting. -LaTeX kernel from `2020/10/01` or later is required. +LaTeX kernel from `2020/10/01` or later is required (to allow +assuming the `\contentsline` entries in the TOC file always have +four arguments). 1.09i \[2022/11/21\] -------------------- @@ -252,9 +279,11 @@ Fix an obscure bug (see source code comments) in the `\etocsetlocaltop.toc` mechanism. %</readme> %<*tex>------------------------------------------------------------------------- -%% run pdflatex thrice on this file etoc.tex to produce the documentation -%% etoc.pdf, with source code included. -%% +%% To produce the documentation etoc.pdf with source code included: +%% latexmk -pdf etoc.tex +%% Or +%% pdflatex etoc.tex +%% enough times. For customizations see comments and classe options below. \chardef\Withdvipdfmx 0 % replace 0 by 1 for using latex+dvipdfmx \chardef\NoSourceCode 0 % replace 0 by 1 for the doc *without* the source code \NeedsTeXFormat{LaTeX2e} @@ -433,17 +462,6 @@ mechanism. \pdfstringdefDisableCommands{\def\cs#1{\textbackslash\detokenize{#1}}}% }% % As I have not loaded hyperref yet I must delay it to AtBeginDocument. -%%%%%%%% -%% This is xint.dtx only stuff, not used here -%% % Late May, early June 2022 I added to my custom \verb automated detection -%% % of potential hyperlinks. So I decided to replace \cs ltxdoc definition -%% % by suitable \verb usage. It is not important to be efficient here, -%% % I can leave some \expandafter, in fact there are a handful of uses. -%% \DeclareRobustCommand\cs[1]{\expandafter\verb\expandafter~\bslash#1~} -%% % As my \verb does a verbatimizing \scantokens I don't need to worry -%% % here about active characters but I need in the PDF string, hence -%% % the \detokenize above. -%%%%%%%% \providecommand\marg[1]{% {\ttfamily\char`\{}\meta{#1}{\ttfamily\char`\}}} \providecommand\oarg[1]{% @@ -503,16 +521,6 @@ mechanism. % Perhaps there was a subsection of 3 lines on that page % and it is the subsection which decides what is in the header. \makeatletter -% \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. @@ -571,18 +579,6 @@ mechanism. % uniformisé finalement, avec quelques exceptions, pour dtx du 3 déc 2013 \def\MacroFont{\ttfamily\small\hyphenchar\font45 \baselineskip11pt\relax} -% ATTENTION: (avec doc.sty ou les classes scrdoc ou ltxdoc) -% -% - l'environnement macrocode se fait avec \macro@font qui est le -% \MacroFont du \begin{document}. -% -% - les environnements verbatim utilisent le \MacroFont courant. -% -% - \verb utilise un \ttfamily !! et non pas \verbatim@font que l'on -% peut customiser. -% -% - (9 mars 2015) il ne faut PAS commencer des macrocode directement après -% un \section, il faut un paragraphe (par exemple un \indent\par) %---- % better \verb pour doc. @@ -641,20 +637,11 @@ mechanism. % \usepackage{txfonts} -% m'occuper de la taille de txtt: -% au passage je supprime le \hyphenchar \font\m@ne -% avril 2013 -% ATTENTION ATTENTION ATTENTION Un changement de taille comme \small semble -% déclencher (peut-être) la relecture de t1txtt.fd et quoi qu'il en soit le -% \hyphenchar est REMIS à -1 ! +% -start- font adjustment 2013 + -% update: 13 octobre 2013 -% et pourtant tailles sont ok, donc au moins cette information est -% maintenue je ne sais donc pas exactement ce qui se passe. -% (2015/11/12: je soupçonne presque un bug de conception de NFSS mais je n'ai -% jamais eu ni le temps ni l'envie de regarder de plus près) \DeclareFontFamily{T1}{txtt}{\hyphenchar\font 45\relax} \DeclareFontShape{T1}{txtt}{m}{n}{ %medium @@ -672,15 +659,18 @@ mechanism. \DeclareFontShape{T1}{txtt}{m}{ui}{ %unslanted italic <->ssub * txtt/m/sl% }{} +% ---- /added scale factor 2023 \DeclareFontShape{T1}{txtt}{bx}{n}{ %bold extended - <->t1xbtt% + <->s*[.96] t1xbtt% }{} +% The above s*[.96] added 2023/01/18, next two untested \DeclareFontShape{T1}{txtt}{bx}{sc}{ %bold extended cap & small cap - <->t1xbttsc% + <->s*[.96] t1xbttsc% }{} \DeclareFontShape{T1}{txtt}{bx}{sl}{ %bold extended slanted - <->t1xbttsl% + <->s*[.96] t1xbttsl% }{} +% ---- /end of 2023 change \DeclareFontShape{T1}{txtt}{bx}{it}{ %bold extended italic <->ssub * txtt/bx/sl% }{} @@ -702,6 +692,55 @@ mechanism. \DeclareFontShape{T1}{txtt}{b}{ui}{ %bold unslanted italic <->ssub * txtt/bx/ui% }{} +% -end- font adjustment 2013 +% -start- font adjustment 2023 +\DeclareFontFamily{T1}{txss}{} +\DeclareFontShape{T1}{txss}{m}{n}{ %medium + <->s * [0.89]t1xss% +}{} +\DeclareFontShape{T1}{txss}{m}{sc}{ %cap & small cap + <->s * [0.89]t1xsssc% +}{} +\DeclareFontShape{T1}{txss}{m}{sl}{ %slanted + <->s * [0.89]t1xsssl% +}{} +\DeclareFontShape{T1}{txss}{m}{it}{ %italic + <->ssub * txss/m/sl% +}{} +\DeclareFontShape{T1}{txss}{m}{ui}{ %unslanted italic + <->ssub * txss/m/sl% +}{} +\DeclareFontShape{T1}{txss}{bx}{n}{ %bold extended + <->s * [0.89]t1xbss% +}{} +\DeclareFontShape{T1}{txss}{bx}{sc}{ %bold extended cap & small cap + <->s * [0.89]t1xbsssc% +}{} +\DeclareFontShape{T1}{txss}{bx}{sl}{ %bold extended slanted + <->s * [0.89]t1xbsssl% +}{} +\DeclareFontShape{T1}{txss}{bx}{it}{ %bold extended italic + <->ssub * txss/bx/sl% +}{} +\DeclareFontShape{T1}{txss}{bx}{ui}{ %bold extended unslanted italic + <->ssub * txss/bx/sl% +}{} +\DeclareFontShape{T1}{txss}{b}{n}{ %bold + <->ssub * txss/bx/n% +}{} +\DeclareFontShape{T1}{txss}{b}{sc}{ %bold cap & small cap + <->ssub * txss/bx/sc% +}{} +\DeclareFontShape{T1}{txss}{b}{sl}{ %bold slanted + <->ssub * txss/bx/sl% +}{} +\DeclareFontShape{T1}{txss}{b}{it}{ %bold italic + <->ssub * txss/bx/it% +}{} +\DeclareFontShape{T1}{txss}{b}{ui}{ %bold unslanted italic + <->ssub * txss/bx/ui% +}{} +% -end- font adjustment 2023 \usepackage{xspace} % added svgnames 2022/08/26 on occasion of transfer from xint colouring scheme @@ -718,11 +757,6 @@ mechanism. \usepackage {babel} % ngerman and english options have been passed to babel \AtBeginDocument { -%% ATTENTION à ce que fait la classe scrdoc: File/Datei pour \partname !!! -%% Je l'avais oublié pour 1.08 lorsque je suis passé à ngerman. (obsolète) -%% Attention aussi au fait qu'il faut faire le \renewcommand\partname -%% ET le mettre dans les \captions... -%% \renewcommand\partname{Part}% \addto\captionsenglish {\renewcommand\partname{Part}} } @@ -730,37 +764,9 @@ mechanism. \usepackage{tikz} \usetikzlibrary{trees} % added for "cyclic" grow function 2013/03/02 -% Temporaire 16 avril 2015 pour release etoc 1.08e : -% -% \usepackage{etex} -% -% car erreur de compilation avec la pre-release 2015 de TeXLive à cause d'un -% missing \locbox avec forest 2014/03/07 1.05. -% -% Dû au fait que etoolbox 2015/03/19 v2.1d ne charge plus etex lorsqu'il -% détecte le nouveau format LaTeX 2015/01/01 qui a été diffusé sur CTAN aux -% alentours de 2015/03/31 et qui est intégré à TeXLive 2015. -% -% Note 12 mai 2015: la version 2015/05/04 1.06 de forest fait maintenant -% explicitement \RequirePackage {etex}. Il y a un nouveau package elocalloc de -% David Carlisle, donc forest devrait plutôt tester si \locbox est défini -% après avoir chargé etoolbox et sinon faire \RequirePackage {elocalloc}. \usepackage{forest}[2015/05/04] -% -% switched from tikz-qtree to forest 2013/09/09 -% No problem with hyperlinks then, contrarily to tikz-qtree. -% NOTE: (12 octobre 2013) -% - si compilation pour dvipdfmx, les arbres dans le dvi visualisés par xdvi -% montrent correctement les textes, mais rien au point de vue graphique, -% - si compilation pour dvips, l'arbre fait par forest est tout empilé, celui -% fait par tikz sans forest est presque correct, les labels débordent. -% Dans les deux cas, le résultat final dans le pdf est bon. -% grosso modo dans l'état actuel le pdf fait 250K (dvipdfmx), 340K (pdflatex) et -% 1M pour dvips+ps2pdf. -% 9 octobre 2013, je me décide à ne plus utiliser hidelinks, mais il est tout de -% même ajouté au .toc % 12 mars 2015, pour 1.08a, see http://tex.stackexchange.com/a/232584/4686 \usetikzlibrary{mindmap} @@ -800,9 +806,6 @@ pdfstartview=FitH,% %-------- % 10 octobre 2013: \AtBeginDocument{\addtocontents{toc}{\protect\hypersetup{hidelinks}}} -% mieux que de passer hidelinks comme option à hyperref. -% Comme toutes les tocs sont faites dans un groupe, c'est très -% bien. (et j'utilise \etocaftertitlehook pour autre chose) %-------- % add-ons for the new section `surprising uses of etoc' (2013/01/24) @@ -812,25 +815,6 @@ pdfstartview=FitH,% \phantomsection \etoctoccontentsline{visibletoc}{\thevisibletoc}} \etocsetlevel{visibletoc}{6} -%-------- -% add-ons for the `fancy TOC' (2013/01/25) -% supprimé 2019/03/09 - % \newcounter{dummypart} - % \newcounter{dummychapter} - % \newcounter{dummysection} - % \etocsetlevel{dummypart}{6} - % \etocsetlevel{dummychapter}{6} - % \etocsetlevel{dummysection}{6} -%-------- -% for "Another compatibility mode" (2013/02/21): -% attention au 5 qui est hard-coded -% (pour 1.07f c'était 3, maintenant 5 pour 1.07g; et 4 maintenant pour 1.07h...) -% (et pour 1.07i.. à nouveau 3 faudra vraiment que je change cela) -% et maintenant =4 pour version de la doc du 28 avril 2014... faudra vraiment qu -% je mette un mécanisme plus robuste pour cette TOC. -% ATTENTION AUSSI AUX CODES VERBATIM -% mà j pour 1.08k: \etocsavedsectiontocline etc... -% mà j pour 1.1-deev: emploi de \l@section etc... \makeatletter \newcommand*{\MyQuasiStandardTOC}[1]{% \begingroup @@ -979,26 +963,6 @@ pdfstartview=FitH,% % 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 % use a slightly different colour for second half? % MEMO: we can change \ttfamily as hyperref uses a scope limiting group. @@ -1257,9 +1221,6 @@ etoc-im-me-di-ate-set-local-top \usepackage{ragged2e} \begin{document}%\normalmarginpar\layout %marginparwidth is 96pt -%\normalmarginpar\marginparwidth72bp% keep 96pt for etocsnippet-XX.tex filenames -% will set to 72bp for the two margin notes at start of code comments -% but let's reduce from the 12pt margin parsep \marginparsep 6bp \rmfamily \thispagestyle{empty} @@ -1393,10 +1354,6 @@ etoc-im-me-di-ate-set-local-top \edef\treenode{node {\noexpand\textbf{\etocifnumbered{\unexpanded\expandafter{\etocthelinkednumber}.}{} \unexpanded\expandafter{\etocthelinkedname}}}}% -%**** Cette remarque est obsolète depuis 1.09f et la partie pour le foreword -% grosse astuce: la première Partie ne sera pas embêtée par les trois sections -% avant car ce qu'elles auront mis dans \parttok va être effacé. -%**** \parttok\expandafter{\treenode}} {% 1.09f prepends... \ifcase\pseudomodthree{\value{partco}}% @@ -1424,8 +1381,6 @@ 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 @@ -1980,32 +1935,6 @@ which was inspired from what \LaTeX2e's |\@dottedtocline| macro does. Here is how it was produced: \filecontentsprint\foo -% 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} @@ -2125,16 +2054,8 @@ breaks. Also, they do not worry about potential multi-column use. \section{Linked list of the main package commands} -% 2022/08/29 -% bataille avec multicols et LaTeX (j'ai essayé quote -% avec un \leftmargin négatif mais n'a pas donné résultat -% espéré) -% mais comme il se trouve qu'il y a la place on va passer en deux, pas -% trois colonnes, donc je laisse tomber le parshape! -% 2022/08/30 -% Je sépare les macros les plus essentielles pour les mettre en avant \begin{framed}\multicolsep0pt\relax \begin{multicols}{3}\parindent0pt\relax @@ -2531,29 +2452,7 @@ re-activate it. The package does initially \csb{etocobeytoctocdepth}. \label{etocimmediatedepthtag.toc} \label{etocsettagdepth} -% As mentioned above, when the argument to \csb{etocsettocdepth.toc} isn't -% numeric but a named level the actual numeric level used is decided at the time -% the TOC gets typeset, thus with the \emph{shuffling abilities of \etoc}, one may -% obtain a very flexible control in the following way: one first declares with -% \csb{etocsetlevel} some -% dummy named level, say |partIII|, assigning it the invisible numeric level |6|. -% Then before the actual third |\part| command in the source one inserts -% \csb{etocsettocdepth.toc}|{partIII}|. At the location where the effect should -% cease one inserts in the source \csb{etocsettocdepth.toc}|{all}|. It is now -% possible to specify, each time one wants to typeset a TOC, what will be the -% finest level for the entries originating in the third part: one just has to do -% \csb{etocsetlevel}|{partIII}{1}| for example. This will limit to sections -% (if |tocdepth| was at least at that level at the time \toc is encountered). - -% This method has some limitations: -% \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 \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}. -% \end{enumerate*} + Release |1.07h| has a command \csb{etocdepthtag.toc} which allows to control dynamically the which contents end up included in the @@ -3212,14 +3111,6 @@ We now opt for a ``framed'' style, using the package default line styles and some colors added (it has been put in a float which appears \vpageref{toc:b}). -% -% (13 octobre 2013) -% \footnote{inside the |figure| environment and before the -% framed toc, which uses |multicols|, we added \csa{normalcolor} as work-around -% to an interaction bug (related to the \csa{color\{red\}} command we added to -% the |.toc| file) between |multicols|, |color| and the |figure| -% environment. This bug has nothing to do with \etoc.} -% RETIRÉ le 28 avril 2015 pour 1.08f \begin{filecontentshere}{etocsnippet-\snippetno.tex} \etocdefaultlines @@ -3258,27 +3149,8 @@ line styles and some colors added (it has been put in a float which appears \filecontentsexec\filecontentsheremacro -%\begin{figure}[ht!] -% \centering -% plus nécessaire ? -%\normalcolor % work-around to a bug involving color and multicols (and figure) -% \tableofcontents \label{toc:b} \ref{toc:globalcmds} -% \end{figure} -% \endgroup - -% Il y a un color leak du framed mais uniquement lorsqu'il est mis dans le -% float. 2013/10/13, qui révèle un bug (?? NON) du style framed je vais regarder -% mais bon. Le leak apparaît avec ruled aussi, et même avec juste multicolstyle -% MAIS PAS EN UNE SEULE COLONNE (même framed ou ruled). il semble qu'il y aie -% donc un problème d'interaction avec multicol là . à voir. Pas le temps -% maintenant. - -% 2013/10/14 -% il s'agit en fait d'un bug de color+multicols+figure qui n'a rien à voir avec -% etoc: -% http://tex.stackexchange.com/questions/138783/color-leak-from-multicols-within-a-figure -% J'ai trouvé le work-around qui consiste simplement à ajouter un \normalcolor -% _avant_ le multicols à l'intérieur de figure + + \section{Another TOC with a background color}\label{ssec:again} @@ -3299,13 +3171,6 @@ by the author at some early stage of this documentation and have only been slightly revised to use more \LaTeX-commands and less \TeX-primitives. Similar code is used also for \hyperref[toc:clone]{this other toc}. -% archivage de commentaires -% 1.07l on the occasion of traduction into German documentation: - % APRIL 26, 2014 Improvement in the section style for better placement of - % page number when the section name is more than one line long. Use of - % \makebox rather than \hbox, to be more LaTeX like. -% attention car \ref{toc:floating} fera référence au compteur de -% toutes les toc, pas visibletoc. \begin{filecontentshere}{etocsnippet-\snippetno.tex} \begin{figure}[htbp!]\centering @@ -3389,10 +3254,6 @@ code is used also for \hyperref[toc:clone]{this other toc}. \filecontentsexec\filecontentsheremacro -% , and the -% reader is referred to its \hyperref[ssec:tocclone]{subsection} for the -% coding used. - \section{A (crazy) inline display} Let us finally make some crazy inline display of the table of @@ -3690,26 +3551,6 @@ its synonym \csb{etocnopar}.} This is the later job of a |forest| environment which will be given the contents of |\treetok|. -% anciens commentaires extraits du code avant incorporation à filecontentsdef - -% 7 mars: j'utilise \etocthelinkedname défini à partir de 1.07f -% mais bien sûr je sais que ça ne marche pas (sauf dans l'arbre pour le lien de -% la section du bas) dans un QTree. Mais ça marche parfaitement dans un arbre -% TikZ natif. - -% 9 septembre 2013: je remplace QTree par Forest, et il n'y a pas de problème -% avec les hyperliens, ça marche out of the box (une fois que j'ai appris un peu -% de sa syntaxe et de celle de TikZ). - -% 7 mars: j'utilise maintenant \etocthelinkedname - -% 11 octobre -% forest ne veut pas @\the\treetok avec un \treetok vide, donc -% il faut lui donner une valeur par défaut. - -% 12 octobre -% pour que varioref fonctionne bien, je dois mettre la \tableofcontents -% au plus près de l'environnement forest \let\appendtotok\relax @@ -3880,8 +3721,6 @@ contents of this (or another) document part, only a \csa{sectiontok} and a \filecontentsexec\filecontentsheremacro -% Pour que \pageref fonctionne correctement, je dois mettre -% le \tableofcontents dans la figure. The |\tableofcontents| command appears just above the |tikzpicture| environment in a figure float (to make sure that the label of the @@ -3949,9 +3788,6 @@ example was motivated on |2015/03/11| by \url{http://tex.stackexchange.com/q/232816/4686} and this led to the \hyperref[toc:mindmaptitlepage]{title page} which is a further example.} -% car dans le filecontentsdef je dois faire comme si pour verbatim -% mais aussi l'exécuter, donc il me faut annuler définitions précédents pour -% contourner messages d'erreurs de LaTeX. \let\appendchildtree\relax \let\childnode\relax @@ -4229,12 +4065,6 @@ sections which are used to insert the missing |\hline| (this is done with the help of the \csb{etociffirst} conditional). -% obsolète avec la nouvelle \part* "\etoc" avant l'abstract (1.09f) -% The attentive reader will notice one last subtlety: the title was -% supposed to be followed not by one, but by two |\hline|'s. To -% solve this we could have used a one-time macro redefining itself, -% but we noticed that the title was followed by the unnumbered -% Abstract, thus the \csb{etocifnumbered} switch came to the rescue. Last technical note: because we put the |\\\hline| inside the branches, there was no need to employ the expandable variants \csb{etocxiffirst} and @@ -4376,14 +4206,6 @@ Notes: \etocsetstyle{section} {\begin{enumerate}[leftmargin=.75cm, label=\etocifnumbered {{\fboxrule1pt\fcolorbox{green}{white}{\etocnumber}}}{}]} -% Dec 7, 2012. I hit upon a problem whose origin I found was -% 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 \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. {\normalsize\bfseries\rmfamily\item} {\etocname{} (page \etocpage)} {\end{enumerate}} @@ -4635,20 +4457,8 @@ The command \csb{etoclink} is robust. % a |&| in a tabular construction, if \csb{etocglobaldefs} was issued. -% 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 @@ -4703,9 +4513,6 @@ an hyperlink around its argument: |\etocthelink|\marg{foo} hyperlinks an arbitrary text \meta{foo} to the target sectioning unit in the document. The command \csb{etoclink} is its robust variant. -% They too -% contain the hyperlink destination in already expanded form since |1.08a| for -% the first three, since |1.08j| for \csb{etoclink}. Obsolete example of \begingroup \etocsetstyle {section} @@ -5358,9 +5165,6 @@ can be followed with optional labels or references:\par \localtoc \csa{ref}|{toc:far}| acts the same as \toc \csa{ref}|{toc:far}|. -% (obsolète depuis 1.08e) -% The commands for local tables of -% contents do \emph{not} react to a \csa{ref} following them. When re-displaying another toc, only its contents are transferred: both the line styles and the toc display style are the ones @@ -6689,7 +6493,31 @@ version is \texttt{\etocpkgversion}, of \texttt{\etocpkgdate}. \def {\ifvmode\advance\jfverbadim.5em\relax\else\expandafter\jfverbaspace\fi}}\x \makeatother \begin{jfverbatim} -1.1b [2023/01/15]^ +1.1c [2023/01/20]^ + + Fix a brace removal bug in the construction of \etocname. It + remained without visible effects in documents using hyperref and + default settings, thanks to the hyperlink wrapper, but e.g. + \section{{\color{blue}Blue}} in a document not using hyperref, + and not using etoc only in "compatibility mode", could cause a + color leak in the table of contents. + + With the KOMA-script numberline toc feature, unnumbered entries in + TOCs typeset via etoc user-defined or package provided line styles + but using compatibility mode for the global display style were + (knowingly) considered to be numbered with an empty number. They + are now considered by \etocifnumbered to be not numbered and the + empty \etocnumber will carry no hyperlink. + + Fix a 1.1a regression in the context of KOMA-script unnumbered TOC + entries: \etocthelinkedname could lose its hyperlink. + + Continue internal trimming of old code branches which became + un-needed after the 1.1a refactoring. Add relatively decent + code comments to accompany the 1.1a-c refactoring. Update + warning messages to use more consistently LaTeX's templates. + +~1.1b [2023/01/15]^ Documentation fix, 1.1a forgot to mention the following change: \etocthelinkedname, \etocthelinkednumber, \etocthelinkedpage @@ -6705,7 +6533,7 @@ version is \texttt{\etocpkgversion}, of \texttt{\etocpkgdate}. hyperlinking information, if any. With this release etoc decides earlier according to ~2hyperref. linktoc status whether section names and page numbers - should be hyperlinked, and add links itself via \hyperlink. etoc + should be hyperlinked, and adds links itself via \hyperlink. etoc is thus now immune to the details of how ~2hyperref. patches the \contentsline command, which is not executed anymore. Overall, the code is greatly simplified. @@ -6718,7 +6546,9 @@ version is \texttt{\etocpkgversion}, of \texttt{\etocpkgdate}. commands. They are not needed as \l@section et al. are with this release left unmodified during the table of contents typesetting. - ~LaTeX kernel from 2020/10/01 or later is required. + ~LaTeX kernel from 2020/10/01 or later is required (to allow + assuming the \contentsline entries in the TOC file always have + four arguments). ~1.09i [2022/11/21]^ @@ -7358,6 +7188,8 @@ version is \texttt{\etocpkgversion}, of \texttt{\etocpkgdate}. \def\theCodelineNo{\reset@font\scriptsize\arabic{CodelineNo}} \def\theHCodelineNo{\the\value{section}.\the\value{CodelineNo}} %%% not needed for etoc.dtx +%%%%%%% attention j'utilise plus bas \MakePrivateLetters pour +%%%%%%% problème de straight quotes depuis 2023/01/18 (1.1c) %%% \def\xintMakePrivateLetters{\catcode`: 11 \catcode`? 11 \catcode`@ 11 %%% \catcode`^ 11 \catcode`_ 11 } %%% \def\xintexprMakePrivateLetters{\xintMakePrivateLetters \catcode`! 11 } @@ -7436,7 +7268,7 @@ version is \texttt{\etocpkgversion}, of \texttt{\etocpkgdate}. %.t,.w,.x,.y,.z,.XINT_x,.XINT_y,% %.XINT_tmpa,.XINT_tmpb,.XINT_tmpc,.XINT_tmpd,.XINT_tmpe,% _ is letter here %.XINT_expr_defbin_b,.XINT_expr_defbin_c,.XINT_expr_defbin_d,% - .empty,.space,}% + .empty,.space,.protect,}% \ifin@ {\xintdocMacrocodeFallbackColorCmd\special@escape@char\macro@namepart}% \else @@ -7474,8 +7306,9 @@ version is \texttt{\etocpkgversion}, of \texttt{\etocpkgdate}. %%% etoc.dtx adds complications to handle \newcommand* \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,.DeclareRobustCommand,}%.odef,.oodef,.fdef,}% + {.def,.edef,.let,.gdef,.xdef,%.odef,.oodef,.fdef, + .chardef,.newif,.newtoks,.newcommand,.DeclareRobustCommand,% + .newread,.newwrite,}% \ifin@\labelmacro@allowedtrue\fi \fi \ifcsname r@etocmacro-\macro@namepart\endcsname @@ -7523,32 +7356,16 @@ version is \texttt{\etocpkgversion}, of \texttt{\etocpkgdate}. \makeatother -Control\normalmarginpar\marginpar{\footnotesize\rmfamily\itshape\RaggedRight - The ``syntax highlighting'' was added at release 1.09f of 2022/08/30.\par} -sequences are mostly hyperlinks. When a user level command gets defined it -hyperlinks to the user documentation with bold face and -\textbf{\textcolor{macrocodelinktouserdoccolor}{using this colour}}. Further -instances if they occur will use \textcolor{macrocodelinktocodelinecolor}{this - colour} to link to their place of first definition. The latter applies also -to non-user level macros. And such non-user level macros, at the location of -their first definitions will have their names displayed using bold face and -\textbf{\textcolor{macrocodenewmacrocolor}{this colour}} and there is no -hyperlink then. Comments belonging to the code source have been configured -\textcolor{macrocodecommentcolor}{to be rendered in their own colour}, and -\textcolor{macrocodenoncscolor}{non commented-out and non-control sequences - tokens use this colour}. Other tokens use the fall-back normal colour. - -Further, when a package macro is mentioned in code comments it also hyperlinks -to the location of its first definition using -{\textcolor{macrocodelinktocodelinecolor}{this colour}} (user level commands -do not link back to the user manual, but they link to their place of first -macro definition, which is the one hyperlinking to the relevant user manual -section). Sometimes however the location of first definition is disappointing -as it may basically be provisory. Or the macro is in fact re-defined during -execution of other macros. Besides, some macros are defined using -|\csname...\endcsname| constructs (typically things defined with |part|, -|chapter|, |section| etc... in their names) and thus can not be detected by -the syntax highlighting automatization. +% 18 janvier 2023 fix d'un problème de guillements courbes et d'inutilité de upquote, +% import de mon code de lgrmath de novembre 2022 +% useless with doc.sty as \verb, verbatim and macrocode do not use \@noligs +% \usepackage{upquote} +% +\begingroup +\catcode`\'\active\catcode`\`\active +\gdef\MakePrivateLetters{\makeatletter\def`{\textasciigrave}\def'{\textquotesingle}} +\endgroup +% https://github.com/latex3/latex2e/issues/953, for the record % will be used in code comments % I could re-define \csb, but perhaps better as the mark-up is not yet there @@ -7567,25 +7384,61 @@ the syntax highlighting automatization. \fi }% } -% Warning: the author's brain reboots frequently, and more and more often. -% Hence most comments are not for the general reader, they are for the author -% himself and they document more the history of the package than its actual -% 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 who are not the author. -Apology: the code comments served mainly as a record for the author's benefit +\setcounter{secnumdepth}{3} + +\paragraph{About the syntax highlighting of the code:} +Control\normalmarginpar\marginpar{\footnotesize\rmfamily\itshape\RaggedRight + The ``syntax highlighting'' was added at release 1.09f of 2022/08/30.\par} +sequences are mostly hyperlinks. When a user level command gets defined it +hyperlinks to the user documentation with bold face and +\textbf{\textcolor{macrocodelinktouserdoccolor}{using this colour}}. Further +instances if they occur will use \textcolor{macrocodelinktocodelinecolor}{this + colour} to link to their place of first definition inside the code lines. +Package macros with no user level documentation hyperlink to their first +place of definition in the code. +And such non-user level macros, at the location of +their first definitions will have their names displayed using bold face and +\textbf{\textcolor{macrocodenewmacrocolor}{this colour}} (it is not +an hyperlink then). Comments located \emph{inside} the code source (very little are +left at |1.1a|) have been configured +\textcolor{macrocodecommentcolor}{to be rendered in their own colour}, and +\textcolor{macrocodenoncscolor}{non commented-out and non-control sequences + tokens use this colour}. Other tokens use the fall-back normal colour. +A package macro mentioned in code comments also hyperlinks +to the location of its first definition using +{\textcolor{macrocodelinktocodelinecolor}{this colour}}. + +Known limitations: +\begin{enumerate}[nosep] +\item The location of first definition may be disappointing as it may be a + provisory definition. +\item Macros such as \csbc{Etoc@next} are there for matters of code branching + only, and the first encountered definition has no relevant significance. +\item Macros defined using |\csname...\endcsname| or alike constructs are not + detected by the syntax highlighting automatization. Apart from manual + intervention, this appears complex to solve as moreover the macro name may be + there indirectly as an argument such as |#1|. +%%%% This was caused by a ... 2013 oversight in my way of customizing txtt, +%%%% see in preamble near loading of txfonts... fixed 2023/01/18 +%%%% \item Bold face has an increased character width, somewhat offsetting the +%%%% codelines alignment. +\end{enumerate} + +\paragraph{An apology:} +the code comments served mainly as a record for the author's benefit of the historical evolution of the package and rarely as a description of what the macros do. At |1.1a| I have removed almost all code comments which had accumulated as in a palimpsest. As a result, very few comments actually -remain. - +remain. |1.1c| re-added comments to those parts of the code which +got refactored at and since |1.1a|, revigorating the palimpsest stratification. +\paragraph{About \etoc and the processing of \texttt{.toc} file data:} \etoc,% % \normalmarginpar\marginpar{\footnotesize\rmfamily\itshape\RaggedRight This paragraph and the next were added very late in the history of the - package, at 1.09h.\par} + package, at 1.09h and later.\par} % when not left in compatibility mode, hijacks the \csa{contentsline} expansion so as to not execute \csa{l@chapter}, \csa{l@section} etc..., but rather to @@ -7597,15 +7450,7 @@ is \emph{not structured}, but contains already typesetting mark-up. The \etoc maneuvers to disentangle \emph{name} and \emph{number} are somewhat fragile as they expect the |.toc| file to contain the -\csa{contentsline} arguments to be arranged in a certain manner.% -% -\normalmarginpar\marginpar{\footnotesize\rmfamily\itshape\RaggedRight -Prior to \texttt{1.1a}, \etoc aliased \csa{l@chapter}, \csa{l@section}, -etc... (at the time of TOC typesetting only) to its own \csbc{Etoc@lxyz} in order to leave time to -\ctanpkg{hyperref} to add its marks-up. Thus the disentangling was -more complex than it is now. With \texttt{1.1a}, \etoc leaves -\csa{l@chapter} etc... unmodified and inserts itself hyperlinks via \csa{hyperlink}.} -% +\csa{contentsline} arguments to be arranged in a certain manner. Of course \etoc can be easily broken if changes happen to how data is stored there. Things would have been much easier for \etoc in 2012 if the \csa{contentsline} arguments had considered the section titles (aka @@ -7614,6 +7459,17 @@ of things with which \TeX\ can compute, in general) separately, each providing an argument to \csa{contentsline}. But some mix is prepared, which may depend on the document class also, and besides usually handles \csa{part} levels very differently. Fortunately upstream changes happen rarely. +% +\normalmarginpar\marginpar{\footnotesize\rmfamily\itshape\RaggedRight + Prior to \texttt{1.1a}, \etoc aliased \csa{l@chapter}, + \csa{l@section}, etc... (at the time of TOC typesetting only) + to its own \csbc{Etoc@lxyz} in order to leave time to + \ctanpkg{hyperref} to add its mark-up. Thus the disentangling + of name from number + was more complex than it is now. With \texttt{1.1a}, \etoc + leaves \csa{l@chapter} etc... unmodified (and unused) and + only hijacks \csa{contentsline}.} +% The other core part of \etoc present from day one of the package is that it creates a tree-like structure of the sectioning levels present in the |.toc| @@ -7681,17 +7537,19 @@ of real structure in a \LaTeX{} document body). % %</none> %<*package> -% |1.1a| implements a radical change to all internals for compatibility -% with (attow future) \ctanpkg{hyperref}. In order to facilitate this +% |1.1a| implements a radical change to legacy core internals for compatibility +% with some (future) \ctanpkg{hyperref} changes. In order to facilitate this % overhaul, we require \LaTeX{} 2020/10/01 for the fourth argument to % \cs{contentsline} lines in the |.toc| file to be always present. % \begin{macrocode} \NeedsTeXFormat{LaTeX2e}[2020/10/01] \ProvidesPackage{etoc} -[2023/01/15 v1.1b Completely customisable TOCs (JFB)] +[2023/01/20 v1.1c Completely customisable TOCs (JFB)] \RequirePackage{multicol} \DeclareOption*{\PackageWarning{etoc}{Option `\CurrentOption' is unknown.}} \ProcessOptions\relax +\def\etoc@{\etoc@} +\long\def\Etoc@gobtoetoc@ #1\etoc@{} \newtoks\Etoc@toctoks \def\Etoc@par{\par} \def\etocinline{\def\Etoc@par{}} @@ -7731,8 +7589,6 @@ of real structure in a \LaTeX{} document body). \def\etocdoesnotcheckemptiness {\Etoc@checksemptinessfalse } \newif\ifEtoc@notocifnotoc \def\etocnotocifnotoc {\Etoc@checksemptinesstrue\Etoc@notocifnotoctrue } -\def\etoc@{\etoc@} -\newif\ifEtoc@bracedname \newcounter{etoc@tocid} \newcounter{etoc@tocdepth} \@ifclassloaded{memoir}{\def\Etoc@minf{-\thr@@}}{\def\Etoc@minf{-\tw@}} @@ -7805,8 +7661,10 @@ of real structure in a \LaTeX{} document body). \expandafter\let \csname Etoc@#1@\endcsname\Etoc@@minustwo@ \else \PackageWarning{etoc} - {unexpected value `#2' in \string\etocsetlevel.^^J% - Should be -2,-1, 0, 1, 2, 3, 4, 5, or 6. Set to 6 (=ignored)}% + {Unexpected value `#2' in \string\etocsetlevel.\MessageBreak + It must be one of -2,-1, 0, 1, 2, 3, 4, 5, or 6 and\MessageBreak + will be set to 6: the \string\contentsline\space entries of type\MessageBreak + `#1' will be ignored by `etoc'.\MessageBreak Reported}% \expandafter\let\csname Etoc@#1@@\endcsname\Etoc@@six@@ \fi \fi @@ -7826,8 +7684,9 @@ of real structure in a \LaTeX{} document body). % \ctanpkg{hyperref} at |7.00u| broke \etoc. Thanks to Denis~\textsc{Bitouzé} for % reporting the issue. % -% But |1.1a| radically simplifies matters at \etoc core, and with it the -% breakage induced from \ctanpkg{hyperref} |7.00u| would not have happened. +% |1.1a| radically simplifies matters at \etoc core, and with this in +% place there would have been no incompatibility with the \ctanpkg{hyperref} +% |7.00u| internal changes. % \begin{macrocode} \AtBeginDocument{% \@ifpackageloaded{parskip}{\Etoc@parskiptrue}{}% @@ -7978,7 +7837,7 @@ of real structure in a \LaTeX{} document body). } \def\etocskipfirstprefix {\global\Etoc@skipprefixtrue } % \end{macrocode} -% Heart of \etoc hack into execution of |.toc| file. +% Heart of \etoc's hacks into the execution of the |.toc| file commands. % \begin{macrocode} \def\Etoc@etoccontentsline #1{% \global\expandafter\let\expandafter\Etoc@level\csname Etoc@#1@@\endcsname @@ -8015,35 +7874,25 @@ of real structure in a \LaTeX{} document body). \Etoc@next{#1}% } % \end{macrocode} -% |2015/03/08| Ever since the first release of \etoc, the code has +% Ever since the first release of \etoc, the code has % to be careful that the |\Etoc@end@<level>| user defined macros may % close groups. This is the reason why some assignments have to be done -% globally +% globally (|2015/03/08|). % -% |1.1a| implements a radical change to all internals for compatibility -% with (attow future) \ctanpkg{hyperref}. Formerly this macro fetched only -% the first argument. It now also fetches all four (the fourth argument of -% \csa{contentsline} is always present since \LaTeX{} |2020/10/01|). The -% \csbc{Etoc@lxyz} used to receive only two arguments like \csa{l@chapter}, -% \csa{l@section}, etc... which were formerly |\let| to it. It now also -% receives the fourth argument of \csa{contentsline}. -% \begin{macrocode} -\def\Etoc@etoccontentsline@ #1#2#3#4{% - \Etoc@doends - \Etoc@dobegins - \Etoc@global\edef\Etoc@prefix {\expandafter\noexpand - \csname Etoc@prefix@\csname Etoc@#1@\endcsname\endcsname }% - \Etoc@global\edef\Etoc@contents{\expandafter\noexpand - \csname Etoc@contents@\csname Etoc@#1@\endcsname\endcsname }% - \ifEtoc@skipprefix \Etoc@global\let\Etoc@prefix\@empty\fi - \global\Etoc@skipprefixfalse -% \end{macrocode} -% |1.1a| made core rewrites for \ctanpkg{hyperref} compatibility, and -% simplified the logic. The code does not execute the original -% \csa{contentsline} in a custom wrapper, which needed to have aliased all -% \csa{l@section} etc... to \csbc{Etoc@lxyz}. Now the \etoc custom -% \csa{contentsline} passes over directly to \csbc{Etoc@lxyz} which will do -% itself the job of adding hyperlinking according to the status of +% |1.1a| of |2023/01/14| implements a radical change to legacy core internals for +% compatibility with (attow future) \ctanpkg{hyperref}. Formerly +% \csbc{Etoc@etoccontentsline@} fetched only the first argument. +% It now also fetches all four (the fourth argument of +% \csa{contentsline} is always present since \LaTeX{} +% |2020/10/01|). The \csbc{Etoc@lxyz} used to receive only the two +% arguments (possibly hacked by \ctanpkg{hyperref}) +% of \csa{l@chapter}, \csa{l@section}, etc..., (these macros had +% been |\let| to \csbc{Etoc@lxyz}), and examined them to see if they +% were carrying hyperlinking data. The |1.1a| and later +% version receives as third +% argument the fourth one of \csa{contentsline}, i.e.\@ the +% hyperlinking target, and +% adds the hyperlinking according to the status of % \ctanpkg{hyperref}'s \csa{Hy@linktoc}. % % This is a breaking change if a user hacked \csa{contentsline} to do some @@ -8067,21 +7916,24 @@ of real structure in a \LaTeX{} document body). % % All \ctanpkg{hyperref} specific branches are now gone, replaced by extra % code added depending on the status of the \csbc{ifEtoc@hyperref} boolean. -% We also check the \csa{Hy@linktoc} \csa{chardef} status and (imitating -% \ctanpkg{hyperref} do not hyperlink the page number argument if it turns out +% We also check the \csa{Hy@linktoc} \csa{chardef} status and, imitating +% \ctanpkg{hyperref}, do not hyperlink the page number argument if it turns out % empty. This maintains backwards-compatibility with earlier releases of % \etoc. % \begin{macrocode} +\def\Etoc@etoccontentsline@ #1#2#3#4{% + \Etoc@doends + \Etoc@dobegins + \Etoc@global\edef\Etoc@prefix {\expandafter\noexpand + \csname Etoc@prefix@\csname Etoc@#1@\endcsname\endcsname }% + \Etoc@global\edef\Etoc@contents{\expandafter\noexpand + \csname Etoc@contents@\csname Etoc@#1@\endcsname\endcsname }% + \ifEtoc@skipprefix \Etoc@global\let\Etoc@prefix\@empty\fi + \global\Etoc@skipprefixfalse \Etoc@lxyz{#2}{#3}{#4}% \Etoc@prefix\Etoc@contents } % \end{macrocode} -% |1.1a| makes a core rewrite for compatibility with \ctanpkg{hyperref}. -% In particular \csbc{Etoc@lxyz} now has a third argument which was the -% fourth argument of \csa{contentsline}. All various ``|@hyp|'' code -% branches have been removed. We only check the \csbc{ifEtoc@hyperref} -% boolean here. -% % A \textbf{breaking change} is made at |1.1a|: \csbc{etoclink} will always % create an hyperlink, even in case of \ctanpkg{hyperref} being (possibly % locally) configured to obey |linktoc=none|. Formerly, in such case, @@ -8102,6 +7954,15 @@ of real structure in a \LaTeX{} document body). % by the macro names, and refactored the code in two steps separated by months % so in second step I forgot I had only provisory code. And I decided finally % to keep the breaking change. +% +% Under |linktoc=page| option, \ctanpkg{hyperref} has a ``feature'' to +% add one level of bracing to first argument of the \csa{l@section} etc +% macros. So for \etoc |<1.1a| this meant some extra work to dig into such a +% possible brace pair to check if the entry was numbered. At |1.1a|, the +% \ctanpkg{hyperref} modified \csa{contentsline} is not executed, hence there +% is no such complication. But the trimming of the now unneeded branches +% was not yet done at |1.1a/b| and got completed only at |1.1c|, together +% with some renamings and refactoring. % \begin{macrocode} \def\Etoc@lxyz #1#2#3{% \ifEtoc@hyperref @@ -8110,9 +7971,15 @@ of real structure in a \LaTeX{} document body). \Etoc@global\let\etocthelink\@firstofone \fi \Etoc@global\def\etocthepage {#2}% +% \end{macrocode} +% Prior to |1.1a| an hyperlink was incorporated into \csbc{etocthelinkedpage} +% only if \ctanpkg{hyperref} added an hyperlink to the page number, i.e.\@ +% under |linktoc=page| or |linktoc=all| (and a non empty page number). With +% |1.1a|, the hyperlink is always added (if a non empty page number). +% \begin{macrocode} \ifEtoc@hyperref - \ifx\etocthepage\ltx@empty - \Etoc@global\let\etocthelinkedpage\etocthepage + \ifx\etocthepage\@empty + \Etoc@global\let\etocthelinkedpage\@empty \else \Etoc@global\def\etocthelinkedpage{\hyperlink {#3}{#2}}% \fi @@ -8120,215 +7987,263 @@ of real structure in a \LaTeX{} document body). \Etoc@global\let\etocthelinkedpage\etocthepage \fi % \end{macrocode} -% Define \cs{etocthename} and \cs{etocthelinkedname}, but this will -% perhaps be redone later if it is found out that the entry was numbered. +% Define \csbc{etocthename} but this will perhaps be adjusted later if it is found +% out that the entry was numbered. % \begin{macrocode} \Etoc@global\def\etocthename{#1}% - \ifEtoc@hyperref - \Etoc@global\def\etocthelinkedname{\hyperlink{#3}{#1}}% - \else - \Etoc@global\let\etocthelinkedname\etocthename - \fi % \end{macrocode} -% Now we check if the entry was numbered and then disentangle the number from the name. +% Now we check if the entry is numbered and disentangle the number from the +% name to define correctly \csbc{etocthename} and \csbc{etocthenumber}. +% The delimiter tokens were modified at |1.1c| for a slight optimization. +% And secondary macros have less to do since the |1.1a| initiated refactoring. % \begin{macrocode} - \futurelet\Etoc@getnb@token - \Etoc@@getnb #1\relax\relax\etoc@ + \futurelet\Etoc@getnb@token\Etoc@@getnb #1\hspace\etoc@ % \end{macrocode} -% We may believe the entry was not numbered due it being a \cs{part} entry -% which has a specific format. So we need to do some additional job in -% such cases. -% \begin{macrocode} - \ifEtoc@number - \else - \ifnum\Etoc@level=\m@ne - \futurelet\Etoc@getit@token - \Etoc@@getit #1\hspace\relax\etoc@ - \fi - \fi -% \end{macrocode} -% If there was a number the \csbc{etocthename} and \csbc{etocthenumber} got -% redefined. We know need to give proper definition to \csbc{etocthelinkedname} -% and \csbc{etocthelinkednumber}. +% Even if \csbc{etocthenumber} was let to \csa{@empty}, it may happen in +% special circumstances (related to KOMA-script, see below) that +% \csbc{etocthename} got redefined. We will thus use its current contents to +% define appropriately \csbc{etocthelinkedname}. +% +% In presence of \ctanpkg{hyperref} we let always \csbc{etocthelinkedname} and +% \csbc{etocthelinkednumber} (for a numbered entry) carry an hyperlink. This +% is a \textbf{breaking change} at |1.1a|: formerly if the TOC (or the +% specific entry in the |.toc| file, as it is always possibly to inject +% \csa{hypersetup}) was typeset under |linktoc=none| or |linktoc=page| status, +% then no hyperlinks were incorporated. This is how \csbc{etocthename} and +% \csbc{etocthenumber} are configured, but \csbc{etocthelinkedname} and +% \csbc{etocthelinkednumber} will since |1.1a| always be hyperlinked in +% presence of \ctanpkg{hyperref}. % \begin{macrocode} - \ifEtoc@number - \ifEtoc@hyperref - \def\Etoc@tmp##1##2{\Etoc@global\def##2{\hyperlink{#3}{##1}}}% - \expandafter\Etoc@tmp\expandafter{\etocthename}\etocthelinkedname + \ifEtoc@hyperref + \def\Etoc@tmp##1##2{\Etoc@global\def##2{\hyperlink{#3}{##1}}}% + \expandafter\Etoc@tmp\expandafter{\etocthename}\etocthelinkedname + \ifEtoc@number \expandafter\Etoc@tmp\expandafter{\etocthenumber}\etocthelinkednumber \else - \Etoc@global\let\etocthelinkedname\etocthename - \Etoc@global\let\etocthelinkednumber\etocthenumber + \Etoc@global\let\etocthelinkednumber\@empty \fi \else - \Etoc@global\let\etocthenumber\@empty - \Etoc@global\let\etocthelinkednumber\@empty + \Etoc@global\let\etocthelinkedname \etocthename + \Etoc@global\let\etocthelinkednumber\etocthenumber \fi - \Etoc@global\expandafter\let\csname etoclink \endcsname\etocthelink - \Etoc@global\expandafter\let\csname etocname \endcsname\etocthename +% \end{macrocode} +% Defaults in absence of \ctanpkg{hyperref}. We externalize to another +% macro the \ctanpkg{hyperref} case switch. +% \begin{macrocode} + \Etoc@global\expandafter\let\csname etoclink \endcsname \etocthelink + \Etoc@global\expandafter\let\csname etocname \endcsname \etocthename \Etoc@global\expandafter\let\csname etocnumber \endcsname\etocthenumber - \Etoc@global\expandafter\let\csname etocpage \endcsname\etocthepage + \Etoc@global\expandafter\let\csname etocpage \endcsname \etocthepage \ifEtoc@hyperref - \Etoc@lxyz@hyper + \Etoc@lxyz@linktoc \fi } % \end{macrocode} -% In presence of \ctanpkg{hyperref}, \etoc |1.1a| adds the hyperlinks -% itself. For this it imitates the \ctanpkg{hyperref} own logic and tests -% \csa{Hy@linktoc} and if the page number is empty. This adds a dependency -% that \csa{Hy@linktoc} should exist and have the expected interpretation. -% -% Matters of tagging will have to wait for \LaTeX\ itself to show me what it -% does in \csa{l@section} etc... so that I can imitate. +% In presence of \ctanpkg{hyperref}, \etoc |1.1a| imports the +% \ctanpkg{hyperref} own logic and tests \csa{Hy@linktoc} to decide if +% \emph{name}, \emph{number} and \emph{page} get hyperlinks. This adds a +% dependency that \csa{Hy@linktoc} should exist and have the expected +% interpretation. +% \begin{framed} +% \textbf{MEMO:} \emph{Matters of tagging will have to wait for \LaTeX\ itself +% to show me what it does in \csa{l@section} etc... so that I can imitate.} +% \end{framed} % \begin{macrocode} -\def\Etoc@lxyz@hyper{% +\def\Etoc@lxyz@linktoc{% \ifcase\Hy@linktoc % none: nothing to do \or % section (aka name for etoc): link name and number - \Etoc@global\expandafter\let\csname etocname \endcsname\etocthelinkedname + \Etoc@global\expandafter\let\csname etocname \endcsname\etocthelinkedname \Etoc@global\expandafter\let\csname etocnumber \endcsname\etocthelinkednumber - \or % page. Do as hyperref: add a link only if page number isn't empty. - \ifx\etocthepage\ltx@empty - \else - \Etoc@global\expandafter\let\csname etocpage \endcsname\etocthelinkedpage - \fi + \or % page + \Etoc@global\expandafter\let\csname etocpage \endcsname\etocthelinkedpage \else % all - \Etoc@global\expandafter\let\csname etocname \endcsname\etocthelinkedname + \Etoc@global\expandafter\let\csname etocname \endcsname\etocthelinkedname \Etoc@global\expandafter\let\csname etocnumber \endcsname\etocthelinkednumber - \ifx\etocthepage\ltx@empty - \else - \Etoc@global\expandafter\let\csname etocpage \endcsname\etocthelinkedpage - \fi + \Etoc@global\expandafter\let\csname etocpage \endcsname\etocthelinkedpage \fi } +% \end{macrocode} +% Now for the disentangling of the ``number'' from the ``name''. +% +% At some point we will pick up the first token and check if it is +% \csa{numberline} or like token to identify a numbered entry. +% But this step can cause brace removal so we \csa{futurelet} to +% peek ahead. +% +% Prior to |1.1a| it could be possible that the first token following +% \csbc{Etoc@@getnb} was an opening brace and nevertheless the entry was +% numbered, because of a \ctanpkg{hyperref} ``feature'' in case of +% |linktoc=page| option. But at |1.1a|, \etoc handles directly the argument +% of \csa{contentsline} so the presence of an opening brace implies the entry +% is not numbered. For some reason |1.1a| kept the extra code to check in +% case the next token was an opening brace whether the whole entry was braced, +% which would have been indicative in the past (but not at |1.1a|) of a +% |linktoc=page| context (\etoc prior to |1.1a| never tested the value of +% \csa{Hy@linktoc} as it did not want to be dependent on details of +% \ctanpkg{hyperref} handling of options). This legacy, now superfluous, code +% branch is removed at |1.1c|, bringing some simplification here, in +% particular the removal of an \csa{ifEtoc@bracedname} boolean. Also, when +% branching from here to the \csbc{Etoc@getnb@nonbr}, we won't need to check +% if the entry had a special ``Part'' syntax, which is another simplification. +% +% The |@nonbr| means ``no number'', and is not to be misinterpreted as +% ``non braced''... (this was more confusing to the author on return to +% \etoc code, when it still had branches +% handling issues described above with an extra brace pair). +% \begin{macrocode} \def\Etoc@@getnb {% - \Etoc@bracednamefalse \let\Etoc@next\Etoc@getnb - \ifx\Etoc@getnb@token\@sptoken\let\Etoc@next\Etoc@getnb@nohyp@nonbr\fi - \ifx\Etoc@getnb@token\bgroup \let\Etoc@next\Etoc@getnb@checkifbraced\fi + \ifx\Etoc@getnb@token\@sptoken\let\Etoc@next\Etoc@getnb@nonbr\fi + \ifx\Etoc@getnb@token\bgroup \let\Etoc@next\Etoc@getnb@nonbr\fi \Etoc@next } -\def\Etoc@tworelax{\relax\relax} -\def\Etoc@getnb@checkifbraced #1#2\etoc@ {% - \def\Etoc@tmp{#2}% - \ifx\Etoc@tmp\Etoc@tworelax - \expandafter\expandafter\expandafter\Etoc@getnb@nameisbraced - \expandafter\@firstofone - \else - \expandafter\Etoc@getnb - \fi {#1}#2\etoc@ -} -\def\Etoc@getnb@nameisbraced {% - \Etoc@bracednametrue - \futurelet\Etoc@getnb@token\Etoc@getnb -} -% \end{macrocode} -% The |@nohyp| in the macro names is a legacy of pre-|1.1a| code. -% \begin{macrocode} -\def\Etoc@getnb {% - \ifx\Etoc@getnb@token\bgroup - \expandafter\Etoc@getnb@nohyp@nonbr - \else - \expandafter\Etoc@getnb@nohyp - \fi -} % \end{macrocode} -% |1.08n| tries to handle reasonably the \csa{nonumberline} of \ctanpkg{KOMA-script}. -% If it expands to |\numberline{}|, \etoc will thus consider the line -% numbered with an empty number. +% |1.08n| tries to handle reasonably the \csa{nonumberline} of +% \ctanpkg{KOMA-script}. If it expands to |\numberline{}|, \etoc will +% consider the line numbered with an empty number (afaict, the meaning of +% \csa{nonumberline} is either empty or \csa{numberline}|{}|). This got +% modified at |1.1c| (see below). % -% At |1.09f| complications to get rid of a \ctanpkg{KOMA-script} \csa{nonumberline} -% even though its meaning is \csa{empty} then, but let's get rid of it in case -% the tokens are stored by the user section styles for delayed use. +% At |1.09f| we get rid of the \csa{nonumberline} from inside +% \csbc{etocthename} when it has empty meaning, so the expansion of the latter +% can safely be delayed by custom section styles (for example if the build up +% some token list to be executed later not immediately). |1.1c| fixes a +% regression committed at |1.1a|: for a \csa{nonumberline} with empty +% meaning the \csbc{etocthelinkedname} did not end up hyperlinked. +% +% A change, almost a bug fix, but the former behavior was actually +% deliberate, at |1.1c| regarding the KOMA-script \csa{nonumberline} +% token: formerly, when it expanded to \csa{numberline}|{}| (this +% can happen only when the TOC is typeset in compatibility mode for +% the global display) then \csbc{ifEtoc@number} was set to true. +% But this is only a KOMA-script typesetting thing, and should not +% have influenced \etoc's decisions when its (user or package) own +% line styles are used: at |1.1c| it is thus decided that in such +% circumstances the \csbc{etocifnumbered} will pick the false +% branch, and the empty \csbc{etocthelinkednumber} will not be +% hyperlinked. +% +% No brace removal of the |#1| here a priori possible because we took care to +% check that \csbc{Etoc@getnb} was not followed by either a space or an +% opening brace. +% +% The \csbc{Etoc@@getit} branch for ``Parts'' used to be executed from inside +% \csbc{Etoc@lxyz}. At |1.1c| we jump directly to it from here. % \begin{macrocode} -\def\Etoc@getnb@nohyp #1{% +\def\Etoc@getnb #1{% \in@{#1}{\numberline\chapternumberline\partnumberline\booknumberline}% \ifin@ - \let\Etoc@next\Etoc@getnb@nohyp@nmbrd + \let\Etoc@next\Etoc@getnb@nmbrd \else - \let\Etoc@next\Etoc@getnb@nohyp@nonbr + \ifnum\Etoc@level=\m@ne + \let\Etoc@next\Etoc@@getit + \else + \let\Etoc@next\Etoc@getnb@nonbr + \fi +% \end{macrocode} +% Remove a KOMA-script \csa{nonumberline} token if present and process the +% entry always as not numbered (see above comments). Prior to |1.1c|, the +% code branched according to the meaning of the \csa{nonumberline} token, +% which was a bit silly. +% \begin{macrocode} \in@{#1}{\nonumberline}% \ifin@ - \ifx\nonumberline\empty - \let\Etoc@next\Etoc@getnb@nohyp@nonumberline - \else - \def\Etoc@next{\expandafter\Etoc@getnb@nohyp@nmbrd}% - \fi + \let\Etoc@next\Etoc@getnb@nonumberline \fi \fi \Etoc@next #1% } -\def\Etoc@getnb@nohyp@nmbrd #1#2#3\relax\relax\etoc@ {% +% \end{macrocode} +% Prior to |1.1a|, \csbc{etocthelinkedname} and \csbc{etocthelinkednumber} +% (for a numberd entry) were defined to carry links only if an hyperlink was +% actually found, now they are defined in \csbc{Etoc@lxyz} to always provide +% the hyperlinking to the target title in the document. +% +% |1.1a| and |1.1b| still had here some superfluous code which was trimmed at +% |1.1c|. +% +% Also, |1.1c| fixes here a brace removal bug (which had always been there I +% guess): if the numbered heading title was braced one level of bracing was +% removed. The bug had no effect in a document using \ctanpkg{hyperref} (and +% its default |linktoc| setting) as the \csa{hyperlink} wrapper limited the +% scope. But in a document without hyperref it would have been seen with +% input such as |\section{{\color{blue}Stuff}}|. +% \begin{macrocode} +\def\Etoc@getnb@nmbrd #1#2{% \Etoc@global\Etoc@numbertrue - \Etoc@global\def\etocthenumber {#2}% - \Etoc@global\def\etocthelinkednumber {#2}% - \ifEtoc@bracedname - \Etoc@global\def\etocthename{{#3}}% - \else - \Etoc@global\def\etocthename{#3}% - \fi - \Etoc@global\let\etocthelinkedname \etocthename + \Etoc@global\def\etocthenumber {#2}% + \Etoc@getnb@nmbrd@getname\@empty +}% +% \end{macrocode} +% We added an \csa{@empty} token to prevent brace removal. +% \begin{macrocode} +\def\Etoc@getnb@nmbrd@getname #1\hspace\etoc@ {% + \Etoc@global\expandafter\def\expandafter\etocthename\expandafter{#1}% } % \end{macrocode} -% \csbc{etocthename} and \csbc{etocthelinkedname} already defined in -% \csbc{Etoc@lxyz}, no need to update. +% Not numbered entry. % \begin{macrocode} -\def\Etoc@getnb@nohyp@nonbr #1\etoc@ {% +\def\Etoc@getnb@nonbr #1\etoc@ {% \Etoc@global\Etoc@numberfalse - \Etoc@global\let\etocthenumber \@empty - \Etoc@global\let\etocthelinkednumber \@empty + \Etoc@global\let\etocthenumber \@empty } % \end{macrocode} -% Special KOMA branch: |#1| starts with \csa{nonumberline} which has here same -% meaning as \csa{empty}. It is in the current provisory definition of -% \csbc{etocthename}. We get rid of this token, in case usage is delayed, -% to avoid improbable problems. +% Special KOMA branch: |#1| starts with \csa{nonumberline} (prior to |1.1c| +% the |#1| would have already lost this token, and this branch was executed +% only in case \csa{nonumberline} had empty meaning). We need to remove this +% token from |#1| and redefine \csbc{etocthename}. +% +% |1.1a| code still had here some complications with a ``braced name'' branch +% which was in fact never executed at |1.1a|, as the \ctanpkg{hyperref} hacks +% into the expansion of \csa{contentsline} were not executed. These now +% unneeded complications got removed at |1.1c|. +% +% |1.1c| also fixes a regression caused by |1.1a| in this branch: the +% \csbc{etocthelinkedname} had lost its hyperlink. +% +% The \csa{nonumberline} extra token guarantees no brace stripping here. % \begin{macrocode} -\def\Etoc@getnb@nohyp@nonumberline #1\relax\relax\etoc@ {% +\def\Etoc@getnb@nonumberline #1\hspace\etoc@ {% \Etoc@global\Etoc@numberfalse - \Etoc@global\let\etocthenumber \@empty - \Etoc@global\let\etocthelinkednumber \@empty - \ifEtoc@bracedname - \Etoc@global\expandafter\def\expandafter\etocthename - \expandafter{\expandafter{#1}}% - \else - \Etoc@global\expandafter\def\expandafter\etocthename\expandafter{#1}% - \fi - \Etoc@global\let\etocthelinkedname \etocthename + \Etoc@global\let\etocthenumber \@empty + \Etoc@global\expandafter\def\expandafter\etocthename\expandafter{\@gobble#1}% } % \end{macrocode} -% |1.1a| maps directly to \csbc{Etoc@getit@nohyp}, and the |@nohyp| will -% perhaps be removed from its name at some later stage. +% This branch handles the peculiar ``Part'' syntax. No brace stripping +% possible here when grabbing |#1|, due to previous checks that it does +% not start by a space token or an opening brace. +% +% |1.1c| handles this as a sub-branch from \csbc{Etoc@@getnb} which brings +% simplifications. Also the code has been somewhat strengthened so as to +% avoid in later processing a brace removal issue on the name (which was a bug +% of legacy earlier code), when it turns our we are handling a numbered Part +% indeed. +% +% The whole thing is anyhow quite fragile due to \LaTeX{}'s handling by +% standard classes of |.toc| file entries for parts being even more already +% pre-formatted for typesetting than for other levels. % \begin{macrocode} -\def\Etoc@@getit{% - \ifEtoc@bracedname - \expandafter\expandafter\expandafter\Etoc@getit@nameisbraced - \expandafter\@firstofone - \else - \expandafter\Etoc@getit@nohyp - \fi -} -\def\Etoc@getit@nameisbraced {\futurelet\Etoc@getit@token\Etoc@getit@nohyp } -\def\Etoc@getit@nohyp #1\hspace#2#3\etoc@ {% - \ifx\relax#2% +\def\Etoc@@getit #1\hspace#2{% + \ifx\etoc@#2% + \Etoc@global\Etoc@numberfalse + \Etoc@global\let\etocthenumber \@empty \else - \Etoc@global\def\etocthenumber {#1}% - \Etoc@global\def\etocthelinkednumber {#1}% \Etoc@global\Etoc@numbertrue - \Etoc@getit@nohyp@getname #3\etoc@ + \Etoc@global\def\etocthenumber {#1}% + \expandafter\Etoc@getit@getname \expandafter\@empty \fi } -\def\Etoc@getit@nohyp@getname #1\hspace\relax\etoc@ {% - \ifEtoc@bracedname - \Etoc@global\def\etocthename {{#1}}% - \else - \Etoc@global\def\etocthename {#1}% - \fi - \Etoc@global\let\etocthelinkedname\etocthename +% \end{macrocode} +% Chain of \csa{expandafter}'s to get rid of the added \csa{@empty} token to +% avoid a brace removal. And this is the end of the |1.1a| refactoring, +% completed at |1.1c|. +% \begin{macrocode} +\def\Etoc@getit@getname #1\hspace\etoc@ {% + \Etoc@global\expandafter\def\expandafter\etocthename\expandafter{#1}% } % \end{macrocode} -% |1.08a| of |2015/03/12| does the long-postponed thing to let \csbc{etocname} -% etc.. be simply the robust variant of \csbc{etocthelinkedname} etc... +% place-holder % \begin{macrocode} \let\etocthename \@empty \let\etocthenumber \@empty @@ -8375,7 +8290,7 @@ of real structure in a \LaTeX{} document body). \ifx\hyper@last\@undefined \IfFileExists{\jobname .toc} {\Hy@WarningNoLine - {old toc file detected, not used; run LaTeX again (cheers from etoc)}% + {old toc file detected; run LaTeX again (cheers from `etoc')}% \global\Etoc@toctoks={}% } {}% @@ -8622,14 +8537,14 @@ of real structure in a \LaTeX{} document body). \global\Etoc@emptytocfalse \edef\Etoc@tocid{#1}% \ifnum\Etoc@tocid<\@ne - \setbox0\hbox{\ref{Unknown toc ref \@secondoftwo#1. Rerun LaTeX}}% + \setbox0\hbox{\ref{Unknown toc ref \@secondoftwo#1. \space Rerun LaTeX}}% % \end{macrocode} % Do only heading, skip all the rest. % \begin{macrocode} \global\Etoc@stoptoctrue \gdef\etoclocaltop{-\thr@@}% \Etoc@tableofcontents - \expandafter\Etoc@gobbletoetoc@ + \expandafter\Etoc@gobtoetoc@ \fi \global\Etoc@notactivetrue \ifEtoc@checksemptiness @@ -8637,7 +8552,7 @@ of real structure in a \LaTeX{} document body). \fi \ifEtoc@emptytoc \ifEtoc@notactive - \setbox0\hbox{\ref{Unknown toc ID \number\Etoc@tocid. Rerun LaTeX}}% + \setbox0\hbox{\ref{Unknown toc ID \number\Etoc@tocid. \space Rerun LaTeX}}% % \end{macrocode} % Assume real one will be non-empty and print only heading for this pass. % \begin{macrocode} @@ -8645,7 +8560,7 @@ of real structure in a \LaTeX{} document body). \global\Etoc@stoptoctrue \gdef\etoclocaltop{-\thr@@}% \Etoc@tableofcontents - \expandafter\expandafter\expandafter\Etoc@gobbletoetoc@ + \expandafter\expandafter\expandafter\Etoc@gobtoetoc@ \fi \else \global\Etoc@stoptocfalse @@ -8812,13 +8727,12 @@ of real structure in a \LaTeX{} document body). % \csbc{Etoc@toctoc}, in order to allow opening of an alignment in the first % argument and closing in the second. % \begin{macrocode} -\long\def\Etoc@gobbletoetoc@ #1\etoc@ {} \newcommand\etocsettocstyle[2]{% \def\Etoc@tableofcontents {% \ifnum\c@tocdepth>\Etoc@minf \else - \expandafter\Etoc@gobbletoetoc@ + \expandafter\Etoc@gobtoetoc@ \fi \Etoc@par \etocbeforetitlehook @@ -8835,10 +8749,12 @@ of real structure in a \LaTeX{} document body). % \begin{macrocode} \def\Etoc@levellist@elt####1{% \expandafter\def\csname etocsaved####1tocline\endcsname - {\PackageWarning{etoc}{\expandafter\string\csname - etocsaved####1tocline\endcsname\space is deprecated - and to be\MessageBreak soon removed from etoc. - Use directly \expandafter\string\csname l@####1\endcsname\MessageBreak }% + {\PackageWarning{etoc}{% + \expandafter\string\csname etocsaved####1tocline\endcsname\space + has been deprecated at 1.1a.\MessageBreak + It will be removed from `etoc' in near feature. \space Use\MessageBreak + \expandafter\string\csname l@####1\endcsname\space directly. \space + Reported}% \expandafter\let\csname etocsaved####1tocline\expandafter\endcsname \csname l@####1\endcsname \csname l@####1\endcsname @@ -9586,13 +9502,14 @@ of real structure in a \LaTeX{} document body). {\AtBeginDocument {\@ifpackageloaded{tocloft} {\if@cftnctoc\else - \PackageWarning {etoc} - {Package `tocloft' was loaded after `etoc'!^^J% -**** to prevent it from overwriting \protect\tableofcontents, it will be tricked^^J% -**** into believing to have been loaded with option `titles'. For better^^J% -**** compatibility, please load `tocloft' before `etoc'}% + \PackageWarningNoLine {etoc} + {Package `tocloft' was loaded after `etoc'.\MessageBreak + To prevent it from overwriting \protect\tableofcontents, it will\MessageBreak + be tricked into believing to have been loaded with its\MessageBreak + option `titles'. \space Please load `tocloft' before `etoc'}% \AtEndDocument{\PackageWarning{etoc} - {Please load `tocloft' /before/ `etoc'!}}\fi + {Please load `tocloft' before `etoc'!\@gobbletwo}}% + \fi \@cftnctoctrue }% {}% }% @@ -9728,18 +9645,19 @@ of real structure in a \LaTeX{} document body). % incompatible things etoc needs to revert. % \begin{macrocode} \def\Etoc@tocvsec@err #1{\PackageError {etoc} - {the command \protect#1\space is incompatible with etoc} - {use \protect\etocsettocdepth.toc as replacement (see etoc manual)}% + {The command \protect#1\space is incompatible with `etoc'} + {Use \protect\etocsettocdepth.toc as replacement}% }% \AtBeginDocument {% \@ifclassloaded{memoir} {\PackageInfo {etoc} - {Regarding memoir class command \protect\settocdepth, consider^^J - \protect\etocsettocdepth.toc as a drop-in replacement with - more capabilities^^J (see etoc manual). Similarly - \protect\etocsettocdepth\space and - \protect\etocsetnexttocdepth^^J should replace - use of memoir's \protect\maxtocdepth\space command.}} + {Regarding `memoir' class command \protect\settocdepth, consider\MessageBreak + \protect\etocsettocdepth.toc as a drop-in replacement with more\MessageBreak + capabilities (see `etoc' manual). \space + Also, \protect\etocsettocdepth\MessageBreak + and \protect\etocsetnexttocdepth\space should be used in place of\MessageBreak + `memoir' command \protect\maxtocdepth\@gobble}% + }% {\@ifpackageloaded {tocvsec2} {\def\maxtocdepth #1{\Etoc@tocvsec@err \maxtocdepth }% \def\settocdepth #1{\Etoc@tocvsec@err \settocdepth }% @@ -9753,11 +9671,12 @@ of real structure in a \LaTeX{} document body). \let\reset@tocdepth\relax \let\remax@tocdepth\relax \let\tableofcontents\etoctableofcontents - \PackageWarning {etoc} - {package tocvsec2 detected and its modification of^^J - \protect\tableofcontents\space reverted. Use - \protect\etocsettocdepth.toc as a replacement^^J - for the tocvsec2 toc-related commands}}{}% + \PackageWarningNoLine {etoc} + {Package `tocvsec2' detected and its modification of\MessageBreak + \protect\tableofcontents\space reverted. \space Use + \protect\etocsettocdepth.toc\MessageBreak as a replacement + for `tocvsec2' toc-related commands}}% tocvsec2 loaded + {}% not loaded }% }% % \end{macrocode} diff --git a/Master/texmf-dist/tex/latex/etoc/etoc.sty b/Master/texmf-dist/tex/latex/etoc/etoc.sty index 501228b21f8..1268084daca 100644 --- a/Master/texmf-dist/tex/latex/etoc/etoc.sty +++ b/Master/texmf-dist/tex/latex/etoc/etoc.sty @@ -22,16 +22,18 @@ %% in the same archive or directory.) %% %% Package: etoc -%% Version: 1.1b +%% Version: 1.1c %% License: LPPL 1.3c %% Copyright (C) 2012-2023 Jean-Francois Burnol %% <jfbu at free dot fr> \NeedsTeXFormat{LaTeX2e}[2020/10/01] \ProvidesPackage{etoc} -[2023/01/15 v1.1b Completely customisable TOCs (JFB)] +[2023/01/20 v1.1c Completely customisable TOCs (JFB)] \RequirePackage{multicol} \DeclareOption*{\PackageWarning{etoc}{Option `\CurrentOption' is unknown.}} \ProcessOptions\relax +\def\etoc@{\etoc@} +\long\def\Etoc@gobtoetoc@ #1\etoc@{} \newtoks\Etoc@toctoks \def\Etoc@par{\par} \def\etocinline{\def\Etoc@par{}} @@ -66,8 +68,6 @@ \def\etocdoesnotcheckemptiness {\Etoc@checksemptinessfalse } \newif\ifEtoc@notocifnotoc \def\etocnotocifnotoc {\Etoc@checksemptinesstrue\Etoc@notocifnotoctrue } -\def\etoc@{\etoc@} -\newif\ifEtoc@bracedname \newcounter{etoc@tocid} \newcounter{etoc@tocdepth} \@ifclassloaded{memoir}{\def\Etoc@minf{-\thr@@}}{\def\Etoc@minf{-\tw@}} @@ -135,8 +135,10 @@ \expandafter\let \csname Etoc@#1@\endcsname\Etoc@@minustwo@ \else \PackageWarning{etoc} - {unexpected value `#2' in \string\etocsetlevel.^^J% - Should be -2,-1, 0, 1, 2, 3, 4, 5, or 6. Set to 6 (=ignored)}% + {Unexpected value `#2' in \string\etocsetlevel.\MessageBreak + It must be one of -2,-1, 0, 1, 2, 3, 4, 5, or 6 and\MessageBreak + will be set to 6: the \string\contentsline\space entries of type\MessageBreak + `#1' will be ignored by `etoc'.\MessageBreak Reported}% \expandafter\let\csname Etoc@#1@@\endcsname\Etoc@@six@@ \fi \fi @@ -335,8 +337,8 @@ \fi \Etoc@global\def\etocthepage {#2}% \ifEtoc@hyperref - \ifx\etocthepage\ltx@empty - \Etoc@global\let\etocthelinkedpage\etocthepage + \ifx\etocthepage\@empty + \Etoc@global\let\etocthelinkedpage\@empty \else \Etoc@global\def\etocthelinkedpage{\hyperlink {#3}{#2}}% \fi @@ -344,159 +346,93 @@ \Etoc@global\let\etocthelinkedpage\etocthepage \fi \Etoc@global\def\etocthename{#1}% + \futurelet\Etoc@getnb@token\Etoc@@getnb #1\hspace\etoc@ \ifEtoc@hyperref - \Etoc@global\def\etocthelinkedname{\hyperlink{#3}{#1}}% - \else - \Etoc@global\let\etocthelinkedname\etocthename - \fi - \futurelet\Etoc@getnb@token - \Etoc@@getnb #1\relax\relax\etoc@ - \ifEtoc@number - \else - \ifnum\Etoc@level=\m@ne - \futurelet\Etoc@getit@token - \Etoc@@getit #1\hspace\relax\etoc@ - \fi - \fi - \ifEtoc@number - \ifEtoc@hyperref - \def\Etoc@tmp##1##2{\Etoc@global\def##2{\hyperlink{#3}{##1}}}% - \expandafter\Etoc@tmp\expandafter{\etocthename}\etocthelinkedname + \def\Etoc@tmp##1##2{\Etoc@global\def##2{\hyperlink{#3}{##1}}}% + \expandafter\Etoc@tmp\expandafter{\etocthename}\etocthelinkedname + \ifEtoc@number \expandafter\Etoc@tmp\expandafter{\etocthenumber}\etocthelinkednumber \else - \Etoc@global\let\etocthelinkedname\etocthename - \Etoc@global\let\etocthelinkednumber\etocthenumber + \Etoc@global\let\etocthelinkednumber\@empty \fi \else - \Etoc@global\let\etocthenumber\@empty - \Etoc@global\let\etocthelinkednumber\@empty + \Etoc@global\let\etocthelinkedname \etocthename + \Etoc@global\let\etocthelinkednumber\etocthenumber \fi - \Etoc@global\expandafter\let\csname etoclink \endcsname\etocthelink - \Etoc@global\expandafter\let\csname etocname \endcsname\etocthename + \Etoc@global\expandafter\let\csname etoclink \endcsname \etocthelink + \Etoc@global\expandafter\let\csname etocname \endcsname \etocthename \Etoc@global\expandafter\let\csname etocnumber \endcsname\etocthenumber - \Etoc@global\expandafter\let\csname etocpage \endcsname\etocthepage + \Etoc@global\expandafter\let\csname etocpage \endcsname \etocthepage \ifEtoc@hyperref - \Etoc@lxyz@hyper + \Etoc@lxyz@linktoc \fi } -\def\Etoc@lxyz@hyper{% +\def\Etoc@lxyz@linktoc{% \ifcase\Hy@linktoc % none: nothing to do \or % section (aka name for etoc): link name and number - \Etoc@global\expandafter\let\csname etocname \endcsname\etocthelinkedname + \Etoc@global\expandafter\let\csname etocname \endcsname\etocthelinkedname \Etoc@global\expandafter\let\csname etocnumber \endcsname\etocthelinkednumber - \or % page. Do as hyperref: add a link only if page number isn't empty. - \ifx\etocthepage\ltx@empty - \else - \Etoc@global\expandafter\let\csname etocpage \endcsname\etocthelinkedpage - \fi + \or % page + \Etoc@global\expandafter\let\csname etocpage \endcsname\etocthelinkedpage \else % all - \Etoc@global\expandafter\let\csname etocname \endcsname\etocthelinkedname + \Etoc@global\expandafter\let\csname etocname \endcsname\etocthelinkedname \Etoc@global\expandafter\let\csname etocnumber \endcsname\etocthelinkednumber - \ifx\etocthepage\ltx@empty - \else - \Etoc@global\expandafter\let\csname etocpage \endcsname\etocthelinkedpage - \fi + \Etoc@global\expandafter\let\csname etocpage \endcsname\etocthelinkedpage \fi } \def\Etoc@@getnb {% - \Etoc@bracednamefalse \let\Etoc@next\Etoc@getnb - \ifx\Etoc@getnb@token\@sptoken\let\Etoc@next\Etoc@getnb@nohyp@nonbr\fi - \ifx\Etoc@getnb@token\bgroup \let\Etoc@next\Etoc@getnb@checkifbraced\fi + \ifx\Etoc@getnb@token\@sptoken\let\Etoc@next\Etoc@getnb@nonbr\fi + \ifx\Etoc@getnb@token\bgroup \let\Etoc@next\Etoc@getnb@nonbr\fi \Etoc@next } -\def\Etoc@tworelax{\relax\relax} -\def\Etoc@getnb@checkifbraced #1#2\etoc@ {% - \def\Etoc@tmp{#2}% - \ifx\Etoc@tmp\Etoc@tworelax - \expandafter\expandafter\expandafter\Etoc@getnb@nameisbraced - \expandafter\@firstofone - \else - \expandafter\Etoc@getnb - \fi {#1}#2\etoc@ -} -\def\Etoc@getnb@nameisbraced {% - \Etoc@bracednametrue - \futurelet\Etoc@getnb@token\Etoc@getnb -} -\def\Etoc@getnb {% - \ifx\Etoc@getnb@token\bgroup - \expandafter\Etoc@getnb@nohyp@nonbr - \else - \expandafter\Etoc@getnb@nohyp - \fi -} -\def\Etoc@getnb@nohyp #1{% +\def\Etoc@getnb #1{% \in@{#1}{\numberline\chapternumberline\partnumberline\booknumberline}% \ifin@ - \let\Etoc@next\Etoc@getnb@nohyp@nmbrd + \let\Etoc@next\Etoc@getnb@nmbrd \else - \let\Etoc@next\Etoc@getnb@nohyp@nonbr + \ifnum\Etoc@level=\m@ne + \let\Etoc@next\Etoc@@getit + \else + \let\Etoc@next\Etoc@getnb@nonbr + \fi \in@{#1}{\nonumberline}% \ifin@ - \ifx\nonumberline\empty - \let\Etoc@next\Etoc@getnb@nohyp@nonumberline - \else - \def\Etoc@next{\expandafter\Etoc@getnb@nohyp@nmbrd}% - \fi + \let\Etoc@next\Etoc@getnb@nonumberline \fi \fi \Etoc@next #1% } -\def\Etoc@getnb@nohyp@nmbrd #1#2#3\relax\relax\etoc@ {% +\def\Etoc@getnb@nmbrd #1#2{% \Etoc@global\Etoc@numbertrue - \Etoc@global\def\etocthenumber {#2}% - \Etoc@global\def\etocthelinkednumber {#2}% - \ifEtoc@bracedname - \Etoc@global\def\etocthename{{#3}}% - \else - \Etoc@global\def\etocthename{#3}% - \fi - \Etoc@global\let\etocthelinkedname \etocthename + \Etoc@global\def\etocthenumber {#2}% + \Etoc@getnb@nmbrd@getname\@empty +}% +\def\Etoc@getnb@nmbrd@getname #1\hspace\etoc@ {% + \Etoc@global\expandafter\def\expandafter\etocthename\expandafter{#1}% } -\def\Etoc@getnb@nohyp@nonbr #1\etoc@ {% +\def\Etoc@getnb@nonbr #1\etoc@ {% \Etoc@global\Etoc@numberfalse - \Etoc@global\let\etocthenumber \@empty - \Etoc@global\let\etocthelinkednumber \@empty + \Etoc@global\let\etocthenumber \@empty } -\def\Etoc@getnb@nohyp@nonumberline #1\relax\relax\etoc@ {% +\def\Etoc@getnb@nonumberline #1\hspace\etoc@ {% \Etoc@global\Etoc@numberfalse - \Etoc@global\let\etocthenumber \@empty - \Etoc@global\let\etocthelinkednumber \@empty - \ifEtoc@bracedname - \Etoc@global\expandafter\def\expandafter\etocthename - \expandafter{\expandafter{#1}}% - \else - \Etoc@global\expandafter\def\expandafter\etocthename\expandafter{#1}% - \fi - \Etoc@global\let\etocthelinkedname \etocthename -} -\def\Etoc@@getit{% - \ifEtoc@bracedname - \expandafter\expandafter\expandafter\Etoc@getit@nameisbraced - \expandafter\@firstofone - \else - \expandafter\Etoc@getit@nohyp - \fi + \Etoc@global\let\etocthenumber \@empty + \Etoc@global\expandafter\def\expandafter\etocthename\expandafter{\@gobble#1}% } -\def\Etoc@getit@nameisbraced {\futurelet\Etoc@getit@token\Etoc@getit@nohyp } -\def\Etoc@getit@nohyp #1\hspace#2#3\etoc@ {% - \ifx\relax#2% +\def\Etoc@@getit #1\hspace#2{% + \ifx\etoc@#2% + \Etoc@global\Etoc@numberfalse + \Etoc@global\let\etocthenumber \@empty \else - \Etoc@global\def\etocthenumber {#1}% - \Etoc@global\def\etocthelinkednumber {#1}% \Etoc@global\Etoc@numbertrue - \Etoc@getit@nohyp@getname #3\etoc@ + \Etoc@global\def\etocthenumber {#1}% + \expandafter\Etoc@getit@getname \expandafter\@empty \fi } -\def\Etoc@getit@nohyp@getname #1\hspace\relax\etoc@ {% - \ifEtoc@bracedname - \Etoc@global\def\etocthename {{#1}}% - \else - \Etoc@global\def\etocthename {#1}% - \fi - \Etoc@global\let\etocthelinkedname\etocthename +\def\Etoc@getit@getname #1\hspace\etoc@ {% + \Etoc@global\expandafter\def\expandafter\etocthename\expandafter{#1}% } \let\etocthename \@empty \let\etocthenumber \@empty @@ -539,7 +475,7 @@ \ifx\hyper@last\@undefined \IfFileExists{\jobname .toc} {\Hy@WarningNoLine - {old toc file detected, not used; run LaTeX again (cheers from etoc)}% + {old toc file detected; run LaTeX again (cheers from `etoc')}% \global\Etoc@toctoks={}% } {}% @@ -663,11 +599,11 @@ \global\Etoc@emptytocfalse \edef\Etoc@tocid{#1}% \ifnum\Etoc@tocid<\@ne - \setbox0\hbox{\ref{Unknown toc ref \@secondoftwo#1. Rerun LaTeX}}% + \setbox0\hbox{\ref{Unknown toc ref \@secondoftwo#1. \space Rerun LaTeX}}% \global\Etoc@stoptoctrue \gdef\etoclocaltop{-\thr@@}% \Etoc@tableofcontents - \expandafter\Etoc@gobbletoetoc@ + \expandafter\Etoc@gobtoetoc@ \fi \global\Etoc@notactivetrue \ifEtoc@checksemptiness @@ -675,12 +611,12 @@ \fi \ifEtoc@emptytoc \ifEtoc@notactive - \setbox0\hbox{\ref{Unknown toc ID \number\Etoc@tocid. Rerun LaTeX}}% + \setbox0\hbox{\ref{Unknown toc ID \number\Etoc@tocid. \space Rerun LaTeX}}% \global\Etoc@emptytocfalse \global\Etoc@stoptoctrue \gdef\etoclocaltop{-\thr@@}% \Etoc@tableofcontents - \expandafter\expandafter\expandafter\Etoc@gobbletoetoc@ + \expandafter\expandafter\expandafter\Etoc@gobtoetoc@ \fi \else \global\Etoc@stoptocfalse @@ -755,13 +691,12 @@ \localtableofcontents }% \localtableofcontentswithrelativedepth \let\Etoc@localtocdepth\c@tocdepth -\long\def\Etoc@gobbletoetoc@ #1\etoc@ {} \newcommand\etocsettocstyle[2]{% \def\Etoc@tableofcontents {% \ifnum\c@tocdepth>\Etoc@minf \else - \expandafter\Etoc@gobbletoetoc@ + \expandafter\Etoc@gobtoetoc@ \fi \Etoc@par \etocbeforetitlehook @@ -772,10 +707,12 @@ \else \def\Etoc@levellist@elt####1{% \expandafter\def\csname etocsaved####1tocline\endcsname - {\PackageWarning{etoc}{\expandafter\string\csname - etocsaved####1tocline\endcsname\space is deprecated - and to be\MessageBreak soon removed from etoc. - Use directly \expandafter\string\csname l@####1\endcsname\MessageBreak }% + {\PackageWarning{etoc}{% + \expandafter\string\csname etocsaved####1tocline\endcsname\space + has been deprecated at 1.1a.\MessageBreak + It will be removed from `etoc' in near feature. \space Use\MessageBreak + \expandafter\string\csname l@####1\endcsname\space directly. \space + Reported}% \expandafter\let\csname etocsaved####1tocline\expandafter\endcsname \csname l@####1\endcsname \csname l@####1\endcsname @@ -1349,13 +1286,14 @@ {\AtBeginDocument {\@ifpackageloaded{tocloft} {\if@cftnctoc\else - \PackageWarning {etoc} - {Package `tocloft' was loaded after `etoc'!^^J% -**** to prevent it from overwriting \protect\tableofcontents, it will be tricked^^J% -**** into believing to have been loaded with option `titles'. For better^^J% -**** compatibility, please load `tocloft' before `etoc'}% + \PackageWarningNoLine {etoc} + {Package `tocloft' was loaded after `etoc'.\MessageBreak + To prevent it from overwriting \protect\tableofcontents, it will\MessageBreak + be tricked into believing to have been loaded with its\MessageBreak + option `titles'. \space Please load `tocloft' before `etoc'}% \AtEndDocument{\PackageWarning{etoc} - {Please load `tocloft' /before/ `etoc'!}}\fi + {Please load `tocloft' before `etoc'!\@gobbletwo}}% + \fi \@cftnctoctrue }% {}% }% @@ -1457,18 +1395,19 @@ {\@namedef{Etoc@depthof@#1}{\@nameuse{Etoc@#2@@}}}% } \def\Etoc@tocvsec@err #1{\PackageError {etoc} - {the command \protect#1\space is incompatible with etoc} - {use \protect\etocsettocdepth.toc as replacement (see etoc manual)}% + {The command \protect#1\space is incompatible with `etoc'} + {Use \protect\etocsettocdepth.toc as replacement}% }% \AtBeginDocument {% \@ifclassloaded{memoir} {\PackageInfo {etoc} - {Regarding memoir class command \protect\settocdepth, consider^^J - \protect\etocsettocdepth.toc as a drop-in replacement with - more capabilities^^J (see etoc manual). Similarly - \protect\etocsettocdepth\space and - \protect\etocsetnexttocdepth^^J should replace - use of memoir's \protect\maxtocdepth\space command.}} + {Regarding `memoir' class command \protect\settocdepth, consider\MessageBreak + \protect\etocsettocdepth.toc as a drop-in replacement with more\MessageBreak + capabilities (see `etoc' manual). \space + Also, \protect\etocsettocdepth\MessageBreak + and \protect\etocsetnexttocdepth\space should be used in place of\MessageBreak + `memoir' command \protect\maxtocdepth\@gobble}% + }% {\@ifpackageloaded {tocvsec2} {\def\maxtocdepth #1{\Etoc@tocvsec@err \maxtocdepth }% \def\settocdepth #1{\Etoc@tocvsec@err \settocdepth }% @@ -1479,11 +1418,12 @@ \let\reset@tocdepth\relax \let\remax@tocdepth\relax \let\tableofcontents\etoctableofcontents - \PackageWarning {etoc} - {package tocvsec2 detected and its modification of^^J - \protect\tableofcontents\space reverted. Use - \protect\etocsettocdepth.toc as a replacement^^J - for the tocvsec2 toc-related commands}}{}% + \PackageWarningNoLine {etoc} + {Package `tocvsec2' detected and its modification of\MessageBreak + \protect\tableofcontents\space reverted. \space Use + \protect\etocsettocdepth.toc\MessageBreak as a replacement + for `tocvsec2' toc-related commands}}% tocvsec2 loaded + {}% not loaded }% }% \def\invisibletableofcontents {\etocsetnexttocdepth {-3}\tableofcontents }% |