texlive[65550] Master/texmf-dist: etoc (15jan23)
commits+karl at tug.org
commits+karl at tug.org
Sun Jan 15 21:55:22 CET 2023
Revision: 65550
http://tug.org/svn/texlive?view=revision&revision=65550
Author: karl
Date: 2023-01-15 21:55:22 +0100 (Sun, 15 Jan 2023)
Log Message:
-----------
etoc (15jan23)
Modified Paths:
--------------
trunk/Master/texmf-dist/doc/latex/etoc/README.md
trunk/Master/texmf-dist/doc/latex/etoc/etoc.pdf
trunk/Master/texmf-dist/doc/latex/etoc/etoc.tex
trunk/Master/texmf-dist/doc/latex/etoc/etocsnippet-01.tex
trunk/Master/texmf-dist/doc/latex/etoc/etocsnippet-02.tex
trunk/Master/texmf-dist/doc/latex/etoc/etocsnippet-03.tex
trunk/Master/texmf-dist/doc/latex/etoc/etocsnippet-04.tex
trunk/Master/texmf-dist/doc/latex/etoc/etocsnippet-05.tex
trunk/Master/texmf-dist/doc/latex/etoc/etocsnippet-06.tex
trunk/Master/texmf-dist/doc/latex/etoc/etocsnippet-07.tex
trunk/Master/texmf-dist/doc/latex/etoc/etocsnippet-08.tex
trunk/Master/texmf-dist/doc/latex/etoc/etocsnippet-09.tex
trunk/Master/texmf-dist/doc/latex/etoc/etocsnippet-10.tex
trunk/Master/texmf-dist/doc/latex/etoc/etocsnippet-11.tex
trunk/Master/texmf-dist/doc/latex/etoc/etocsnippet-12.tex
trunk/Master/texmf-dist/doc/latex/etoc/etocsnippet-13.tex
trunk/Master/texmf-dist/doc/latex/etoc/etocsnippet-14.tex
trunk/Master/texmf-dist/doc/latex/etoc/etocsnippet-15.tex
trunk/Master/texmf-dist/doc/latex/etoc/etocsnippet-16.tex
trunk/Master/texmf-dist/doc/latex/etoc/etocsnippet-17.tex
trunk/Master/texmf-dist/doc/latex/etoc/etocsnippet-18.tex
trunk/Master/texmf-dist/doc/latex/etoc/etocsnippet-19.tex
trunk/Master/texmf-dist/doc/latex/etoc/etocsnippet-20.tex
trunk/Master/texmf-dist/doc/latex/etoc/etocsnippet-21.tex
trunk/Master/texmf-dist/doc/latex/etoc/etocsnippet-22.tex
trunk/Master/texmf-dist/doc/latex/etoc/etocsnippet-23.tex
trunk/Master/texmf-dist/doc/latex/etoc/etocsnippet-24.tex
trunk/Master/texmf-dist/doc/latex/etoc/etocsnippet-25.tex
trunk/Master/texmf-dist/doc/latex/etoc/etocsnippet-26.tex
trunk/Master/texmf-dist/doc/latex/etoc/etocsnippet-27.tex
trunk/Master/texmf-dist/source/latex/etoc/etoc.dtx
trunk/Master/texmf-dist/tex/latex/etoc/etoc.sty
Modified: trunk/Master/texmf-dist/doc/latex/etoc/README.md
===================================================================
--- trunk/Master/texmf-dist/doc/latex/etoc/README.md 2023-01-15 20:54:58 UTC (rev 65549)
+++ trunk/Master/texmf-dist/doc/latex/etoc/README.md 2023-01-15 20:55:22 UTC (rev 65550)
@@ -1,10 +1,10 @@
<!-- -->
- Source: etoc.dtx (1.09i)
+ Source: etoc.dtx (1.1a)
Author: Jean-Francois Burnol
Info: Completely customisable TOCs
License: LPPL 1.3c
- Copyright (C) 2012-2022 Jean-Francois Burnol.
+ Copyright (C) 2012-2023 Jean-Francois Burnol.
<jfbu at free dot fr>
ABSTRACT
@@ -97,6 +97,34 @@
RECENT CHANGES
==============
+1.1a \[2023/01/14\]
+----------------------
+
+This version brings no new functionality, despite the number bump.
+It implements a complete rewrite of old legacy core internals.
+Formerly, etoc waited for
+[hyperref](https://ctan.org/pkg/hyperref)
+(if present) to have added hyperlinks via its patch to LaTeX's
+`\contentsline`. etoc examined the arguments of `\l at section` and
+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`.
+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.
+
+`\etoclink` now wraps its argument in an hyperlink even if
+[hyperref](https://ctan.org/pkg/hyperref) is configured via
+`linktoc=none`. Formerly no hyperlink was added then.
+
+Deprecation of `\etocsavedsectiontocline` and similarly named
+commands. They are not needed as `\l at 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.
+
1.09i \[2022/11/21\]
--------------------
Modified: trunk/Master/texmf-dist/doc/latex/etoc/etoc.pdf
===================================================================
(Binary files differ)
Modified: trunk/Master/texmf-dist/doc/latex/etoc/etoc.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/etoc/etoc.tex 2023-01-15 20:54:58 UTC (rev 65549)
+++ trunk/Master/texmf-dist/doc/latex/etoc/etoc.tex 2023-01-15 20:55:22 UTC (rev 65550)
@@ -1,8 +1,8 @@
%%
%% Package: etoc
-%% Version: 1.09i
+%% Version: 1.1a
%% License: LPPL 1.3c
-%% Copyright (C) 2012-2022 Jean-Francois Burnol
+%% 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.
Modified: trunk/Master/texmf-dist/doc/latex/etoc/etocsnippet-01.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/etoc/etocsnippet-01.tex 2023-01-15 20:54:58 UTC (rev 65549)
+++ trunk/Master/texmf-dist/doc/latex/etoc/etocsnippet-01.tex 2023-01-15 20:55:22 UTC (rev 65550)
@@ -1,6 +1,6 @@
%% LaTeX2e file `etocsnippet-01.tex'
%% generated by the `filecontentsdef' environment
-%% from source `etoc' on 2022/11/21.
+%% from source `etoc' on 2023/01/15.
%%
\begingroup\parindent 0pt \parfillskip 0pt \leftskip 0cm \rightskip 1cm
\etocsetstyle {section}
Modified: trunk/Master/texmf-dist/doc/latex/etoc/etocsnippet-02.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/etoc/etocsnippet-02.tex 2023-01-15 20:54:58 UTC (rev 65549)
+++ trunk/Master/texmf-dist/doc/latex/etoc/etocsnippet-02.tex 2023-01-15 20:55:22 UTC (rev 65550)
@@ -1,6 +1,6 @@
%% LaTeX2e file `etocsnippet-02.tex'
%% generated by the `filecontentsdef' environment
-%% from source `etoc' on 2022/11/21.
+%% from source `etoc' on 2023/01/15.
%%
\begingroup
\newcommand*{\DotsAndPage}
Modified: trunk/Master/texmf-dist/doc/latex/etoc/etocsnippet-03.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/etoc/etocsnippet-03.tex 2023-01-15 20:54:58 UTC (rev 65549)
+++ trunk/Master/texmf-dist/doc/latex/etoc/etocsnippet-03.tex 2023-01-15 20:55:22 UTC (rev 65550)
@@ -1,6 +1,6 @@
%% LaTeX2e file `etocsnippet-03.tex'
%% generated by the `filecontentsdef' environment
-%% from source `etoc' on 2022/11/21.
+%% from source `etoc' on 2023/01/15.
%%
\begingroup % we start a group to keep the style changes local
\newlength{\tocleftmargin} \setlength{\tocleftmargin}{5cm}
Modified: trunk/Master/texmf-dist/doc/latex/etoc/etocsnippet-04.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/etoc/etocsnippet-04.tex 2023-01-15 20:54:58 UTC (rev 65549)
+++ trunk/Master/texmf-dist/doc/latex/etoc/etocsnippet-04.tex 2023-01-15 20:55:22 UTC (rev 65550)
@@ -1,6 +1,6 @@
%% LaTeX2e file `etocsnippet-04.tex'
%% generated by the `filecontentsdef' environment
-%% from source `etoc' on 2022/11/21.
+%% from source `etoc' on 2023/01/15.
%%
\begin{figure}[ht!]
\centering
Modified: trunk/Master/texmf-dist/doc/latex/etoc/etocsnippet-05.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/etoc/etocsnippet-05.tex 2023-01-15 20:54:58 UTC (rev 65549)
+++ trunk/Master/texmf-dist/doc/latex/etoc/etocsnippet-05.tex 2023-01-15 20:55:22 UTC (rev 65550)
@@ -1,6 +1,6 @@
%% LaTeX2e file `etocsnippet-05.tex'
%% generated by the `filecontentshere' environment
-%% from source `etoc' on 2022/11/21.
+%% from source `etoc' on 2023/01/15.
%%
\makeatletter
\newcommand{\MyStandardTOC}{%
@@ -7,17 +7,17 @@
\begingroup
% for the book or article classes:
%\etocsetstyle{part}{}{}
- % {\etocsavedparttocline{\etocnumber\hspace{1em}\etocname}{\etocpage}}{}%
+ % {\l at part{\etocnumber\hspace{1em}\etocname}{\etocpage}}{}%
% for the scrbook or scrartcl classes:
\etocsetstyle{part}{}{}
- {\etocsavedparttocline{\numberline{\etocnumber}\etocname}{\etocpage}}{}%
+ {\l at part{\numberline{\etocnumber}\etocname}{\etocpage}}{}%
% following is identical in book/article/scrbook/scrartcl classes:
\etocsetstyle{chapter}{}{} %%% only for book and scrbook
- {\etocsavedchaptertocline{\numberline{\etocnumber}\etocname}{\etocpage}}{}%
+ {\l at chapter{\numberline{\etocnumber}\etocname}{\etocpage}}{}%
\etocsetstyle{section}{}{}
- {\etocsavedsectiontocline{\numberline{\etocnumber}\etocname}{\etocpage}}{}%
+ {\l at section{\numberline{\etocnumber}\etocname}{\etocpage}}{}%
\etocsetstyle{subsection}{}{}
- {\etocsavedsubsectiontocline{\numberline{\etocnumber}\etocname}{\etocpage}}{}%
+ {\l at subsection{\numberline{\etocnumber}\etocname}{\etocpage}}{}%
% etc... if further sectioning units are used
\etocstandarddisplaystyle % this is for the title, page-marks, etc...
\tableofcontents
Modified: trunk/Master/texmf-dist/doc/latex/etoc/etocsnippet-06.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/etoc/etocsnippet-06.tex 2023-01-15 20:54:58 UTC (rev 65549)
+++ trunk/Master/texmf-dist/doc/latex/etoc/etocsnippet-06.tex 2023-01-15 20:55:22 UTC (rev 65550)
@@ -1,26 +1,36 @@
%% LaTeX2e file `etocsnippet-06.tex'
%% generated by the `filecontentshere' environment
-%% from source `etoc' on 2022/11/21.
+%% from source `etoc' on 2023/01/15.
%%
-\etocsetstyle{section}{}
- {\ifnum\etocthenumber=4
+\makeatletter
+\newcommand*{\MyQuasiStandardTOC}[1]{%
+ \begingroup
+ \etocsetstyle{section}
+ {}
+ {\ifnum\etocthenumber=4
\etocsetstyle{subsection}
{\par\nopagebreak\begingroup
- \leftskip1.5em \rightskip\@tocrmarg \parfillskip\@flushglue
- \parindent 0pt \normalfont\normalsize\rmfamily\itshape
- % \columnsep1em
- % \begin{minipage}{\dimexpr\linewidth-\leftskip-\rightskip\relax}%
- % \begin{multicols}{2}%
+ \leftskip1.5em \rightskip\@tocrmarg
+ \parfillskip \@flushglue
+ \parindent 0pt
+ \normalfont\normalsize\rmfamily\itshape
\etocskipfirstprefix}
{\allowbreak\,--\,}
{\etocname\ \textup{(\etocnumber)}}
{.\par\endgroup}%
- % {.\par\end{multicols}\end{minipage}\par\endgroup}%
- \else
- \etocsetstyle{subsection}
- {}{}
- {\etocsavedsubsectiontocline{\numberline{\etocnumber}\etocname}{\etocpage}}
- {}%
- \fi}
- {\etocsavedsectiontocline{\numberline{{\color{cyan}\etocthenumber}}\etocname}{\etocpage}}
- {}%
+ \else
+ \etocsetstyle{subsection}
+ {}%
+ {}%
+ {\l at subsection{\numberline{\etocnumber}\etocname}{\etocpage}}%
+ {}%
+ \fi
+ }% prefix for section sets the style dynamically for subsections!
+ {\l at section{\numberline{{\color{cyan}\etocthenumber}}\etocname}{\etocpage}}%
+ {}%
+ \etocstandarddisplaystyle
+ \etocsetnexttocdepth {2}%
+ \tableofcontents #1
+ \endgroup
+}
+\makeatother
Modified: trunk/Master/texmf-dist/doc/latex/etoc/etocsnippet-07.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/etoc/etocsnippet-07.tex 2023-01-15 20:54:58 UTC (rev 65549)
+++ trunk/Master/texmf-dist/doc/latex/etoc/etocsnippet-07.tex 2023-01-15 20:55:22 UTC (rev 65550)
@@ -1,6 +1,6 @@
%% LaTeX2e file `etocsnippet-07.tex'
%% generated by the `filecontentshere' environment
-%% from source `etoc' on 2022/11/21.
+%% from source `etoc' on 2023/01/15.
%%
% it will be easy to globally shift the TOC horizontally if needed
\def\TOCleftmargin {0pt}
Modified: trunk/Master/texmf-dist/doc/latex/etoc/etocsnippet-08.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/etoc/etocsnippet-08.tex 2023-01-15 20:54:58 UTC (rev 65549)
+++ trunk/Master/texmf-dist/doc/latex/etoc/etocsnippet-08.tex 2023-01-15 20:55:22 UTC (rev 65550)
@@ -1,6 +1,6 @@
%% LaTeX2e file `etocsnippet-08.tex'
%% generated by the `filecontentshere' environment
-%% from source `etoc' on 2022/11/21.
+%% from source `etoc' on 2023/01/15.
%%
\makeatletter
\newcommand*\TOClocalstyle {%
Modified: trunk/Master/texmf-dist/doc/latex/etoc/etocsnippet-09.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/etoc/etocsnippet-09.tex 2023-01-15 20:54:58 UTC (rev 65549)
+++ trunk/Master/texmf-dist/doc/latex/etoc/etocsnippet-09.tex 2023-01-15 20:55:22 UTC (rev 65550)
@@ -1,6 +1,6 @@
%% LaTeX2e file `etocsnippet-09.tex'
%% generated by the `filecontentshere' environment
-%% from source `etoc' on 2022/11/21.
+%% from source `etoc' on 2023/01/15.
%%
\etocdefaultlines
\begingroup
Modified: trunk/Master/texmf-dist/doc/latex/etoc/etocsnippet-10.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/etoc/etocsnippet-10.tex 2023-01-15 20:54:58 UTC (rev 65549)
+++ trunk/Master/texmf-dist/doc/latex/etoc/etocsnippet-10.tex 2023-01-15 20:55:22 UTC (rev 65550)
@@ -1,6 +1,6 @@
%% LaTeX2e file `etocsnippet-10.tex'
%% generated by the `filecontentshere' environment
-%% from source `etoc' on 2022/11/21.
+%% from source `etoc' on 2023/01/15.
%%
\begin{figure}[htbp!]\centering
\colorlet{subsecnum}{black}
Modified: trunk/Master/texmf-dist/doc/latex/etoc/etocsnippet-11.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/etoc/etocsnippet-11.tex 2023-01-15 20:54:58 UTC (rev 65549)
+++ trunk/Master/texmf-dist/doc/latex/etoc/etocsnippet-11.tex 2023-01-15 20:55:22 UTC (rev 65550)
@@ -1,6 +1,6 @@
%% LaTeX2e file `etocsnippet-11.tex'
%% generated by the `filecontentsdef' environment
-%% from source `etoc' on 2022/11/21.
+%% from source `etoc' on 2023/01/15.
%%
\begingroup
\newsavebox{\forsubsections}
Modified: trunk/Master/texmf-dist/doc/latex/etoc/etocsnippet-12.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/etoc/etocsnippet-12.tex 2023-01-15 20:54:58 UTC (rev 65549)
+++ trunk/Master/texmf-dist/doc/latex/etoc/etocsnippet-12.tex 2023-01-15 20:55:22 UTC (rev 65550)
@@ -1,6 +1,6 @@
%% LaTeX2e file `etocsnippet-12.tex'
%% generated by the `filecontentshere' environment
-%% from source `etoc' on 2022/11/21.
+%% from source `etoc' on 2023/01/15.
%%
< in the preamble >
\newcounter{visibletoc}
Modified: trunk/Master/texmf-dist/doc/latex/etoc/etocsnippet-13.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/etoc/etocsnippet-13.tex 2023-01-15 20:54:58 UTC (rev 65549)
+++ trunk/Master/texmf-dist/doc/latex/etoc/etocsnippet-13.tex 2023-01-15 20:55:22 UTC (rev 65550)
@@ -1,6 +1,6 @@
%% LaTeX2e file `etocsnippet-13.tex'
%% generated by the `filecontentshere' environment
-%% from source `etoc' on 2022/11/21.
+%% from source `etoc' on 2023/01/15.
%%
\etocsetnexttocdepth{2} % sections are at level 1 and will show up
\begingroup
Modified: trunk/Master/texmf-dist/doc/latex/etoc/etocsnippet-14.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/etoc/etocsnippet-14.tex 2023-01-15 20:54:58 UTC (rev 65549)
+++ trunk/Master/texmf-dist/doc/latex/etoc/etocsnippet-14.tex 2023-01-15 20:55:22 UTC (rev 65550)
@@ -1,6 +1,6 @@
%% LaTeX2e file `etocsnippet-14.tex'
%% generated by the `filecontentsdef' environment
-%% from source `etoc' on 2022/11/21.
+%% from source `etoc' on 2023/01/15.
%%
% \newtoks\treetok % put this (uncommented) preferably in the preamble
% \newtoks\tmptok % (idem)
Modified: trunk/Master/texmf-dist/doc/latex/etoc/etocsnippet-15.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/etoc/etocsnippet-15.tex 2023-01-15 20:54:58 UTC (rev 65549)
+++ trunk/Master/texmf-dist/doc/latex/etoc/etocsnippet-15.tex 2023-01-15 20:55:22 UTC (rev 65550)
@@ -1,6 +1,6 @@
%% LaTeX2e file `etocsnippet-15.tex'
%% generated by the `filecontentshere' environment
-%% from source `etoc' on 2022/11/21.
+%% from source `etoc' on 2023/01/15.
%%
% \newtoks\treetok % put this (uncommented) preferably in the preamble
% \newtoks\sectiontok
Modified: trunk/Master/texmf-dist/doc/latex/etoc/etocsnippet-16.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/etoc/etocsnippet-16.tex 2023-01-15 20:54:58 UTC (rev 65549)
+++ trunk/Master/texmf-dist/doc/latex/etoc/etocsnippet-16.tex 2023-01-15 20:55:22 UTC (rev 65550)
@@ -1,6 +1,6 @@
%% LaTeX2e file `etocsnippet-16.tex'
%% generated by the `filecontentsdef' environment
-%% from source `etoc' on 2022/11/21.
+%% from source `etoc' on 2023/01/15.
%%
\begingroup
% \newtoks\treetok % done in preamble
Modified: trunk/Master/texmf-dist/doc/latex/etoc/etocsnippet-17.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/etoc/etocsnippet-17.tex 2023-01-15 20:54:58 UTC (rev 65549)
+++ trunk/Master/texmf-dist/doc/latex/etoc/etocsnippet-17.tex 2023-01-15 20:55:22 UTC (rev 65550)
@@ -1,6 +1,6 @@
%% LaTeX2e file `etocsnippet-17.tex'
%% generated by the `filecontentsdef' environment
-%% from source `etoc' on 2022/11/21.
+%% from source `etoc' on 2023/01/15.
%%
\begingroup
\etocglobaldefs % necessary for \etocname etc... to survive &
Modified: trunk/Master/texmf-dist/doc/latex/etoc/etocsnippet-18.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/etoc/etocsnippet-18.tex 2023-01-15 20:54:58 UTC (rev 65549)
+++ trunk/Master/texmf-dist/doc/latex/etoc/etocsnippet-18.tex 2023-01-15 20:55:22 UTC (rev 65550)
@@ -1,6 +1,6 @@
%% LaTeX2e file `etocsnippet-18.tex'
%% generated by the `filecontentsdef' environment
-%% from source `etoc' on 2022/11/21.
+%% from source `etoc' on 2023/01/15.
%%
\begin{center}
\etocsetstyle{section}
Modified: trunk/Master/texmf-dist/doc/latex/etoc/etocsnippet-19.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/etoc/etocsnippet-19.tex 2023-01-15 20:54:58 UTC (rev 65549)
+++ trunk/Master/texmf-dist/doc/latex/etoc/etocsnippet-19.tex 2023-01-15 20:55:22 UTC (rev 65550)
@@ -1,6 +1,6 @@
%% LaTeX2e file `etocsnippet-19.tex'
%% generated by the `filecontentshere' environment
-%% from source `etoc' on 2022/11/21.
+%% from source `etoc' on 2023/01/15.
%%
\makeatletter
\newcommand*\TOCcompute at numwidths [2]{% #1=empty/"local", #2=minimal indent
Modified: trunk/Master/texmf-dist/doc/latex/etoc/etocsnippet-20.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/etoc/etocsnippet-20.tex 2023-01-15 20:54:58 UTC (rev 65549)
+++ trunk/Master/texmf-dist/doc/latex/etoc/etocsnippet-20.tex 2023-01-15 20:55:22 UTC (rev 65550)
@@ -1,6 +1,6 @@
%% LaTeX2e file `etocsnippet-20.tex'
%% generated by the `filecontentshere' environment
-%% from source `etoc' on 2022/11/21.
+%% from source `etoc' on 2023/01/15.
%%
\etocsetstyle{section}
{\begin{enumerate}}
Modified: trunk/Master/texmf-dist/doc/latex/etoc/etocsnippet-21.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/etoc/etocsnippet-21.tex 2023-01-15 20:54:58 UTC (rev 65549)
+++ trunk/Master/texmf-dist/doc/latex/etoc/etocsnippet-21.tex 2023-01-15 20:55:22 UTC (rev 65550)
@@ -1,6 +1,6 @@
%% LaTeX2e file `etocsnippet-21.tex'
%% generated by the `filecontentshere' environment
-%% from source `etoc' on 2022/11/21.
+%% from source `etoc' on 2023/01/15.
%%
\etocsettocdepth {subsubsection} % set the initial tocdepth
\etocdefaultlines % use the package default line styles. At this early stage in
Modified: trunk/Master/texmf-dist/doc/latex/etoc/etocsnippet-22.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/etoc/etocsnippet-22.tex 2023-01-15 20:54:58 UTC (rev 65549)
+++ trunk/Master/texmf-dist/doc/latex/etoc/etocsnippet-22.tex 2023-01-15 20:55:22 UTC (rev 65550)
@@ -1,6 +1,6 @@
%% LaTeX2e file `etocsnippet-22.tex'
%% generated by the `filecontentshere' environment
-%% from source `etoc' on 2022/11/21.
+%% from source `etoc' on 2023/01/15.
%%
\etocruledstyle[2]{\normalfont\normalsize\rmfamily\itshape
\fbox{\parbox{.6\linewidth}{
Modified: trunk/Master/texmf-dist/doc/latex/etoc/etocsnippet-23.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/etoc/etocsnippet-23.tex 2023-01-15 20:54:58 UTC (rev 65549)
+++ trunk/Master/texmf-dist/doc/latex/etoc/etocsnippet-23.tex 2023-01-15 20:55:22 UTC (rev 65550)
@@ -1,6 +1,6 @@
%% LaTeX2e file `etocsnippet-23.tex'
%% generated by the `filecontentshere' environment
-%% from source `etoc' on 2022/11/21.
+%% from source `etoc' on 2023/01/15.
%%
\begingroup
\definecolor{subsecnum}{RGB}{13,151,225}
Modified: trunk/Master/texmf-dist/doc/latex/etoc/etocsnippet-24.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/etoc/etocsnippet-24.tex 2023-01-15 20:54:58 UTC (rev 65549)
+++ trunk/Master/texmf-dist/doc/latex/etoc/etocsnippet-24.tex 2023-01-15 20:55:22 UTC (rev 65550)
@@ -1,6 +1,6 @@
%% LaTeX2e file `etocsnippet-24.tex'
%% generated by the `filecontentshere' environment
-%% from source `etoc' on 2022/11/21.
+%% from source `etoc' on 2023/01/15.
%%
\newsavebox\firstnamei \newsavebox\firstnumberi
\newsavebox\lastnamei \newsavebox\lastnumberi
Modified: trunk/Master/texmf-dist/doc/latex/etoc/etocsnippet-25.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/etoc/etocsnippet-25.tex 2023-01-15 20:54:58 UTC (rev 65549)
+++ trunk/Master/texmf-dist/doc/latex/etoc/etocsnippet-25.tex 2023-01-15 20:55:22 UTC (rev 65550)
@@ -1,6 +1,6 @@
%% LaTeX2e file `etocsnippet-25.tex'
%% generated by the `filecontentshere' environment
-%% from source `etoc' on 2022/11/21.
+%% from source `etoc' on 2023/01/15.
%%
\makeatletter
\newcommand*\firstsubname {} \newcommand*\lastsubname {}
Modified: trunk/Master/texmf-dist/doc/latex/etoc/etocsnippet-26.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/etoc/etocsnippet-26.tex 2023-01-15 20:54:58 UTC (rev 65549)
+++ trunk/Master/texmf-dist/doc/latex/etoc/etocsnippet-26.tex 2023-01-15 20:55:22 UTC (rev 65550)
@@ -1,6 +1,6 @@
%% LaTeX2e file `etocsnippet-26.tex'
%% generated by the `filecontentsdef' environment
-%% from source `etoc' on 2022/11/21.
+%% from source `etoc' on 2023/01/15.
%%
\etocsetnexttocdepth {all}
\begingroup
Modified: trunk/Master/texmf-dist/doc/latex/etoc/etocsnippet-27.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/etoc/etocsnippet-27.tex 2023-01-15 20:54:58 UTC (rev 65549)
+++ trunk/Master/texmf-dist/doc/latex/etoc/etocsnippet-27.tex 2023-01-15 20:55:22 UTC (rev 65550)
@@ -1,6 +1,6 @@
%% LaTeX2e file `etocsnippet-27.tex'
%% generated by the `filecontentshere' environment
-%% from source `etoc' on 2022/11/21.
+%% from source `etoc' on 2023/01/15.
%%
\newtoks\toctabletok
\newcommand*\appendtotok[2]{% #1=toks variable, #2=macro, expands once #2
Modified: trunk/Master/texmf-dist/source/latex/etoc/etoc.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex/etoc/etoc.dtx 2023-01-15 20:54:58 UTC (rev 65549)
+++ trunk/Master/texmf-dist/source/latex/etoc/etoc.dtx 2023-01-15 20:55:22 UTC (rev 65550)
@@ -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: <21-11-2022 at 19:35:48 CET>}%
+\def\etocdtxtimestamp {Time-stamp: <14-01-2023 at 21:26:57 CET>}%
%</none>
%<*!readme>
%%
%% Package: etoc
-%% Version: 1.09i
+%% Version: 1.1a
%% License: LPPL 1.3c
-%% Copyright (C) 2012-2022 Jean-Francois Burnol
+%% Copyright (C) 2012-2023 Jean-Francois Burnol
%% <jfbu at free dot fr>
%</!readme>
%<*none>
-\def\etocpkgdate {2022/11/21}
-\def\etocdocdate {2022/11/21}
-\def\etocpkgversion {1.09i}
+\def\etocpkgdate {2023/01/14}
+\def\etocdocdate {2023/01/14}
+\def\etocpkgversion {1.1a}
\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,9 +33,9 @@
\catcode32=13\catcode`\\=12^^Brelax^^A
^^Bfirstofone{^^Bendgroup^^Bdef^^BetocLicense^^A
{% Package: etoc
-% Version: 1.09i
+% Version: 1.1a
% License: LPPL 1.3c
-% Copyright (C) 2012-2022 Jean-Francois Burnol <jfbu at free dot fr>
+% Copyright (C) 2012-2023 Jean-Francois Burnol <jfbu at free dot fr>
%
% This Work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, in its
@@ -60,11 +60,11 @@
%<*readme>
<!-- -->
- Source: etoc.dtx (1.09i)
+ Source: etoc.dtx (1.1a)
Author: Jean-Francois Burnol
Info: Completely customisable TOCs
License: LPPL 1.3c
- Copyright (C) 2012-2022 Jean-Francois Burnol.
+ Copyright (C) 2012-2023 Jean-Francois Burnol.
<jfbu at free dot fr>
ABSTRACT
@@ -157,6 +157,34 @@
RECENT CHANGES
==============
+1.1a \[2023/01/14\]
+----------------------
+
+This version brings no new functionality, despite the number bump.
+It implements a complete rewrite of old legacy core internals.
+Formerly, etoc waited for
+[hyperref](https://ctan.org/pkg/hyperref)
+(if present) to have added hyperlinks via its patch to LaTeX's
+`\contentsline`. etoc examined the arguments of `\l at section` and
+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`.
+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.
+
+`\etoclink` now wraps its argument in an hyperlink even if
+[hyperref](https://ctan.org/pkg/hyperref) is configured via
+`linktoc=none`. Formerly no hyperlink was added then.
+
+Deprecation of `\etocsavedsectiontocline` and similarly named
+commands. They are not needed as `\l at 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.
+
1.09i \[2022/11/21\]
--------------------
@@ -732,7 +760,8 @@
\usepackage{hyperref}% I had used [pdfencoding=pdfdoc] until 1.09f
\hypersetup{%
-linktoc=all,% why is the important stuff
+linktoc=all,%
+%%linktoc=none,% STRESS TEST OF 1.1a
%% bookmarksdepth=3,% (not needeed anymore now, 1.07g)
breaklinks=true,%
colorlinks,%
@@ -794,10 +823,12 @@
% 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 at section etc...
\makeatletter
\newcommand*{\MyQuasiStandardTOC}[1]{%
\begingroup
- \etocsetstyle{section}{}
+ \etocsetstyle{section}
+ {}
{\ifnum\etocthenumber=4 % <- check this if new sections added to user manual
\etocsetstyle{subsection}
{\par\nopagebreak\begingroup
@@ -810,16 +841,21 @@
{\etocname\ \textup{(\etocnumber)}}
{.\par\endgroup}%
\else
- \etocsetstyle{subsection}{}{}
- {\etocsavedsubsectiontocline{\numberline{\etocnumber}\etocname}{\etocpage}}{}%
- \fi}
- {\etocsavedsectiontocline
- {\numberline{{\color{cyan}\etocthenumber}}\etocname}{\etocpage}}
+ \etocsetstyle{subsection}
+ {}%
+ {}%
+ {\l at subsection{\numberline{\etocnumber}\etocname}{\etocpage}}%
+ {}%
+ \fi
+ }% prefix for section sets the style dynamically for subsections!
+ % direct usage of \l at subsection, \l at section allowed here since 1.1a
+ {\l at section{\numberline{{\color{cyan}\etocthenumber}}\etocname}{\etocpage}}%
{}%
\etocstandarddisplaystyle
\etocsetnexttocdepth {2}%
\tableofcontents #1
- \endgroup}
+ \endgroup
+}
\makeatother
%--------
% Statistics on sections and subsections in a part \thispartstats:
@@ -2836,13 +2872,24 @@
\item do either of the above only for some portions of the table of contents.
\end{enumerate}
-Here is how to proceed.
+One only needs%
+%
+\marginpar{\normalfont\footnotesize\itshape Modified at \texttt{1.1a}}
+%
+to use the \LaTeX{} standard \csa{l at chapter}, \csa{l at section},
+etc... commands inside the TOC line style definitions via \csb{etocsetstyle},
+re-constituting their arguments using \csb{etocname}, \csb{etocnumber},
+\csb{etocpage} as one wishes.
-This has become easier since release |1.08k| as now \etoc preserves
-automatically in \csb{etocsavedsectiontocline}, \csb{etocsavedchaptertocline}
-etc... the meaning of the \LaTeX\ |\l at section|, |\l at chapter|, etc... macros as
-they were at the time the TOC is typeset.
+The aliases \csb{etocsavedsectiontocline}, \csb{etocsavedchaptertocline}
+etc... are set to have the exact same meanings as the \LaTeX{} |\l at chapter|,
+|\l at section|, etc... commands each time a TOC is typeset. They are
+\fbox{DEPRECATED} as the latter \LaTeX\ commands are not modified (nor used) by
+\etoc since release |1.1a|.
+You should use directly |\l at chapter|, etc... within suitable
+|\makeatletter/\makeatother|. Here is an example.
+
\begin{filecontentshere}{etocsnippet-\snippetno.tex}
\makeatletter
\newcommand{\MyStandardTOC}{%
@@ -2849,17 +2896,17 @@
\begingroup
% for the book or article classes:
%\etocsetstyle{part}{}{}
- % {\etocsavedparttocline{\etocnumber\hspace{1em}\etocname}{\etocpage}}{}%
+ % {\l at part{\etocnumber\hspace{1em}\etocname}{\etocpage}}{}%
% for the scrbook or scrartcl classes:
\etocsetstyle{part}{}{}
- {\etocsavedparttocline{\numberline{\etocnumber}\etocname}{\etocpage}}{}%
+ {\l at part{\numberline{\etocnumber}\etocname}{\etocpage}}{}%
% following is identical in book/article/scrbook/scrartcl classes:
\etocsetstyle{chapter}{}{} %%% only for book and scrbook
- {\etocsavedchaptertocline{\numberline{\etocnumber}\etocname}{\etocpage}}{}%
+ {\l at chapter{\numberline{\etocnumber}\etocname}{\etocpage}}{}%
\etocsetstyle{section}{}{}
- {\etocsavedsectiontocline{\numberline{\etocnumber}\etocname}{\etocpage}}{}%
+ {\l at section{\numberline{\etocnumber}\etocname}{\etocpage}}{}%
\etocsetstyle{subsection}{}{}
- {\etocsavedsubsectiontocline{\numberline{\etocnumber}\etocname}{\etocpage}}{}%
+ {\l at subsection{\numberline{\etocnumber}\etocname}{\etocpage}}{}%
% etc... if further sectioning units are used
\etocstandarddisplaystyle % this is for the title, page-marks, etc...
\tableofcontents
@@ -2897,40 +2944,52 @@
section, for which the layout is completely modified:
\MyQuasiStandardTOC{\ref{toc:overview}}
\bigskip
-This example only has sections and subsections, and the code used in \csa{MyStandardTOC} was:
+This example only has sections and subsections (assumed to be numbered), and
+the code used was:
\begin{filecontentshere}{etocsnippet-\snippetno.tex}
-\etocsetstyle{section}{}
- {\ifnum\etocthenumber=4
+\makeatletter
+\newcommand*{\MyQuasiStandardTOC}[1]{%
+ \begingroup
+ \etocsetstyle{section}
+ {}
+ {\ifnum\etocthenumber=4
\etocsetstyle{subsection}
{\par\nopagebreak\begingroup
- \leftskip1.5em \rightskip\@tocrmarg \parfillskip\@flushglue
- \parindent 0pt \normalfont\normalsize\rmfamily\itshape
- % \columnsep1em
- % \begin{minipage}{\dimexpr\linewidth-\leftskip-\rightskip\relax}%
- % \begin{multicols}{2}%
+ \leftskip1.5em \rightskip\@tocrmarg
+ \parfillskip \@flushglue
+ \parindent 0pt
+ \normalfont\normalsize\rmfamily\itshape
\etocskipfirstprefix}
{\allowbreak\,--\,}
{\etocname\ \textup{(\etocnumber)}}
{.\par\endgroup}%
- % {.\par\end{multicols}\end{minipage}\par\endgroup}%
- \else
- \etocsetstyle{subsection}
- {}{}
- {\etocsavedsubsectiontocline{\numberline{\etocnumber}\etocname}{\etocpage}}
- {}%
- \fi}
- {\etocsavedsectiontocline{\numberline{{\color{cyan}\etocthenumber}}\etocname}{\etocpage}}
- {}%
+ \else
+ \etocsetstyle{subsection}
+ {}%
+ {}%
+ {\l at subsection{\numberline{\etocnumber}\etocname}{\etocpage}}%
+ {}%
+ \fi
+ }% prefix for section sets the style dynamically for subsections!
+ {\l at section{\numberline{{\color{cyan}\etocthenumber}}\etocname}{\etocpage}}%
+ {}%
+ \etocstandarddisplaystyle
+ \etocsetnexttocdepth {2}%
+ \tableofcontents #1
+ \endgroup
+}
+\makeatother
\end{filecontentshere}
\marginattach{-B}
-Notice the page head-mark added by this standard TOC. Sections and subsections
-are printed exactly as in the default (except for the subsections of one
-specific user-chosen section and except for the color of the section numbers),
-with no need to specify explicitely any length, font or other formatting
-instructions. But we had to examine the \ctanpkg{scrartcl} sources to determine what to
-use for \csa{leftskip} and \csa{rightskip} for our customized section
-entries.
+The page heading (on the page where this TOC appears) may have been modified
+as is expected from usage of \csb{etocstandarddisplaystyle} in the code.
+Sections and subsections are printed exactly as in the default, \emph{except}
+for the subsections of one specific user-chosen section and except for the
+color of the section numbers. We had to examine the \ctanpkg{scrartcl} sources
+to determine what to use for \csa{leftskip} and \csa{rightskip} for our
+customized section entry (the one wih number 4).
+
\section{Emulating the book class}\label{sec:thirdexample}
As explained in \autoref{subs:compat}: without explicit use of an
@@ -4429,11 +4488,14 @@
active in the document and has added hyperlinks to the TOC data, then these
links are kept in the commands \csb{etocname}, \csb{etocnumber} and
\csb{etocpage} (this last one will have a link only if \ctanpkg{hyperref} was passed
-option \emph{linktoc=all}.)%
+either option \emph{linktoc=all} or option \emph{linktoc=page}.)%
%
-\footnote{In case of \emph{linktoc=page}, only \csb{etocpage} is an hyperlink;
-see the discussion of \csb{etoclink} on how to create (possibly also with the
-\emph{name} or \emph{number}) hyperlinks with the same target.}
+\footnote{As expected, in case of \emph{linktoc=page}, only \csb{etocpage} is
+an hyperlink, not \csb{etocname} nor \csb{etocnumber}. See \csb{etoclink} on
+how to create hyperlinks with the entry target.}
+%
+In accordance with the \ctanpkg{hyperref} native behavior, no
+link gets incorporated into \csb{etocpage} if the page number is empty.
\section{The \csbhyp{etocskipfirstprefix} and \csbhyp{etociffirst} commands}
\label{etocskipfirstprefix}
@@ -4541,28 +4603,29 @@
The command \csb{etoclink}\marg{text} can be used in the line style
specifications in a manner analogous to \csb{etocname}, \csb{etocnumber} and
-\csb{etocpage}. It creates a link (if such a link was added by \ctanpkg{hyperref} to
-the |.toc| file entry) whose target is the corresponding document unit and
+\csb{etocpage}. It creates a link (if \ctanpkg{hyperref} is present%
+%
+\footnote{Prior to \texttt{1.1a}, no such link was added if the \texttt{.toc}
+ file entry was encountered
+ with \ctanpkg{hyperref}'s option \texttt{linktoc} set to \texttt{none}.})
+%
+whose target is the corresponding document unit and
whose name is the given \meta{text} mandatory argument.
Hence |\etoclink{\etocthename}| is under default conditions of \ctanpkg{hyperref} like
-the original |\etocname|, because the latter is already hyperlinked. Under
+the original \csb{etocname}, because the latter is already hyperlinked. Under
\emph{linktoc=page} context |\etoclink{\etocthename}| adds the hyperlink which
is missing from \csb{etocname}. Similarly under the default \ctanpkg{hyperref}
-condition (\emph{linktoc=section}) \csb{etocpage} is not an hyperlink, but one
+condition (i.e.\@ \emph{linktoc=section}) \csb{etocpage} is not an hyperlink, but one
can use |\etoclink{\etocthepage}|.
-If \csa{hypersetup} is used with \emph{linktoc=none} then no miracle happens,
-\csb{etoclink} does nothing special and none of \csb{etocname},
-\csb{etocnumber} and \csb{etocpage} are links.
+The command \csb{etoclink} is robust.
+% Since |etoc 1.08j| it contains the link
+% destination in an already expanded form, so for example can be used even after
+% a |&| in a tabular construction, if \csb{etocglobaldefs} was issued.
-The command \csb{etoclink} is robust. Since |etoc 1.08j| it contains the link
-destination in an already expanded form, so for example can be used even after
-a |&| in a tabular construction, if \csb{etocglobaldefs} was issued.
-
-
% 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 at osectarg
@@ -4592,26 +4655,44 @@
\makeatletter\scr at activate@xsection{0}\makeatother
-These macros are fragile and contain the link destination in already expanded
-form. So their meaning can be stored for delayed usage. For example this is
-done here when doing the \hyperref[tocastree]{examples with trees}.
+The meanings of these commands
+can be stored for delayed usage. For example this is
+done in the \hyperref[tocastree]{examples with trees}.
-Notice though that \csb{etocthelinkednumber} and \csb{etocthelinkedname} are
-hyperlinks only if \ctanpkg{hyperref} was configured to let the heading name be
-linked (this is the default). So under \ctanpkg{hyperref} option \emph{linktoc=page},
-both \csb{etocthelinkednumber} and \csb{etocthelinkedname} are no different
-from respectively \csb{etocthenumber} and \csb{etocthename}.
+Notice though the following facts:
+\begin{itemize}[noitemsep]
+\item \csb{etocthelinkednumber} and \csb{etocthelinkedname} are hyperlinks
+ only if \ctanpkg{hyperref} was configured via |linktoc=all| or
+ |linktoc=section| (the default),
+\item \csb{etocthelinkedpage} is an hyperlink only if \ctanpkg{hyperref} was
+ configured via |linktoc=all| or |linktoc=page|. \emph{Furthermore}, the
+ page number must not be empty: if it is empty no hyperlink is added (this
+ matches the \ctanpkg{hyperref} behavior when \etoc is not loaded).
+\end{itemize}
-For this reason, a further macro is provided: \csb{etocthelink} will fetch
-the link destination if available be it from the name or from the page number.
-Then |\etocthelink{foo}| hyperlinks an arbitrary text to the target destination
-inside the produced PDF.
+It may be a bit strange that the link is not sytematically added despite the
+command names, but this is legacy behavior of the package. It is coherent
+with the commands \csb{etocname}, \csb{etocnumber}, and \csb{etocpage} being
+their robust variants.
-All these commands are fragile. The \csb{etocname}, \csb{etocnumber},
-\csb{etocpage} and \csb{etoclink} are simply their robust variants. They too
-contain the hyperlink destination in already expanded form since |1.08a| for
-the first three, since |1.08j| for \csb{etoclink}.
+A further command is provided: \csb{etocthelink}, which wraps%
+%
+\footnote{Prior to \texttt{1.1a}, there was a link added only if \ctanpkg{hyperref} option \texttt{linktoc} was not \texttt{none}.}
+%
+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.
+
+Thus, \csb{etocthelinkednumber} is essentially
+\csb{etocthelink}|{|\csb{etocthenumber}|}| if |linktoc| is |all| or the
+default |section|, else it is an alias to \csb{etocthenumber}. Similarly for
+the other two.
+
+% 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}
{\begin{itemize*}[itemjoin={{; }}, itemjoin*={{, and }}]}
@@ -4676,18 +4757,26 @@
\etocinline\tableofcontents \ref{toc:globalcmds}
\endgroup
-\section{The \csbhyp{etocsavedsectiontocline}, etc... commands.}
+\section{DEPRECATED \csbhyp{etocsavedsectiontocline}, etc... commands.}
\label{etocsavedsectiontocline}
\label{etocsavedchaptertocline}
-Since |1.08k| \etoc preserves
-automatically in \csb{etocsavedsectiontocline}, \csb{etocsavedchaptertocline}
-etc... the meaning of the \LaTeX\ |\l at section|, |\l at chapter|, etc... in force
-at the time each \csb{tableofcontents} or \csb{localtableofcontents}
-macro is executed.
+Prior to |1.1a|, \etoc modified (locally) at each \csb{tableofcontents} or
+\csb{localtableofcontents} encountered the meaning of the \LaTeX\ internal
+commands |\l at part|, |\l at chapter|, |\l at section|, etc... It stored (since |1.08k|)
+their original meanings (at the time of the encountered TOC), into
+\csb{etocsavedchaptertocline}, \csb{etocsavedsectiontocline}, etc... commands,
+which allowed to do some simple changes via \etoc of the rendering via the
+technique explained in \autoref{sec:anothercompat}.
-See \autoref{sec:anothercompat} for usage.
+This is all obsolete at |1.1a| because \etoc does not modify anymore (even
+locally) |\l at part|, |\l at chapter|, |\l at section|, etc... so they can be used
+directly in the context of the techniques of \autoref{sec:anothercompat}.
+Thus \csb{etocsavedchaptertocline}, \csb{etocsavedsectiontocline},
+etc... raise some warning that they will be removed at some later release and
+that you should stop using them.
+
\section{The \csbhyp{etocsetlevel} command}
\label{etocsetlevel}
@@ -4700,7 +4789,7 @@
\etocsetlevel{atom}{2}
\etocsetlevel{nucleus}{3}
\end{verbatim}
-In compatibility mode, it will be assumed that the macros |\l at cell|,
+In compatibility mode, it will be assumed that the commands |\l at cell|,
|\l at molecule|, ..., have been defined somewhere either by the user or a class:
doing only |\etocsetlevel| is not enough for the corresponding level to work
out-of-the-box in compatibility mode.
@@ -6240,14 +6329,16 @@
\label{etocscrbookstyle}
\label{etocscrreprtstyle}
-Not really tested. But nominally supported, as the code contains this
+Not really tested... well, tested by this document with its dozens of \etoc
+TOCs and which uses \ctanpkg{scrartcl}! The package code contains
\begin{verbatim}
\@ifclassloaded{scrartcl}
{\renewcommand*\etocstandarddisplaystyle{\etocscrartclstyle}}{}
\end{verbatim}
-and \cs{etocscrartclstyle} tries to emulate the global display style of the
-\cs{tableofcontents} command with the class \ctanpkg{scrartcl}. It was last updated
-at |1.09f|.
+with \cs{etocscrartclstyle} trying to emulate the global display style of the
+\cs{tableofcontents} within the class \ctanpkg{scrartcl}. Thus \etoc is ready
+for basic usage in compatibility mode (last updated
+at |1.09f|).
\subsection{Compatibility with the \ctanpkg{memoir} class}
\label{ssec:memoir}
@@ -6411,17 +6502,25 @@
\section{\TeX nical matters}
The \csb{etocname}, \csb{etocnumber}, \csb{etocpage} commands are protected
-against premature expansion. They contain suitable \ctanpkg{hyperref} links if package
-\ctanpkg{hyperref} is loaded and active for the TOC. The commands \csb{etoclink} and
-\csb{etocifnumbered} are also protected against premature expansion. Also
-\csb{etociffirst} and \csb{etoctoccontentsline}.
+against premature expansion. They are hyperlinks if package \ctanpkg{hyperref}
+is loaded and depending on its option |linktoc| value; under the default
+|linktoc=section|, only name and number are hyperlinked, not the page
+number.
On the other hand \csb{etocthename}, \csb{etocthenumber}, \csb{etocthepage}
are \emph{not} protected against expansion. And neither are
\csb{etocthelinkedname}, \csb{etocthelinkednumber}, \csb{etocthelinkedpage}.
-The latter contain hyperlink data, if present in the |.toc| file.
+The latter three are hyperlinks only if \ctanpkg{hyperref} |linktoc| option
+has the suitable value: |section| (which is default) or |all| for name and
+number to be hyperlinks, |page| or |all| for the page number (which must not
+be empty). The commands \csb{etocname}, \csb{etocnumber}, and \csb{etocpage}
+are their robust variants.
-The commands such as \csb{etocsetstyle}, \csb{etocsetlevel},
+The commands \csb{etoclink} and \csb{etocifnumbered} are also
+protected against premature expansion. Also \csb{etociffirst} and
+\csb{etoctoccontentsline}.
+
+Commands such as \csb{etocsetstyle}, \csb{etocsetlevel},
\csb{etocsettocstyle}, \csb{etocmulticolstyle},
\csb{etocruledstyle}, \csb{etocframedstyle} obey \LaTeX{}'s
groups. All TOCs are typeset inside groups.
@@ -6545,6 +6644,8 @@
\def\1{\vskip\baselineskip 1}% ajouté 2015/05/09; faudra trouver mieux.
% 2022/08/26, stop using \frenchspacing
% \frenchspacing
+% 2023/01/14
+ \def\2##1.{\ctanpkg{##1}}%
% 2022/08/26. I realized that rendering was broken, and finally identified
% the bad commit to be in LaTeX 2022/06/01 release. Its \obeyspaces not only
% makes the ascii32 \active but it also redefines it! Solution could be to
@@ -6576,8 +6677,33 @@
\def {\ifvmode\advance\jfverbadim.5em\relax\else\expandafter\jfverbaspace\fi}}\x
\makeatother
\begin{jfverbatim}
-1.09i [2022/11/21]^
+1.1a [2023/01/14]^
+ This version brings no new functionality, despite the number bump.
+ It implements a complete rewrite of old legacy core internals.
+ Formerly, etoc waited for ~2hyperref. (if present) to have added
+ hyperlinks via its patch to LaTeX's \contentsline.
+ etoc examined the arguments of \l at section and other commands to extract
+ 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
+ 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.
+
+ \etoclink now wraps its argument in an hyperlink even if
+ ~2hyperref. is configured via
+ linktoc=none. Formerly no hyperlink was added then.
+
+ Deprecation of \etocsavedsectiontocline and similarly named
+ commands. They are not needed as \l at 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.
+
+~1.09i [2022/11/21]^
+
Fix bug showing when a document uses both \etocchecksemptiness and
\etocsetlocaltop.toc: the start and finish parts of some levels were
executed possibly causing extra printed output.
@@ -7423,54 +7549,74 @@
\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.
+% 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.
-\etoc,\normalmarginpar\marginpar{\footnotesize\rmfamily\itshape\RaggedRight
+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.
+
+
+\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} when not left in compatibility mode, hijacks the
-\csa{contentsline} expansion so as to not execute \csa{l at chapter},
-\csa{l at section} etc..., but use \csbc{Etoc at lxyz}, which will parse the data and
-extract from it the name, number and page number. Indeed, for legacy reasons
-the \LaTeX{} |.toc| data is \emph{not structured}, but already to some extent
-oriented towards typesetting tasks, in an already pre-decided orderly manner.
-This part of \etoc maneuvers is fragile as 1) it requires the |.toc| file to
-be built from \csa{contentsline} entries, and 2) and relies on
-\csa{contentsline} to hand over the job to \csa{l at chapter}, \csa{l at section},
-etc... macros. Of course \etoc can be easily broken if changes happen to how
-data is stored there, in particular to how the text (which in \etoc lingua is
-called the \emph{name}) and the number (this one is called by us also
-\emph{number}) are put together. Things would have been much easier for \etoc
-in 2012 if the \csa{contentsline} arguments separated text (name) and number;
-unfortunately some mix is prepared, which may depend on the document class
-also, and typically handles \csa{part} levels very differently (and with more
-hard-coded stuff). Anyway, fortunately upstream changes happen rarely. The
-|7.00u| release of \ctanpkg{hyperref} was such an instance.
+ package, at 1.09h.\par}
+%
+when not left in compatibility mode, hijacks the \csa{contentsline} expansion
+so as to not execute \csa{l at chapter}, \csa{l at section} etc..., but rather to
+parse the date and extract from it the \emph{name}, \emph{number}, and
+\emph{page number}.
+%
+The \LaTeX{} |.toc| data
+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 at chapter}, \csa{l at section},
+etc... (at the time of TOC typesetting only) to its own \csbc{Etoc at 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 at chapter} etc... unmodified and inserts itself hyperlinks via \csa{hyperlink}.}
+%
+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
+\emph{name} for \etoc) and their numbers (which are not numbers in the sense
+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.
The other core part of \etoc present from day one of the package is that it
-creates (but only virtually, and dynamically, not statically) a tree-like
-structure of the sectioning levels present in the |.toc| file. It could be
-fun to actually implement officially such a tree (where the children of a
-sectioning title are the sectioning levels at a greater depth such as
-subsections versus a section). Let us recall that \LaTeX{} provides zero
-means to know from a subsection for example, what is the title of the section
-containing it, or chapter, or part. To do this one has to create a really
-structured document which neither core \LaTeX{} nor the main document classes
-do. This remark was given for document body, but it also applies to |.toc|
-data. But \etoc adds at least some kind of follow-up to the successive
-encountered sectioning titles, and is thus able, to ``on-the-fly'' add some
-kind of structure and follow the succession of levels. Ultimately this is why
-the \csbc{etocsetstyle} offers \marg{start} and \marg{finish} parts in
-additions to \marg{contents} (which I divided into a \marg{prefix} and a
-\marg{contents}). At some point one could imagine that a really
-\emph{structured} document (in opposition to what core \LaTeX{} from thirty
-years ago up to nowadays realizes) would store in the |.toc| data directly a
-tree structure, where each node would have attributes name, number, page
-number, completely separated from any typesetting. Once this exists then
+creates a tree-like structure of the sectioning levels present in the |.toc|
+file. But this is purely virtual, and handled via a notion of ``level'' and
+\TeX\ conditionals. It could be fun to implement officially such a tree
+(where the children of a sectioning title are the sectioning levels at a
+greater depth such as subsections versus a section). Let us recall that
+\LaTeX{} provides zero means to know from a subsection for example, what is
+the title of the section containing it, or chapter, or part. To do this one
+has to create a really structured document which neither core \LaTeX{} nor the
+main document classes do. This remark was given for document body, but it
+also applies to the |.toc| data. But \etoc adds at least some kind of
+follow-up to the successive encountered sectioning titles, and is thus able,
+to ``on-the-fly'' add some kind of structure and follow the chaining of
+levels. Ultimately this is why the \csbc{etocsetstyle} offers \marg{start}
+and \marg{finish} parts in additions to \marg{contents} (which I divided into
+a \marg{prefix} and a \marg{contents}). At some point one could imagine that
+a really \emph{structured} document (in opposition to what core \LaTeX{} from
+thirty years ago up to nowadays realizes) would store in the |.toc| data
+directly a tree structure, where each node would have attributes name, number,
+page number, completely separated from any typesetting. Once this exists then
basically \etoc disappears. In brief, once \etoc ideas will have permeated
the society, it will disappear as its was born only to palliate the absence of
real structure in the |.toc| file (which is sort of inherited from the absence
@@ -7517,28 +7663,28 @@
%
%</none>
%<*package>
+% |1.1a| implements a radical change to all internals for compatibility
+% with (attow future) \ctanpkg{hyperref}. 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}
+\NeedsTeXFormat{LaTeX2e}[2020/10/01]
\ProvidesPackage{etoc}
-[2022/11/21 v1.09i Completely customisable TOCs (JFB)]
+[2023/01/14 v1.1a Completely customisable TOCs (JFB)]
\RequirePackage{multicol}
\DeclareOption*{\PackageWarning{etoc}{Option `\CurrentOption' is unknown.}}
\ProcessOptions\relax
-% \end{macrocode}
-% |1.08| suppresses |\ifEtoc at part| and defines |\ifEtoc at skipprefix|. It
-% also defines \csbc{etocglobaldefs}, \csbc{etoclocaldefs} and \csbc{Etoc at global}.
-% \begin{macrocode}
\newtoks\Etoc at toctoks
\def\Etoc at par{\par}
\def\etocinline{\def\Etoc at par{}}
\let\etocnopar\etocinline
-\def\etocdisplay{\def\Etoc at par{\par}}% 1.07m 2015/01/23
+\def\etocdisplay{\def\Etoc at par{\par}}
% \end{macrocode}
% \csbc{etocglobaldefs} should be used only for special things such as TOC as a
% table; it should be put in a group to limit its scope. If used in the
% preamble, it must come \emph{after} \ctanpkg{tableof} if the latter is loaded too.
% \begin{macrocode}
-\let\Etoc at global\@empty % 1.08 2015/03/10
+\let\Etoc at global\@empty
\def\etocglobaldefs{\let\Etoc at global\global\let\tof at global\global}
\def\etoclocaldefs {\let\Etoc at global\@empty\let\tof at global\@empty}
\newif\ifEtoc at jj % book
@@ -7551,38 +7697,26 @@
\newif\ifEtoc at v % subparagraph
\newif\ifEtoc at number
\newif\ifEtoc at hyperref
-\newif\ifEtoc at parskip % 1.07d
+\newif\ifEtoc at parskip
\newif\ifEtoc at tocwithid
\newif\ifEtoc at standard
-\newif\ifEtoc at skipprefix % 1.08
-\newif\ifEtoc at isfirst % 1.08
+\newif\ifEtoc at skipprefix
+\newif\ifEtoc at isfirst
\newif\ifEtoc at localtoc
\newif\ifEtoc at skipthisone
\newif\ifEtoc at stoptoc
\newif\ifEtoc at notactive
\newif\ifEtoc at mustclosegroup
-\newif\ifEtoc at emptytoc % 1.08e
-\newif\ifEtoc at checksemptiness % 1.08e. Default is 'no checks'.
+\newif\ifEtoc at emptytoc
+\newif\ifEtoc at checksemptiness
\def\etocchecksemptiness {\Etoc at checksemptinesstrue }
-\def\etocdoesnotcheckemptiness {\Etoc at checksemptinessfalse }% 1.08i
-\newif\ifEtoc at notocifnotoc % 1.08e
+\def\etocdoesnotcheckemptiness {\Etoc at checksemptinessfalse }
+\newif\ifEtoc at notocifnotoc
\def\etocnotocifnotoc {\Etoc at checksemptinesstrue\Etoc at notocifnotoctrue }
\def\etoc@{\etoc@}
-\newif\ifEtoc at bracedname % 1.08p
-% \end{macrocode}
-% |1.07g| uses a second counter; this could be avoided, but ok, let's not be
-% that strict.
-% \begin{macrocode}
+\newif\ifEtoc at bracedname
\newcounter{etoc at tocid}
-\newcounter{etoc at tocdepth}% 1.07g
-% \end{macrocode}
-% |2015/03/08| Why do I use |jj| in the flags and |minustwo| here? and
-% is there an entity full of forgiveness out there to save my soul even
-% if taking into consideration my use of single and doubled |@|'s ?
-% Although I desperately need to waste time I miraculously decided not
-% to change everything today and thus the somewhat dispendious set-up
-% below is maintained.
-% \begin{macrocode}
+\newcounter{etoc at tocdepth}
\@ifclassloaded{memoir}{\def\Etoc at minf{-\thr@@}}{\def\Etoc at minf{-\tw@}}
\def\Etoc@@minustwo@@{-\tw@}
\let\Etoc@@minusone@@\m at ne
@@ -7601,9 +7735,6 @@
\def\Etoc@@three@ {three}
\def\Etoc@@four@ {four}
\def\Etoc@@five@ {five}
-% \end{macrocode}
-% |1.07g|.
-% \begin{macrocode}
\expandafter\def\csname Etoc at -3@@\endcsname {-\thr@@}
\expandafter\let\csname Etoc at -2@@\endcsname \Etoc@@minustwo@@
\expandafter\let\csname Etoc at -1@@\endcsname \Etoc@@minusone@@
@@ -7617,17 +7748,9 @@
\let\Etoc at all@@ \Etoc@@five@@
\let\Etoc at none@@ \Etoc at minf
% \end{macrocode}
-% Versions earlier than |1.08| did \csbc{Etoc at newlevel} in a quite
-% embarrassing way with an |\edef|.
-%
-% |1.08f|'s \csbc{etocsetlevel} avoids multiple insertions of the same level
-% in the \csbc{Etoc at levellist} list.
-%
-% |1.08k| modified \csbc{Etoc at newlevel}: formerly a token |\l@#1| was stored in
-% place of braced name |{#1}|. This changed is to facilitate creation of the
-% \csa{etocsavedsectiontocline} etc... type macros later on, at each TOC. But the
-% stored |#1| is not expanded immediately, although it is in other parts of
-% \csbc{etocsetlevel}, which may cause timing problems if |#1| is a macro.
+% At |1.1a|, the \csa{etocsavedsectiontocline} and cousins are deprecated and
+% when they will be removed, \csbc{Etoc at levelist} will be too as it now serves
+% only for their definitions.
% \begin{macrocode}
\let\Etoc at levellist\@empty
\def\Etoc at newlevel #1{\expandafter\def\expandafter\Etoc at levellist\expandafter
@@ -7680,93 +7803,17 @@
\etocsetlevel{paragraph}{4}
\etocsetlevel{subparagraph}{5}
% \end{macrocode}
-% The first two parameters of \csbc{Etoc at et@hop} are exchanged in |1.08|
-% compared to earlier versions; this is in relation to changes done in
-% \csbc{Etoc at etoccontentsline}.
-%
-% |1.08i 2016/09/29| has a |fourorthree| rather than as formerly a |sixorfive|.
-%
-% \LaTeX\ of November 2021 will have its |\contentsline| always grab four
-% arguments. So we must adjust \csbc{Etoc at et@hop} et al., else usage of \etoc
-% without hyperref will be broken. Done at |1.09e 2021/09/23|.
-%
-%^^A Side note to myself: I see there is now a |\@gobblethree| in latex.ltx and
-%^^A I wonder since when. No time to lose on checking that.
-%^^A Answer: 2020-02-27 ltdefns.dtx 1.5g |\@gobblethree|: Macro added
-%
% |1.09g| adapts to \ctanpkg{hyperref} depending on
% whether the latter is at |7.00u| or earlier. Indeed internal changes to
% \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.
% \begin{macrocode}
\AtBeginDocument{%
\@ifpackageloaded{parskip}{\Etoc at parskiptrue}{}%
-\@ifpackageloaded{hyperref}{%
- \Etoc at hyperreftrue
- \@ifpackagelater{hyperref}{2022/11/13}%
- {%
- \def\Etoc at getthepage {%
- \ifx\Hy at toclinkstart\Etoc at getthepage@token
- \expandafter\expandafter\expandafter\Etoc at getthepage@hyp
- \else
- \expandafter\Etoc at getthepage@nohyp
- \fi}%
- \def\Etoc at getnb@a {%
- \ifx\Hy at toclinkstart\Etoc at getnb@token
- \expandafter\expandafter\expandafter\Etoc at getnb@hyp
- \else
- \expandafter\Etoc at getnb@nohyp
- \fi}%
- \def\Etoc at getit {%
- \ifx\Hy at toclinkstart\Etoc at getit@token
- \expandafter\expandafter\expandafter\Etoc at getit@hyp
- \else
- \expandafter\Etoc at getit@nohyp
- \fi}%
- }%
- {%
- \def\Etoc at getthepage {%
- \ifx\hyper at linkstart\Etoc at getthepage@token
- \expandafter\Etoc at getthepage@hyp
- \else
- \expandafter\Etoc at getthepage@nohyp
- \fi}%
- \def\Etoc at getnb@a {%
- \ifx\hyper at linkstart\Etoc at getnb@token
- \expandafter\Etoc at getnb@hyp
- \else
- \expandafter\Etoc at getnb@nohyp
- \fi}%
- \def\Etoc at getit {%
- \ifx\hyper at linkstart\Etoc at getit@token
- \expandafter\Etoc at getit@hyp
- \else
- \expandafter\Etoc at getit@nohyp
- \fi}%
- }%
- \def\Etoc at et@hop#1#2#3#4#5{#2{#3}{#4}{#5}#1}%
- \let\Etoc at gobblefourorthree\@gobblefour
- }%
- {%
- \let\Etoc at getthepage\Etoc at getthepage@nohyp
- \let\Etoc at getnb@a\Etoc at getnb@nohyp
- \let\Etoc at getit \Etoc at getit@nohyp
- \def\Etoc at et@hop#1#2#3#4{#2{#3}{#4}#1}%
- \long\def\Etoc at gobblefourorthree#1#2#3{}%
- }%
-% \end{macrocode}
-% Until |1.09i| the date threshold was erroneously set to 2021/11/15.
-% In practice this meant that for some version of \LaTeX{} \etoc was
-% a bit sloppy and left some empty brace pairs |{}|, which however
-% could possibly impact I think only TOCs executed in math mode... not
-% very frequent!
-% \begin{macrocode}
-\@ifl at t@r\fmtversion{2020/10/01}%
- {%
- \def\Etoc at et@hop#1#2#3#4#5{#2{#3}{#4}{#5}#1}%
- \let\Etoc at gobblefourorthree\@gobblefour
- }%
- {}%
+\@ifpackageloaded{hyperref}{\Etoc at hyperreftrue}{}%
}
% \end{macrocode}
% |2015/03/08| One has to be careful about the |Etoc at end@<level>| user
@@ -7773,11 +7820,7 @@
% defined macros which may close groups. This has always been the reason
% for the |\global|'s here and elsewhere.
%
-% |1.08| uses \csbc{Etoc at level} rather than a |#1| which used to be anyhow always
-% the |\Etoc at tmp|. Now \csbc{Etoc at level} is what was called formerly |\Etoc at tmp|
-% in \csbc{Etoc at etoccontentsline}.
-%
-% Attention that \csbc{Etoc at setflags} must not modify |\Etoc at next|!
+% Attention that \csbc{Etoc at setflags} must not modify \csa{Etoc at next}!
% \begin{macrocode}
\def\Etoc at setflags {%
\ifcase \Etoc at level
@@ -7823,12 +7866,10 @@
\fi
}
% \end{macrocode}
-% |1.08| This was originally in \csbc{Etoc at etoccontentsline}, intermixed
-% with the definitions of \csbc{Etoc at contents} and \csbc{Etoc at prefix}. Separated
-% here for clarity of code. One has to be careful that this may close
+% One has to be careful that this may close
% groups. The conditionals are all global. The \csbc{Etoc at level} has been
% |\global\let| to a |\chardef| variable. The final |\else| of the
-% |\ifcase| assumes none of the |\Etoc at end@..| routines modify it,
+% |\ifcase| assumes none of the \csa{Etoc at end@..} routines modify it,
% naturally.
% \begin{macrocode}
\def\Etoc at doends {%
@@ -7866,25 +7907,11 @@
\fi
}
% \end{macrocode}
-% |1.08| the |\Etoc at next| will (possibly) execute the |begin| code,
-% \emph{before} \csbc{Etoc at contents} and \csbc{Etoc at prefix} get defined,
-% contrarily to what I did in earlier versions. I still reset the flags
-% before execution of the |begin| codes (although the flags are not
-% supposed to be used therein anyhow).
-%
-% Also the \meta{begin} code does \csa{Etoc at isfirsttrue}.
-%
-% |1.08k| This was originally in \csbc{Etoc at etoccontentsline}. Extracted for
-% re-use by \csbc{etocsetlocaltop.toc}. Calls \csbc{Etoc at setflags} which must not
-% modify |\Etoc at next|.
+% Calls \csbc{Etoc at setflags} which must not modify \csa{Etoc at next}.
% \begin{macrocode}
\def\Etoc at dobegins{%
\let\Etoc at next\@empty
\Etoc at global\Etoc at isfirstfalse
-% \end{macrocode}
-% |2015/03/08| If my naming scheme had not been so baroque, I could easily do
-% things in a more concise way here...
-% \begin{macrocode}
\ifcase\Etoc at level
\ifEtoc@
\else
@@ -7931,79 +7958,9 @@
\Etoc at setflags
\Etoc at next
}
-% \end{macrocode}
-% Heart of \etoc hack into execution of |.toc| file. The |.toc|
-% file must contain (at least indirectly via expansion)
-% |\contentsline {<unit>}...| instructions, with
-% the standard meaning of executing |\l at unit| (the hyperref
-% modifications are taken into account). It is the various |\l at unit|'s
-% which are (locally) |\let| to \csbc{Etoc at lxyz} and it is \csbc{Etoc at lxyz}
-% which does the parsing of the arguments in order to extract name,
-% number and page number. Once they are obtained, via the execution of
-% this indirectly hacked |\contentsline|, the code executes the
-% \csbc{Etoc at prefix} and \csbc{Etoc at contents} corresponding to that unit level,
-% according to the user \csbc{etocsetstyle} declarations. Before that the
-% begin part is executed when \etoc first encounters that level
-% coming from a higher one and the end part will be executed when
-% hitting a more important level.
-%
-% \csbc{etocskipfirstprefix} was already part of the very first release of
-% \etoc. Up to |1.07n| it was just an elegant |\@thirdofthree| possibly
-% executed just before a |\@firstoftwo{\Etoc at swa{#1}}{\Etoc at swb{#1}}|
-% line. But this made it impossible for me to execute things after the
-% |begin| parts.
-%
-% Executing stuff before |begin| is now a potential problem because the user
-% can close some group in the |begin| code (this was in fact impossible in
-% versions |<1.08| because this would have erased the definitions of
-% \csbc{Etoc at contents} and \csbc{Etoc at prefix}). Thus I am not so free now to define
-% things before execution of begin, if I allow people to close a group
-% therein, except if I make them global.
-%
-% The mechanism of \csbc{etocskipfirstprefix} made it impossible to add
-% anything at the end of the |begin| codes. Thus I changed it in |1.08|
-% to simply work with a (global) boolean flag. This gives user the
-% freedom to use \csbc{etocskipfirstprefix} anywhere in the |begin| code and
-% it made room for a delimited macro I called \csa{etoconlyonfirst}. But
-% then I dropped it in favor of definition of the \csbc{etociffirst}
-% conditional.
-%
-% Macros |\Etoc at swa| and |\Etoc at swb| which did the \csbc{Etoc at et@hop} thing have
-% been suppressed, their effect is incorporated to the end of
-% \csbc{Etoc at etoccontentsline}.
-% \begin{macrocode}
\def\etocskipfirstprefix {\global\Etoc at skipprefixtrue }
% \end{macrocode}
-% |2015/03/08| let's record that \csbc{Etoc at level} used to be called
-% |\Etoc at tmp| in versions earlier than |1.08| (and |\Etoc at tmp| is used
-% in the completely different ulterior \csbc{Etoc at lxyz} context). The code
-% sets it for example to be \csa{Etoc at section@@} which has been let by
-% \csbc{etocsetlevel} to |\@ne|, thus is always self-terminating in
-% |\ifnum..\fi| contexts.
-%
-% |1.08i-2016/09/29| makes some changes in the organization of the
-% conditionals. It could happen in certain special circumstances (created by
-% that part in \csbc{Etoc at localtableofcontents} which is executed after the test
-% of emptiness) that \csa{Etoc at localtop} was still undefined. Earlier version of
-% the code was a bit lazy and did not avoid some unneeded |\ifnum| with
-% \csa{Etoc at localtop} in context where the flag \csbc{ifEtoc at stoptoc} was |\iftrue|;
-% this was not an issue when code was first written, \csa{Etoc at localtop} was
-% always initialized back then. But the code in \csbc{Etoc at localtableofcontents}
-% handling local TOCs with unrecognized ids would call execution of the |.toc|
-% file under some special context with flag \csbc{ifEtoc at stoptoc} artificially set
-% to true. If \csa{Etoc at localtop} had not been initialized an undefined control
-% sequence error would occur. Furthermore as |\ifEtoc at notactive| was also set
-% to true, the case of no error leads then to unneededly expand \csbc{Etoc at setflags}
-% code slowing down compilation.
-%
-% Also |1.08i| splits the macro into two, with accompanying slight
-% refactoring. I had such problems with the behaviour of TeX booleans in
-% 2011/12 that I got excessively cautious then, and was using an |\Etoc at next|
-% for the \csbc{Etoc at setflags} rather than leaving it like here deep inside
-% conditional branches.
-%
-% Attention! |1.09|'s \csbc{etoclocaltop} is the former \csa{Etoc at localtop}
-% \emph{minus one}. Hence some slight change in conditional here.
+% Heart of \etoc hack into execution of |.toc| file.
% \begin{macrocode}
\def\Etoc at etoccontentsline #1{%
\global\expandafter\let\expandafter\Etoc at level\csname Etoc@#1@@\endcsname
@@ -8026,7 +7983,7 @@
\fi
\fi
\fi
- \let\Etoc at next\Etoc at gobblefourorthree
+ \let\Etoc at next\@gobblefour
\ifEtoc at skipthisone
\else
\unless\ifnum\c at tocdepth<\Etoc at level
@@ -8040,49 +7997,22 @@
\Etoc at next{#1}%
}
% \end{macrocode}
-% |1.08| New way to handle the compatibility mode. One has to worry
-% only for the local tables of contents (in inactive state, which still
-% must be parsed for global level flags) but in this case
-% \csbc{Etoc at setflags} was done above already. Earlier method proceeded with
-% dummy empty line styles.
-%
% |2015/03/08| Ever since the first release of \etoc, the code has
% to be careful that the |\Etoc at end@<level>| user defined macros may
% close groups. This is the reason why some assignments have to be done
-% globally. The |\let\Etoc at next\Etoc at gobblesixorfive| above could be
-% local, because it is used only in case the stuff below is skipped,
-% inclusive of \csbc{Etoc at doends} which may close groups. (code has changed since,
-% slightly).
+% globally
%
-% |1.08| extracts to a separate macro \csbc{Etoc at doends}. Earlier code
-% did |\global\let\Etoc at next\relax| but we can now give a default |\relax|
-% value to |\Etoc at next| with no need of a |\global| prefix.
-%
-% |1.08k| extracts \csbc{Etoc at dobegins}.
+% |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 at lxyz} used to receive only two arguments like \csa{l at chapter},
+% \csa{l at section}, etc... which were formerly |\let| to it. It now also
+% receives the fourth argument of \csa{contentsline}.
% \begin{macrocode}
-\def\Etoc at etoccontentsline@ #1{%
- \Etoc at doends % separated since 1.08
- \Etoc at dobegins % separated since 1.08k. Does \Etoc at setflags.
-% \end{macrocode}
-% |1.08|:
-% \begin{enumerate}
-% \item separates the definition of \csbc{Etoc at prefix} and
-% \csbc{Etoc at contents} from the execution of the |end| parts. And it does
-% the definition with some |\csname|'s.
-%
-% \item implements \csbc{etocskipfirstprefix} with a boolean, this is less slick
-% but more flexible than the earlier method.
-%
-% \item defines the \csbc{etociffirst} conditional.
-%
-% \item has \csbc{Etoc at level} rather than |\Etoc at tmp| and thus we can dispense
-% with the |\ifEtoc at part| switch as we will be able to test the equality
-% |\Etoc at level=-1| inside of \csbc{Etoc at lxyz}.
-%
-% \item adds the \csbc{Etoc at global} prefix.
-% \end{enumerate}
-% |1.08i| uses an |\edef| rather than |\def| with a chain of |\expandafter|.
-% \begin{macrocode}
+\def\Etoc at etoccontentsline@ #1#2#3#4{%
+ \Etoc at doends
+ \Etoc at dobegins
\Etoc at global\edef\Etoc at prefix {\expandafter\noexpand
\csname Etoc at prefix@\csname Etoc@#1@\endcsname\endcsname }%
\Etoc at global\edef\Etoc at contents{\expandafter\noexpand
@@ -8090,174 +8020,156 @@
\ifEtoc at skipprefix \Etoc at global\let\Etoc at prefix\@empty\fi
\global\Etoc at skipprefixfalse
% \end{macrocode}
-% |1.08| modifies the ending to not use the |\Etoc at swa| and |\Etoc at swb|
-% things. With this version, the |\Etoc at next| here is only to gobble
-% everything if it has to (or gobble only the \etoc things, when in
-% compatibility mode).
+% |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 at section} etc... to \csbc{Etoc at lxyz}. Now the \etoc custom
+% \csa{contentsline} passes over directly to \csbc{Etoc at lxyz} which will do
+% itself the job of adding hyperlinking according to the status of
+% \ctanpkg{hyperref}'s \csa{Hy at linktoc}.
%
-% For the record we don't do |\csname l@#1\endcsname| mainly because
-% hyperref patches |\contentsline|.
+% This is a breaking change if a user hacked \csa{contentsline} to do some
+% specific pre-processing of the data, as this extra will now be ignored. The
+% kind of hack one can think of is perhaps to pre-process the section title to
+% turn it into uppercase, this kind of things, but why do such things when one
+% is using \etoc which precisely provides a general interface for such
+% customization? Besides as the \LaTeX{} legacy set-up already mixes up in
+% various ways name and number in the second argument of \csa{contentsline},
+% doing such hacks in a non-breaking way was not easy, and could have broken
+% \etoc easily anyhow.
%
-% The location where \csbc{Etoc at savedcontentsline} is |\let| to
-% |\contentsline| has been moved with release |1.08| to before the
-% title as set by \csbc{etocsettocstyle}, thus it is now possible to open a
-% tabular in this part. And with the |\Etoc at global| prefix the user may
-% opt for global definitions of \csbc{etocname} and the like, thus use
-% freely |&| and other group closing things. Also, some care has been
-% put into doing only expandable things after expansion of the
-% \meta{prefix} and \meta{contents} parts of a sectioning unit
-% style.
+% The major hacker was \ctanpkg{hyperref}... Indeed in 2012 when I started
+% work on \etoc, it was not clear to me how \ctanpkg{hyperref} would end up
+% using the fourth argument of \csa{contentsline} and I did not want to spend
+% too much time tracing hyperref code. So I simply let \ctanpkg{hyperref} do
+% its stuff, and added specific post-processing branches to unravel it.
+% It looks quite dumb in retrospect (at this time the |.toc| file lines
+% with \csa{contentsline} had either three or four arguments which contributed
+% for the design decisions back then).
%
-% |1.09e| prepares for LaTeX November 2021 upcoming release
-% whose |\contentsline| will always grab four arguments whether or
-% not hyperref is loaded. The \csbc{Etoc at et@hop} definition done at
-% begin document must now swap the same number of arguments
-% whether or not hyperref is loaded (else \etoc would be broken in
-% absence of hyperref).
+% All \ctanpkg{hyperref} specific branches are now gone, replaced by extra
+% code added depending on the status of the \csbc{ifEtoc at hyperref} boolean.
+% We also check the \csa{Hy at 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}
- \Etoc at et@hop{\Etoc at prefix\Etoc at contents}{\Etoc at savedcontentsline{#1}}%
+ \Etoc at lxyz{#2}{#3}{#4}%
+ \Etoc at prefix\Etoc at contents
}
% \end{macrocode}
-% START OF MAINLY OBSOLETE COMMENTS
+% |1.1a| makes a core rewrite for compatibility with \ctanpkg{hyperref}.
+% In particular \csbc{Etoc at 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 at hyperref}
+% boolean here.
%
-% |2013/03/07|: up to |1.06| \etoc defined only \csbc{etocname}, \csbc{etocnumber} and
-% \csbc{etocpage}. The \ctanpkg{hyperref} added data is recycled in the simplest
-% manner, prefixing it with \csa{leavevmode}. The included
-% \csa{Hy at tocdestname} is (was, see below |1.07f| and |1.08a|) left
-% unexpanded. We have to spend some time with delimited macros to dis-entangle
-% the |.toc| data, and reconstruct the possible \ctanpkg{hyperref} data. If the page
-% number is not hyperlinked, \csbc{etocpage} does \emph{not} add the link found
-% possibly in the name.
-%
-% |1.07| adds \csbc{etocthename}, \csbc{etocthenumber}, \csbc{etocthepage} which
-% are left fragile and do not have the links data, and
-% \csbc{etoclink}\marg{linkname} which is robust and reconstructs an
-% arbitrarily named link.
-%
-% A need (for things like building up a token list to be used in a
-% |tikzpicture|) arose later to have some form of the link which could be
-% saved by a simple command like one can do
-% |\global\let\lastname\etocthename|, and avoid having to manipulate
-% \csa{Hy at tocdestname}. So |1.07f| adds \csbc{etocthelinkedname},
-% \csbc{etocthelinkednumber}, \csbc{etocthelinkedpage}, \csbc{etocthelink}: they
-% use \csa{hyperlink} with an expanded \csa{Hy at tocdestname}.
-%
-% |1.07f| also adds \csa{leavevmode} to \csbc{etoclink} which
-% should have been done earlier, as it was included in \csbc{etocname} etc...
-% attention, \csa{@namedef}|{A}{B}| and not \csa{@namedef}|{A} {B}| !!
-% on the other hand this gives a simple way to insert a space as the first
-% token in the paramaters. For \csbc{Etoc at again} (which appears later in the
-% code), a \csa{@firstofone} construct is however the simplest of all.
-%
-% END OF MAINLY OBSOLETE COMMENTS
-%
-% |1.08| adds \csbc{Etoc at global} prefix (|2015/03/09|).
-%
-% |1.08a| drops the original constructions of \csbc{etocname} etc... The obvious
-% decision to convert \csbc{etocname}, etc ... to be the robust versions of
-% \csbc{etocthelinkedname}, etc ... was delayed two years
-% (from |1.07f 2013/03/07| to |1.08a 2015/03/13|) for sentimental reason. But
-% the original
-% versions contained the hyperref destination only in unexpanded form, this
-% forced to use \csbc{etocthelinkedname}, etc... in cases when the thing had to
-% be stored for delayed use. Now the user can do this directly with
-% \csbc{etocname}, \csbc{etocnumber}, \csbc{etocpage} (taking into account though
-% that these are robust macros, thus perhaps using something like |\LetLtxMacro|.)
-%
-% |1.08j| turns \csbc{etoclink} into the robust version of \csbc{etocthelink}. Indeed
-% so far only \csbc{etocthelink} contained |\Hy at tocdestname| expanded. But
-% \csbc{etoclink} did not, and thus it could not be used after a group was
-% closed for example by a |&| from the sectioning style, even if having used
-% \csbc{etocglobaldefs}.
-%
-% |1.08n| adds |\futurelet|-based methods to avoid unbracing things.
-%
-% |1.08p| uses \csbc{Etoc@@getnb} (and \csbc{Etoc@@getit}) to intercept cases
-% when |\numberline| is hidden behind braces
-% (\url{https://github.com/ho-tex/hyperref/issues/65}).
+% 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,
+% \csbc{etoclink} added no hyperlink because \etoc identified the hyperlink
+% target from
+% the \ctanpkg{hyperref} hacked arguments of \csa{l at section} et al, rather
+% than picking it from the fourth argument of \csa{contentsline}.
% \begin{macrocode}
-\def\Etoc at lxyz #1#2{%
- \Etoc at global\let\etocthelink\@firstofone % fall-back, was let \@empty up to 1.08i (inc.)
- \Etoc at global\def\etocthename {#1}% (if linked, will be removed later)
- \Etoc at global\def\etocthelinkedname {#1}% (probably redefined later)
- \futurelet\Etoc at getthepage@token
- \Etoc at getthepage #2\etoc@ % defines \etocthelinkedpage
+\def\Etoc at lxyz #1#2#3{%
+ \ifEtoc at hyperref
+ \Etoc at global\def\etocthelink##1{\hyperlink{#3}{##1}}%
+ \else
+ \Etoc at global\let\etocthelink\@firstofone
+ \fi
+ \Etoc at global\def\etocthepage {#2}%
+ \ifEtoc at hyperref
+ \ifx\etocthepage\ltx at empty
+ \Etoc at global\let\etocthelinkedpage\etocthepage
+ \else
+ \Etoc at global\def\etocthelinkedpage{\hyperlink {#3}{#2}}%
+ \fi
+ \else
+ \Etoc at 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.
+% \begin{macrocode}
+ \Etoc at global\def\etocthename{#1}%
+ \ifEtoc at hyperref
+ \Etoc at global\def\etocthelinkedname{\hyperlink{#3}{#1}}%
+ \else
+ \Etoc at global\let\etocthelinkedname\etocthename
+ \fi
+% \end{macrocode}
+% Now we check if the entry was numbered and then disentangle the number from the name.
+% \begin{macrocode}
\futurelet\Etoc at getnb@token
- \Etoc@@getnb #1\relax\relax\etoc@ % sets number, name, and \etocthelink
+ \Etoc@@getnb #1\relax\relax\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 at number
\else
\ifnum\Etoc at level=\m at ne
\futurelet\Etoc at getit@token
- \Etoc@@getit #1\hspace\relax\etoc@ % additional job for parts
+ \Etoc@@getit #1\hspace\relax\etoc@
\fi
\fi
- \Etoc at global\expandafter\let\csname etoclink \endcsname\etocthelink
- \Etoc at global\expandafter\let\csname etocname \endcsname\etocthelinkedname
- \Etoc at global\expandafter\let\csname etocnumber \endcsname\etocthelinkednumber
- \Etoc at global\expandafter\let\csname etocpage \endcsname\etocthelinkedpage
- }
% \end{macrocode}
-% |1.08| adds the \csbc{Etoc at global}'s.
-%
-% |1.08j| fixes an old |\ifx #1\hyperlink at start| bug.
-%
-% Potential (but rather exotic) brace removal problems avoided at |1.08n|.
-%
-% |1.09g| delays definition of \csbc{Etoc at getthepage} to \csa{AtBeginDocument} to
-% check if \ctanpkg{hyperref} is at version |7.00u 2022-11-13| or later, as that
-% version replaced \csa{hyper at linkstart} with \csa{protected} macro
-% \csa{Hy at toclinkstart} which furthermore requires one more expansion step.
-% Formerly, the \csbc{ifEtoc at hyperref} test was executed via the expansion of
-% \csbc{Etoc at getthepage} but now this test is tacitly done only once at begin
-% document to define appropriately \csbc{Etoc at getthepage}. Falls back to
-% \csbc{Etoc at getthepage@nohyp}.
+% 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}.
% \begin{macrocode}
-\def\Etoc at getthepage@nohyp #1\etoc@ {%
- \Etoc at global\def\etocthepage {#1}%
- \Etoc at global\def\etocthelinkedpage {#1}%
+ \ifEtoc at number
+ \ifEtoc at hyperref
+ \def\Etoc at tmp##1##2{\Etoc at global\def##2{\hyperlink{#3}{##1}}}%
+ \expandafter\Etoc at tmp\expandafter{\etocthename}\etocthelinkedname
+ \expandafter\Etoc at tmp\expandafter{\etocthenumber}\etocthelinkednumber
+ \else
+ \Etoc at global\let\etocthelinkedname\etocthename
+ \Etoc at global\let\etocthelinkednumber\etocthenumber
+ \fi
+ \else
+ \Etoc at global\let\etocthenumber\@empty
+ \Etoc at global\let\etocthelinkednumber\@empty
+ \fi
+ \Etoc at global\expandafter\let\csname etoclink \endcsname\etocthelink
+ \Etoc at global\expandafter\let\csname etocname \endcsname\etocthename
+ \Etoc at global\expandafter\let\csname etocnumber \endcsname\etocthenumber
+ \Etoc at global\expandafter\let\csname etocpage \endcsname\etocthepage
+ \ifEtoc at hyperref
+ \Etoc at lxyz@hyper
+ \fi
}
% \end{macrocode}
-% |1.07k| corrects a bug here with an extra space before |##1| in
-% |\@namedef{etoclink } ##1|. In 99.99\% of use cases however, the
-% macro gets redefined at a later stage, thus the bug did not show.
+% 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 at linktoc} and if the page number is empty. This adds a dependency
+% that \csa{Hy at linktoc} should exist and have the expected interpretation.
%
-% |1.07n| replaces use of |\toks@| by macro |\Etoc at tmp|. Thus, the user has
-% the (not so recommended) possibility to use |\toks@| in the styles, even to
-% store information whose scope extends beyond the execution of each
-% |\contentsline|.
-%
-% |1.08| adds the \csbc{Etoc at global}'s.
-%
-% |1.08j| does not define \csa{etoclink<space>} anymore, only \csbc{etocthelink}
-% which contains the |\Hy at tocdestname| already expanded.
+% Matters of tagging will have to wait for \LaTeX\ itself to show me what it
+% does in \csa{l at section} etc... so that I can imitate.
% \begin{macrocode}
-\def\Etoc at getthepage@hyp #1#2#3#4#5\etoc@ {%
- \Etoc at global\def\etocthepage {#4}%
- \edef\Etoc at tmp {{#3}}%
- \Etoc at global\expandafter\def\expandafter\etocthelinkedpage\expandafter
- {\expandafter\hyperlink \Etoc at tmp{#4}}%
- \Etoc at global\edef\etocthelink##1{\noexpand\hyperlink\Etoc at tmp{##1}}%
+\def\Etoc at lxyz@hyper{%
+ \ifcase\Hy at linktoc
+ % none: nothing to do
+ \or % section (aka name for etoc): link name and number
+ \Etoc at global\expandafter\let\csname etocname \endcsname\etocthelinkedname
+ \Etoc at 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 at empty
+ \else
+ \Etoc at global\expandafter\let\csname etocpage \endcsname\etocthelinkedpage
+ \fi
+ \else % all
+ \Etoc at global\expandafter\let\csname etocname \endcsname\etocthelinkedname
+ \Etoc at global\expandafter\let\csname etocnumber \endcsname\etocthelinkednumber
+ \ifx\etocthepage\ltx at empty
+ \else
+ \Etoc at global\expandafter\let\csname etocpage \endcsname\etocthelinkedpage
+ \fi
+ \fi
}
-% \end{macrocode}
-% |1.08j| fixes an old buggy |\ifx #1\hyper at linkstart|. This could show if
-% hyperref was present with |linktoc=page| option for example, because in that
-% case |#1| could be some tokens within braces. As this is rare case though,
-% no bug was reported.
-%
-% Anyway I refactored the whole thing at |1.08n|.
-%
-% |1.08p| adds workaround for an extra brace pair inserted by hyperref
-% in case of |linktoc=page| option
-% \centeredline{\url{https://github.com/ho-tex/hyperref/issues/65}}
-%
-% |1.09f| examines also if next token in a space token; if it is we know
-% that we are not with a hyperref-customized entry and that we do not have a
-% numbered entry. We thus jump directly to \csbc{Etoc at getnb@nohyp at nonbr}, so
-% \csbc{etocthename} is certainly not redefined and there is no risk of space
-% gobbling and brace removal. This precaution is a bit academic though as
-% code from previous release could derail (i.e. mis-interpret data) only in
-% especially crafted circumstances.
-% \begin{macrocode}
\def\Etoc@@getnb {%
\Etoc at bracednamefalse
\let\Etoc at next\Etoc at getnb
@@ -8280,43 +8192,23 @@
\futurelet\Etoc at getnb@token\Etoc at getnb
}
% \end{macrocode}
-% |1.09g| adds an \csa{Etoc at getnb@a} which
-% gets defined only at begin document to adapt to \ctanpkg{hyperref} depending on
-% whether the latter is at |7.00u| or earlier. In absence of \ctanpkg{hyperref}
-% it is \csa{let} to \csbc{Etoc at getnb@nohyp}.
+% The |@nohyp| in the macro names is a legacy of pre-|1.1a| code.
% \begin{macrocode}
\def\Etoc at getnb {%
\ifx\Etoc at getnb@token\bgroup
\expandafter\Etoc at getnb@nohyp at nonbr
\else
- \expandafter\Etoc at getnb@a
+ \expandafter\Etoc at getnb@nohyp
\fi
}
% \end{macrocode}
-% |1.08| adds the \csbc{Etoc at global}'s.
-%
-% |1.08j| corrects an old |\ifx#1\numberline| into |\ifx\numberline#1|.
-%
-% |1.08k| uses a delimited macro to identify \csa{numberline},
-% \csa{chapternumberline} etc... in one go, avoiding
-% the |\let\chapternumberline\numberline| etc... which were done formerly
-% in \csbc{Etoc at tableofcontents}. Currently \etoc does not yet use \eTeX.
-%
-% |1.08m| fixes incompatibility of |1.08k|'s delimited macro method with KOMA's
-% \csa{nonumberline}.
-%
-% Both |1.08k| and
-% |1.08m| actually would have needed some |\detokenize| for complete safety
-% and so far \etoc does not use e-\TeX. So here at |1.08n| I refactored the
-% whole thing. And I added a |\futurelet|-based brace detection in
-% \csbc{Etoc at getnb} so here |#1| is guaranteed not braced now.
-%
-% |1.08n| tries to handle reasonably the |\nonumberline| of \ctanpkg{KOMA-script}.
+% |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.
%
-% At |1.09f| complications to get rid of a \ctanpkg{KOMA-script} |\nonumberline|
-% even though its meaning is |\empty| then, but for case of delayed use.
+% At |1.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.
% \begin{macrocode}
\def\Etoc at getnb@nohyp #1{%
\in@{#1}{\numberline\chapternumberline\partnumberline\booknumberline}%
@@ -8356,8 +8248,8 @@
\Etoc at global\let\etocthelinkednumber \@empty
}
% \end{macrocode}
-% Special KOMA branch: |#1| starts with |\nonumberline| which has here same
-% meaning as |\empty|. It is in the current provisory definition of
+% 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.
% \begin{macrocode}
@@ -8374,138 +8266,18 @@
\Etoc at global\let\etocthelinkedname \etocthename
}
% \end{macrocode}
-% |1.07n| replaces use of |\toks@| by macro |\Etoc at tmp|. |1.08| adds
-% the \csbc{Etoc at global}'s.
-%
-% |1.08j| corrects the old |\ifx#1\numberline| into |\ifx\numberline#1|.
-%
-% |1.08k| uses a delimited macro to identify \csa{numberline},
-% \csa{chapternumberline} etc... in one go.
-%
-% But anyway this was completely refactored at |1.08n|. Unfortunately
-% bad macro naming scheme caused a typo in a macro name, and it was
-% left undefined.
-% Fixed at |1.08o|.
-%
-% At |1.08p| which fixed an hyperref problem in case of |linktoc=page|
-% we are lazy because the problem with extra braces should not happen
-% in this branch (hyperref does not brace the hyperlink). So we ignore
-% the |\ifEtoc at bracedname| setting.
-%
-% At |1.09f| complications to get rid of a \ctanpkg{KOMA-script} |\nonumberline|
-% even though its meaning is |\empty| then, but for case of delayed use.
-%
-% At |1.09h| I converted the |#5#6| into |#5|, the |#5#6| had been kept
-% around for ages here, perhaps a legacy of early versions, anyway
-% here the macro really wants the |#4| anyhow only (and |#3|) and there
-% can be only one \csa{etoc@}.
-%
-% The |7.00u| \ctanpkg{hyperref} has modified the mark-up, but \csa{Etoc at getnb@a}
-% defined at begin document has caused the expansion of \csa{Hy at toclinkstart}
-% so we are back to the |<7.00u| situation; and \csa{Hy at toclinkend} is anyhow
-% gobbled as part of |#5| as was formerly \csa{hyper at linkend} so we don't have
-% to worry about that \ctanpkg{hyperref} change.
+% |1.1a| maps directly to \csbc{Etoc at getit@nohyp}, and the |@nohyp| will
+% perhaps be removed from its name at some later stage.
% \begin{macrocode}
-\def\Etoc at getnb@hyp #1#2#3#4#5\etoc@ {%
- \edef\Etoc at tmp {{#3}}%
- \Etoc at global\edef\etocthelink ##1{\noexpand\hyperlink {#3}{##1}}%
- \Etoc at global\def\etocthename {#4}% temporary definition
- \Etoc at global\expandafter\def\expandafter\etocthelinkedname
- \expandafter {\expandafter\hyperlink \Etoc at tmp{#4}}%
- \futurelet\Etoc at hyp@getnb at token\Etoc at getnb@hyp at a #4\relax\relax\etoc@
-}
-% \end{macrocode}
-% In case of an upfront brace, the sectioning heading is not numbered, so we
-% can avoid potential brace removal problems by jumping now to the not
-% numbered branch not hyperlinked branch; indeed \csbc{etocthelinkedname} has
-% already been defined with the |\hyperlink| so we can bail out.
-% \begin{macrocode}
-\def\Etoc at getnb@hyp at a {%
- \ifx\Etoc at hyp@getnb at token\bgroup
- \expandafter\Etoc at getnb@nohyp at nonbr
- \else
- \expandafter\Etoc at getnb@hyp at b
- \fi
-}
-\def\Etoc at getnb@hyp at b #1{%
- \in@{#1}{\numberline\chapternumberline\partnumberline\booknumberline}%
- \ifin@
- \let\Etoc at next\Etoc at getnb@hyp at nmbrd
- \else
-% \end{macrocode}
-% If not numbered we can bail out to the "nohyp" branch, as
-% \csbc{etocthelinkedname} has already been defined with the |\hyperlink|.
-% \begin{macrocode}
- \let\Etoc at next\Etoc at getnb@nohyp at nonbr
- \in@{#1}{\nonumberline}%
- \ifin@
-% \end{macrocode}
-% In case of presence of KOMA \csa{nonumberline} we need to expand it
-% once, and then execute the numbered branch which will redefine
-% \csbc{etocthename} as well. But in case it is empty we will have to
-% correct \csbc{etocthename}, just to be perfect.
-% \begin{macrocode}
- \ifx\nonumberline\empty
- \let\Etoc at next\Etoc at getnb@hyp at nonumberline
- \else
- \def\Etoc at next{\expandafter\Etoc at getnb@hyp at nmbrd}%
- \fi
- \fi
- \fi
- \Etoc at next #1%
-}
-\def\Etoc at getnb@hyp at nmbrd #1#2#3\relax\relax\etoc@ {%
- \Etoc at global\Etoc at numbertrue
- \Etoc at global\def\etocthenumber {#2}%
- \Etoc at global\expandafter\def\expandafter\etocthelinkednumber
- \expandafter{\expandafter\hyperlink \Etoc at tmp{#2}}%
- \Etoc at global\def\etocthename {#3}%
- \Etoc at global\expandafter\def\expandafter\etocthelinkedname
- \expandafter{\expandafter\hyperlink \Etoc at tmp{#3}}%
-}
-% \end{macrocode}
-% Special KOMA branch: |#1| starts with |\nonumberline| which has here same
-% meaning as |\empty|. We need to remove it.
-% \begin{macrocode}
-\def\Etoc at getnb@hyp at nonumberline #1\relax\relax\etoc@ {%
- \Etoc at global\Etoc at numberfalse
- \Etoc at global\let\etocthenumber \@empty
- \Etoc at global\let\etocthelinkednumber \@empty
- \ifEtoc at bracedname
- \Etoc at global\expandafter\def\expandafter\etocthename
- \expandafter{\expandafter{#1}}%
- \else
- \Etoc at global\expandafter\def\expandafter\etocthename\expandafter{#1}%
- \fi
- \Etoc at global\expandafter\expandafter\expandafter\def
- \expandafter\expandafter\expandafter\etocthelinkedname
- \expandafter\expandafter\expandafter{%
- \expandafter\expandafter\expandafter\hyperlink
- \expandafter\Etoc at tmp\expandafter{\etocthename}}%
-}
-% \end{macrocode}
-% |1.08| adds the \csbc{Etoc at global}'s.
-%
-% |1.08n| refactors this but it is still not extremely robust.
-%
-% |1.08p| completes the fix of |linktoc=page| problematic hyperref. If
-% the name was found to be braced, keep the brace pair on extracted
-% name. But not for extracted number... don't ask why, I did not want
-% spending ages on working around hyperref's bug.
-% \begin{macrocode}
\def\Etoc@@getit{%
\ifEtoc at bracedname
\expandafter\expandafter\expandafter\Etoc at getit@nameisbraced
\expandafter\@firstofone
\else
- \expandafter\Etoc at getit
+ \expandafter\Etoc at getit@nohyp
\fi
}
-\def\Etoc at getit@nameisbraced {\futurelet\Etoc at getit@token\Etoc at getit }
-% \end{macrocode}
-% |1.09g| delays defining \csbc{Etoc at getit} to at begin document to adapt to
-% \ctanpkg{hyperref} depending on whether the latter is at |7.00u| or earlier.
-% \begin{macrocode}
+\def\Etoc at getit@nameisbraced {\futurelet\Etoc at getit@token\Etoc at getit@nohyp }
\def\Etoc at getit@nohyp #1\hspace#2#3\etoc@ {%
\ifx\relax#2%
\else
@@ -8524,51 +8296,6 @@
\Etoc at global\let\etocthelinkedname\etocthename
}
% \end{macrocode}
-% |1.07n| replaces use of |\toks@| by macro |\Etoc at tmp|. |1.08| adds
-% the \csbc{Etoc at global}'s.
-%
-% |1.08j| adds \csbc{etocthelink} definition here which was missing. This bug
-% showed in case hyperref was used with option |linktoc=page|, for |part|
-% styles: the \csbc{etocthelink} would not create a link if used therein. But the
-% |linktoc=page| condition could easily however trigger the more serious
-% |\ifx| bug in \csbc{Etoc at getnb} also fixed at |1.08j|, and this would have
-% overshadowed this one by a real compilation error rather than a missing link
-% in the procuced PDF.
-%
-% |1.08n| refactors the whole thing. |1.08o| chooses better names for
-% macros.
-%
-% For |1.08p| fix of hyperref's extra brace (see \csbc{Etoc@@getnb},
-% \csbc{Etoc@@getit}), this branch should not suffer the issue, hence I
-% don't bother checking |\ifEtoc at bracedname| status.
-%
-% At |1.09h| the |#5#6| becomes |#5|, the |#5#6| was for some legacy reason
-% I guess, but here the macro really wants the |#4| anyhow only (and |#3|).
-% \begin{macrocode}
-\def\Etoc at getit@hyp #1#2#3#4#5\etoc@ {%
- \edef\Etoc at tmp {{#3}}%
- \Etoc at global\edef\etocthelink ##1{\noexpand\hyperlink \Etoc at tmp{##1}}%
- \Etoc at global\def\etocthename {#4}% temporary definition
- \Etoc at global\expandafter\def\expandafter\etocthelinkedname
- \expandafter{\expandafter\hyperlink \Etoc at tmp{#4}}%
- \Etoc at getit@hyp at a #4\hspace\relax\etoc@
-}
-\def\Etoc at getit@hyp at a #1\hspace#2#3\etoc@ {%
- \ifx\relax#2% not extremely safe
- \else
- \Etoc at global\Etoc at numbertrue
- \Etoc at global\def\etocthenumber {#1}%
- \Etoc at global\expandafter\def\expandafter\etocthelinkednumber
- \expandafter{\expandafter\hyperlink \Etoc at tmp{#1}}%
- \Etoc at getit@hyp at getname #3\etoc@
- \fi
-}
-\def\Etoc at getit@hyp at getname #1\hspace\relax\etoc@ {%
- \Etoc at global\def\etocthename {#1}%
- \Etoc at global\expandafter\def\expandafter\etocthelinkedname
- \expandafter{\expandafter\hyperlink \Etoc at tmp{#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...
% \begin{macrocode}
@@ -8578,7 +8305,7 @@
\let\etocthelinkedname \@empty
\let\etocthelinkednumber \@empty
\let\etocthelinkedpage \@empty
-\let\etocthelink \@firstofone % prior to 1.08j its was \let to \@empty
+\let\etocthelink \@firstofone
\DeclareRobustCommand*{\etocname} {}
\DeclareRobustCommand*{\etocnumber}{}
\DeclareRobustCommand*{\etocpage} {}
@@ -8586,15 +8313,9 @@
\DeclareRobustCommand*{\etocifnumbered}
{\ifEtoc at number\expandafter\@firstoftwo\else\expandafter\@secondoftwo\fi}
\expandafter\let\expandafter\etocxifnumbered\csname etocifnumbered \endcsname
-% \end{macrocode}
-% |1.08| defines \csbc{etociffirst}
-% \begin{macrocode}
\DeclareRobustCommand*{\etociffirst}
{\ifEtoc at isfirst\expandafter\@firstoftwo\else\expandafter\@secondoftwo\fi}
\expandafter\let\expandafter\etocxiffirst\csname etociffirst \endcsname
-% \end{macrocode}
-% |1.07j| modifies \csbc{Etoc at readtoc}.
-% \begin{macrocode}
\def\Etoc at readtoc {%
\ifeof \Etoc at tf
\else
@@ -8618,9 +8339,6 @@
\global\Etoc at toctoks=\expandafter{\the\Etoc at toctoks}%
\closein\Etoc at tf}}
{\typeout{No file \jobname.toc.}}}
-% \end{macrocode}
-% 1.07d: parskip and |\@nobreakfalse| stuff moved to \csbc{Etoc at tableofcontents}
-% \begin{macrocode}
\def\Etoc at openouttoc{%
\ifEtoc at hyperref
\ifx\hyper at last\@undefined
@@ -8638,16 +8356,6 @@
\fi
\global\let\Etoc at openouttoc\empty
}
-% \end{macrocode}
-% |1.08| has a new way to handle |\Etoc at standardtrue|.
-%
-% Also the expansion of \csbc{Etoc at levellist} is moved to inside
-% \csbc{Etoc at tableofcontents} as set-up by \csbc{etocsettocstyle}. This opens up
-% the possibility for the user to open a group in the title (for example
-% start a tabular) which would be closed (by the first |&|) sometime
-% later. In combination with \csbc{etocglobaldefs} it will be now much
-% easier to typeset TOC as tables with \etoc!
-% \begin{macrocode}
\def\Etoc at toctoc{%
\global\Etoc at vfalse
\global\Etoc at ivfalse
@@ -8671,27 +8379,12 @@
\fi
}
% \end{macrocode}
-% Slightly better coded in |1.08b|. Had some bad experiences with TeX
-% conditionals back in 2011/2012 when I started LaTeX programming, and the
-% code was a remnant of extra cautious attitude. Also, now
-% \csbc{etoc@@startlocaltoc} is expandable if it does nothing.
-%
-% |2015/04/16|: |1.08e| removes a \csbc{ifEtoc at notactive} test as |\ifnum| can
-% be positive only once anyhow; although the \csbc{ifEtoc at notactive} boolean
-% could be faster than an |\ifnum|, it adds to it as long as the local toc id
-% is not yet found.
-%
-% I replace (|1.08e|) the \csbc{Etoc at global}'s for \csa{Etoc at localtop} by
-% |\global|'s. The |\relax| is needed because |#2| may sometimes be a count,
-% sometimes tokens.
-%
-% Attention! |1.09| defines a public \csbc{etoclocaltop} in replacement of old
-% \csa{Etoc at localtop} \emph{minus one}. Memo: \csbc{etoclocaltop} has only
+% Memo: \csbc{etoclocaltop} has only
% meaningful meaning when the local toc has its "active" flag set. Except that
% I used a "notactive" flag to torture myself, so: has the "notactive" flag
% off.
%
-% Also attention |1.09| now sets the |\c at tocdepth| there in relation to
+% Also attention |1.09| now sets the \csa{c at tocdepth} there in relation to
% implementation of \localtocwrdp. This is needed for line styles in
% compatibility mode as the code from standard classes checks the tocdepth
% counter.
@@ -8722,41 +8415,20 @@
}
\let\etoc at startlocaltoc\@gobble
% \end{macrocode}
-% |2015/03/16|: |1.08e| tests if a local table of contents turns out empty.
-% The \csa{Etoc at localtop} there does not have the same meaning as when set-up
-% by the regular \csbc{etoc@@startlocaltoc}. It is off by 1 (in general). THIS
-% IS OBSOLETE since |1.09|: a \csbc{etoclocaltop} is used with same meaning in
-% all code branches.
-%
-% After some hesitation I opted for making and obeying the test always (*) for
-% local tables of contents, and do it also for global tables of contents but
-% for the latter the user must issue \csbc{etocnotocifnotoc} for the emptiness
-% test to be obeyed. The emptiness tests are to be trusted only when the
-% compilations have stabilized.
-%
-% (*) finally the user must issue \csbc{etocchecksemptiness} once.
-%
% \csbc{Etoc at tocid} is the number of the toc (possibly gotten via a |\ref|
% following a \csbc{tableofcontents}), or it is |\z@| if the emptiness test is
% from a global toc. Until the compilations stabilize, some local TOCs can get
% printed at wrong locations naturally and emptiness tests can not be trusted
-% either. Releases earlier than |1.08e| authorized
-% \csbc{tableofcontents}|\ref{foo}| with |foo| the label of a \emph{global}
-% toc. But as it was impossible (without much complications) to discriminate,
-% until auxiliary files have stabilized, between a |\ref| to a local toc whose
-% id is not yet in the |.toc| file and a |\ref| to a global toc whose id will
-% in the end definitely not be in the |.toc| file, I decided that this silly
-% possibility should not be supported anymore. This allowed to remove a few
-% tokens from \csbc{Etoc at tableofcontents} as well. And it also allowed
-% improvements to \csbc{Etoc at localtableofcontents}.
+% either.
%
% Note: (|1.08i 2016/09/29|) the code has to handle both local and total toc.
-% Hence the flag \csbc{ifEtoc at notactive} has to be set prior to it. For a global
-% toc, the \csbc{Etoc at tocid} was set to |\z@|, and the |\ifnum| in
-% \csbc{etoc at startlocaltoc} did always fail, but I now prefer to simply nullify
-% the \csbc{etoc at startlocaltoc}. As its default fallback is |\@gobble| I simply
-% test here for the \csbc{ifEtoc at localtoc} flag. The \csbc{Etoc at tocid} will be undefined for a
-% global toc but it is not tested anymore.
+% Hence the flag \csbc{ifEtoc at notactive} has to be set prior to it. For a
+% global toc, the \csbc{Etoc at tocid} was set to |\z@|, and the |\ifnum| in
+% \csbc{etoc at startlocaltoc} did always fail, but I now prefer to simply
+% nullify the \csbc{etoc at startlocaltoc}. As its default fallback is
+% |\@gobble| I simply test here for the \csbc{ifEtoc at localtoc} flag. The
+% \csbc{Etoc at tocid} will be undefined for a global toc but it is not tested
+% anymore.
%
% Note: the mechanism for recognizing the level when a local toc is
% encountered is different from the one in \csbc{etoc@@startlocaltoc} which uses
@@ -8763,12 +8435,7 @@
% the level flags. Here we just record in \csbc{Etoc at level} where we last stood.
% The initialization |\global\let\Etoc at level\Etoc at minf| is thus needed in case
% the |.toc| file contains an \csbc{etoc at startlocaltoc} before any
-% |\contentsline|.
-%
-% |1.08i| has two |testingcontentsline| macros, one for local, one for global.
-%
-% |1.09| renames the \csa{Etoc at localtop} which was used here to a public
-% \csbc{etoclocaltop} to make it usable in \csbc{etocsettocstyle}.
+% \csa{contentsline}.
% \begin{macrocode}
\def\Etoc at setemptytocbool {%
\global\Etoc at emptytoctrue
@@ -8805,14 +8472,11 @@
\else
\global\expandafter\let\expandafter\Etoc at level\csname Etoc@#1@@\endcsname
% \end{macrocode}
-% |\ifEtoc at notactive| set to False by \csbc{etoc at startlocaltoc} with right id. It
+% \csbc{ifEtoc at notactive} set to False by \csbc{etoc at startlocaltoc} with right id. It
% that happened, check level of hit against unit. Will decide if empty or not.
% Set \csbc{ifEtoc at stoptoc} flag afterwards in all cases. \csa{Etoc at localtop} will have been
% initialized by \csbc{etoc@@startlocaltoc} as \csbc{ifEtoc at notactive} flag can be
% false only then.
-%
-% |1.09| renamed the \csa{Etoc at localtop} as formerly here to \csbc{etoclocaltop}
-% and adds support for \localtocwrdp.
% \begin{macrocode}
\ifEtoc at notactive
\else
@@ -8827,7 +8491,7 @@
\fi
\fi
\fi
- \Etoc at gobblefourorthree\relax
+ \@gobblefour\relax
}
\def\Etoc at testingcontentsline #1{%
\ifEtoc at stoptoc
@@ -8840,22 +8504,9 @@
\fi
\fi
\fi
- \Etoc at gobblefourorthree\relax
+ \@gobblefour\relax
}
% \end{macrocode}
-% |1.07g| suppresses the printing of |--unknown etoc ref: run latex again--| as
-% sometimes one uses \csbc{localtableofcontents} to prepare something else, and one
-% does not want any text output even in intermediate runs.
-%
-% Also |1.07g| adds \csbc{etocaftertochook} to help with
-% \csbc{invisiblelocaltableofcontents} (and then I did \csbc{etocsetnexttocdepth}).
-% |1.07h| makes the hook used by \csbc{etocsetnexttocdepth} private.
-%
-% |2015/03/14|: |1.08b| suppresses a space token from an unprotected end of
-% line at the end after the replacement text of \csbc{etoc at startlocaltoc} (bug
-% dating back to |1.03 2012/11/23|). I didn't see it due to the originally
-% badly formatted source of |\Etoc at next|.
-%
% |2015/03/16|: |1.08e| lets \csbc{localtableofcontents} do a first scan of the
% |.toc| file (as stored in \csbc{Etoc at toctoks}) to determine if the table of
% contents will in fact end up empty. In that case, nothing is typeset. The
@@ -8899,7 +8550,7 @@
% TOC needing more compilations. The emptiness status is undecided, the code
% declares the TOC non empty.
%
-% |1.08i-2016/09/29| now does |\Etoc at localtoctrue| right at the start (the
+% |1.08i-2016/09/29| now does \csa{Etoc at localtoctrue} right at the start (the
% earlier code could have to handle table of contents which were actually
% global, via the |\label/\ref| mechanism.) It does not rely on the |\ifnum|
% automatically false in \csbc{etoc@@startlocaltoc} due to the special values |0|
@@ -8914,7 +8565,7 @@
%
% I hesitated with |1.08i| to write something to aux file in order to let
% \LaTeX\ prompt the user for extra pass, after insertion of some new
-% |\localtableofcontents|, but finally I prefer to only trick \LaTeX\ into
+% \csa{localtableofcontents}, but finally I prefer to only trick \LaTeX\ into
% telling about undefined references.
%
% The \csa{PackageWarning} approach has the advantage
@@ -8925,7 +8576,7 @@
% second approach. (edit |2017/10/23|: good thing I documented that! I had
% completely forgotten that rationale, but I wonder if it is correct.)
%
-% Also the |\PackageWarning| does not trigger a visible message
+% Also the \csa{PackageWarning} does not trigger a visible message
% near the end of the log file or console output, contrarily to a
% \centeredline{|LaTeX Warning: There were undefined references.|}
% followed by a
@@ -8940,43 +8591,35 @@
\global\Etoc at emptytocfalse
\edef\Etoc at tocid{#1}%
\ifnum\Etoc at tocid<\@ne
- %\PackageWarning{etoc}{Unknown toc reference \@secondoftwo#1. Run LaTeX again}%
\setbox0\hbox{\ref{Unknown toc ref \@secondoftwo#1. Rerun LaTeX}}%
- %\if at filesw\immediate\write\@mainaux{\noexpand\@tempswatrue}\fi
- \global\Etoc at stoptoctrue % do only heading
+% \end{macrocode}
+% Do only heading, skip all the rest.
+% \begin{macrocode}
+ \global\Etoc at stoptoctrue
\gdef\etoclocaltop{-\thr@@}%
\Etoc at tableofcontents
- \expandafter\Etoc at gobbletoetoc@ % skip all the rest
+ \expandafter\Etoc at gobbletoetoc@
\fi
\global\Etoc at notactivetrue
-% \end{macrocode}
-% |1.08i|'s \csbc{Etoc at setemptytocbool} now checks |localtoc| flag.
-% \begin{macrocode}
\ifEtoc at checksemptiness
\Etoc at setemptytocbool
\fi
\ifEtoc at emptytoc
\ifEtoc at notactive
- %\PackageWarning{etoc}{Unknown toc ID \number\Etoc at tocid. Run LaTeX again}%
\setbox0\hbox{\ref{Unknown toc ID \number\Etoc at tocid. Rerun LaTeX}}%
- %\if at filesw\immediate\write\@mainaux{\noexpand\@tempswatrue}\fi
- \global\Etoc at emptytocfalse % assume real one will be non-empty
- \global\Etoc at stoptoctrue % and print only heading for this pass
+% \end{macrocode}
+% Assume real one will be non-empty and print only heading for this pass.
+% \begin{macrocode}
+ \global\Etoc at emptytocfalse
+ \global\Etoc at stoptoctrue
\gdef\etoclocaltop{-\thr@@}%
\Etoc at tableofcontents
\expandafter\expandafter\expandafter\Etoc at gobbletoetoc@
- \else
- %% \PackageWarning{etoc}{This toc is apparently empty}%
\fi
\else
\global\Etoc at stoptocfalse
\global\Etoc at notactivetrue
% \end{macrocode}
-% Prior to |1.09| a \csa{Etoc at localtop} was reset here. This has now been
-% moved to \csbc{Etoc at tableofcontents} and \csa{Etoc at localtop} replaced by a
-% public \csbc{etoclocaltop} usable in line styles, and in \csbc{etocsettocstyle}
-% (under checksemptinesstrue regime).
-%
% We can end up here either if the emptiness check was done and turned
% negative (then \csbc{etoclocaltop} has the correct level for usage in first
% argument of \csbc{etocsettocstyle}), or if the emptiness check was not done.
@@ -8988,8 +8631,8 @@
\fi
\@gobble\etoc@
\endgroup\ifEtoc at mustclosegroup\endgroup\fi
- \Etoc at tocdepthreset % 1.07h, renamed 1.08h
- \etocaftertochook % 1.07g
+ \Etoc at tocdepthreset
+ \etocaftertochook
% \end{macrocode}
% |1.09| hesitates about putting this before of after the
% \csbc{etocaftertochook}. The information of the used tocdepth is lost if
@@ -8996,7 +8639,7 @@
% puuting it first. The usage of \csbc{etocaftertochook} may be broken if
% unexpected tokens follows.
% \begin{macrocode}
- \let\Etoc at localtocdepth\c at tocdepth % 1.09
+ \let\Etoc at localtocdepth\c at tocdepth
}% \Etoc at localtableofcontents
% \end{macrocode}
% |2013/03/07|: I discover a \csa{@namedef} trick to construct the
@@ -9004,7 +8647,7 @@
% | \@namedef {Etoc at again} {...stuff...}|\\
% Original version was (copied from analogous stuff in |source2e|):\\
% | {\def\1{\Etoc at again}\expandafter\gdef\1 {...stuff...}}|\\
-% and in the end (now that I think about it) I simply use |\@firstofone|.\par
+% and in the end (now that I think about it) I simply use \csa{@firstofone}.\par
% \begin{macrocode}
\def\Etoc at getrefno #1#2\etoc@ {#1}
\def\Etoc at getref #1{\@ifundefined{r@#1}{0}{\expandafter\expandafter\expandafter
@@ -9013,14 +8656,9 @@
\def\Etoc at label#1{\label{#1}\futurelet\Etoc at nexttoken\Etoc at t@bleofcontents}
\@firstofone{\def\Etoc at again} {\futurelet\Etoc at nexttoken\Etoc at t@bleofcontents}
% \end{macrocode}
-% |1.08e| adds test for emptiness. And uses another coding style for
-% conditional branching. Easier to read. Not tested for efficiency.
+% |\ref{foo}| expects |foo| to be a label to a \emph{local} TOC.
%
-% Also, |\ref{foo}| expects |foo| to be a label to a \emph{local} TOC. Earlier
-% versions accepted a reference to a global TOC, I have removed the support
-% from \csbc{Etoc at tableofcontents}.
-%
-% The syntax \csbc{localtableofcontents}|\ref{foo}| is now accepted.
+% The syntax \csbc{localtableofcontents}|\ref{foo}| is supported.
% \begin{macrocode}
\def\Etoc at dothis #1#2\etoc@ {\fi #1}
\def\Etoc at t@bleofcontents{%
@@ -9030,8 +8668,7 @@
% \end{macrocode}
% \csbc{Etoc at ref} will hand over directly to \csbc{Etoc at localtableofcontents}.
% Argument will be (or rather expand to) zero if the reference is non-existent
-% yet. There was an \csa{Etoc at tocwithidfalse} flag which |1.08i| suppresses as it
-% is not used afterwards (since |1.08e| I think.)
+% yet.
% \begin{macrocode}
\ifx\Etoc at nexttoken\ref\Etoc at dothis{\expandafter\Etoc at ref\@gobble}\fi
% \end{macrocode}
@@ -9055,22 +8692,16 @@
\fi
\Etoc at tableofcontents
\endgroup\ifEtoc at mustclosegroup\endgroup\fi
- \Etoc at tocdepthreset % 1.07h, renamed 1.08h
- \etocaftertochook % 1.07g
+ \Etoc at tocdepthreset
+ \etocaftertochook
\@gobble\etoc@
}% \Etoc at t@bleofcontents
% \end{macrocode}
-% |1.07g| for consistency Etoc@ prefix added.
-%
-% |1.08c| does not use |\arabic| in the |\addtocontents| since I have seen
+% |1.08c| does not use |\arabic| in the \csa{addtocontents} since I have seen
% that in some circumstances (for some right to left languages with
% polyglossia or babel), one can not rely on |\arabic| having its default
% definition. As the number written here will be used later in an \csa{ifnum}, I
% should not have used it in the first place (done |2015/03/30|).
-%
-% |1.08i| moves elsewhere definition of \csbc{etoc at startlocaltoc}. In
-% \csbc{Etoc at table@fcontents} case it remains to be seen if a |\ref| follows which
-% could turn the TOC into a local one. Handled by \csbc{Etoc at t@bleofcontents}.
% \begin{macrocode}
\def\Etoc at table@fcontents{%
\refstepcounter{etoc at tocid}%
@@ -9081,13 +8712,6 @@
\addtocontents{toc}{\string\etoc at startlocaltoc{\the\c at etoc@tocid}}%
\Etoc at tocwithidtrue
\futurelet\Etoc at nexttoken\Etoc at t@bleofcontents}
-% \end{macrocode}
-% |1.07g| defines \csbc{etoctableofcontents} to be able to undo the evil and
-% brutal doings of some packages with |\tableofcontents|.
-%
-% |1.08| patches \ctanpkg{tableof}'s influence. Version |1.4a| or later of \ctanpkg{tableof}
-% is needed.
-% \begin{macrocode}
\let\etocaftertitlehook \@empty
\let\etocaftercontentshook \@empty
% \end{macrocode}
@@ -9098,18 +8722,18 @@
% \begin{macrocode}
\def\etoctableofcontents{%
\Etoc at openouttoc
- \Etoc at tocdepthset % new with 1.08h (\etocsetnexttocdepth)
- \begingroup % closed in \Etoc at t@bleofcontents or \Etoc at localtableofcontents
+ \Etoc at tocdepthset
+ \begingroup
% \end{macrocode}
-% Prior to its release |1.4c|, \ctanpkg{tableof} added a group pair via |\tof at begin|
-% and |\tof at finish|. This was removed at |1.4c|. So no need to do anything now
-% here about silencing |\tof at begingroup| and |\tof at endgroup|: they are
+% This group will be closed in \csbc{Etoc at t@bleofcontents} or
+% \csbc{Etoc at localtableofcontents}.
+%
+% Prior to its release |1.4c|, \ctanpkg{tableof} added a group pair via \csa{tof at begin}
+% and \csa{tof at finish}. This was removed at |1.4c|. So no need to do anything now
+% here about silencing \csa{tof at begingroup} and \csa{tof at endgroup}: they are
% inserted only in the \ctanpkg{tableof} private copy of the |.toc| file which is
% used by its own table of contents typesetting command.
%
-% |1.08i| removes definition of \csbc{etoc at startlocaltoc} from here. It is done
-% in \csbc{Etoc at localtableofcontents} or uses its default of |\@gobble|.
-%
% |1.09b| uses a |\def| in non-starred variant for allowing tricks to
% recognize later on if we are in a starred or non-starred case, whatever the
% user definition of \csbc{etocaftertitlehook} may be.
@@ -9126,9 +8750,10 @@
\let\tableofcontents\etoctableofcontents
\newcommand*\localtableofcontents{%
\Etoc at openouttoc
- \Etoc at tocdepthset % new with 1.08h (\etocsetnexttocdepth)
- \begingroup % closed in \Etoc at t@bleofcontents or \Etoc at localtableofcontents
+ \Etoc at tocdepthset
+ \begingroup
% \end{macrocode}
+% This group closed in \csbc{Etoc at t@bleofcontents} or \csbc{Etoc at localtableofcontents}.
% Same comment relative to \ctanpkg{tableof}. No need to do anything here.
% \begin{macrocode}
\@ifstar
@@ -9152,33 +8777,9 @@
}% \localtableofcontentswithrelativedepth
\let\Etoc at localtocdepth\c at tocdepth
% \end{macrocode}
-% |1.08| moves earlier the definitions of \csbc{Etoc at savedcontentsline} as
-% well as \csbc{Etoc at levellist}. It will thus not be operative to do
-% \csbc{etocsetlevel} from inside the title now. But perhaps it will be
-% easier to deal with tables.
-%
-% Also I remove a big |\@firstofone|, and use rather
-% \csbc{Etoc at gobbletoetoc@} for the gobbling case.
-%
-% Also, |1.08| modifies the code to do only expandable things after
+% The code does only expandable things after
% \csbc{Etoc at toctoc}, in order to allow opening of an alignment in the first
-% argument and closing in the second. Earlier versions had an
-% |\Etoc@@next| initially set to relax after the first \csbc{Etoc at toctoc}. I
-% was in 2012/2013 quite uneasy with the TeX conditionals hence wanted
-% for safety to move the things for the second invocation of
-% \csbc{Etoc at toctoc} after the |\fi\fi\fi|. I could define an |\afterfififi|
-% macro, but it should be ok as it is done here.
-%
-% |1.08e| moved the \csbc{Etoc at par} to \csbc{Etoc at tableofcontents}. This was needed
-% for the implementation of the emptiness test. It might have some impact in
-% fringe cases as the \csa{refstepcounter} is now done before the |\par| is
-% issued.
-%
-% |1.08e| suppresses the possibility to do a \csbc{tableofcontents}|\ref{foo}|
-% with |foo| the label of a global TOC: issueing \csbc{tableofcontents} alone
-% suffices. Allowed to simplify some code.
-%
-% |1.08g| moves \csbc{Etoc at par} to before \csbc{etocbeforetitlehook}, not after.
+% argument and closing in the second.
% \begin{macrocode}
\long\def\Etoc at gobbletoetoc@ #1\etoc@ {}
\newcommand\etocsettocstyle[2]{%
@@ -9189,27 +8790,30 @@
\expandafter\Etoc at gobbletoetoc@
\fi
\Etoc at par
- \etocbeforetitlehook % 1.07m
- \Etoc at storetocdepth % 1.07g
- \let\Etoc at savedcontentsline\contentsline % moved up here 1.08
+ \etocbeforetitlehook
+ \Etoc at storetocdepth
+ \let\Etoc at savedcontentsline\contentsline
\let\contentsline\Etoc at etoccontentsline
\ifEtoc at standard
- \else % moved here from \Etoc at toctoc (1.08)
+ \else
% \end{macrocode}
-% Prior to |1.08|, this was done in \csbc{Etoc at toctoc}
-%
-% |1.08k| defines here |\etocsavedchaptertocline|, |\etocsavedsectiontocline|,
-% and so on for all declared level names, again at each TOC and for the
-% duration of it.
+% |1.1a|'s \csbc{Etoc at lxyz} now fetches 3 not 2 arguments and the
+% \csa{l at section} etc... are not |\let| to it anymore, as they used to be here
+% formerly. For backwards compatibility the \csa{etocsavedchaptertocline}
+% etc... are still defined, but raise a deprecation warning.
% \begin{macrocode}
\def\Etoc at levellist@elt####1{%
- \expandafter\let\csname etocsaved####1tocline\expandafter\endcsname
- \csname l@####1\endcsname
- \expandafter\let\csname l@####1\endcsname\Etoc at lxyz}%
+ \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 }%
+ \expandafter\let\csname etocsaved####1tocline\expandafter\endcsname
+ \csname l@####1\endcsname
+ \csname l@####1\endcsname
+ }%
+ }%
\Etoc at levellist
-% \end{macrocode}
-% |1.08k| removes |\let\chapternumberline\numberline| etc... done formerly here
-% \begin{macrocode}
\fi
% \end{macrocode}
% |1.09| makes \csbc{etocsetnexttocdepth} usable in |#1| (but this is not 100\%
@@ -9220,7 +8824,7 @@
% \begin{macrocode}
#1%
\Etoc at tocdepthset
- \ifEtoc at parskip\parskip\z at skip\fi %1.07d
+ \ifEtoc at parskip\parskip\z at skip\fi
\Etoc at aftertitlehook
% \end{macrocode}
% |1.09| has replaced former \csa{Etoc at localtop} (\emph{minus one}) by
@@ -9232,28 +8836,24 @@
\gdef\etoclocaltop{-\thr@@}%
\Etoc at toctoc
\etocaftercontentshook
- #2\@nobreakfalse % 1.07d: \@nobreakfalse moved here
- \Etoc at restoretocdepth % 1.07g. moved here from before #2 by 1.08
+ #2\@nobreakfalse
+ \Etoc at restoretocdepth
% \end{macrocode}
-% |\contentsline| was set to \csbc{Etoc at etoccontentsline} by a non-global |\let|,
+% \csa{contentsline} was set to \csbc{Etoc at etoccontentsline} by a non-global |\let|,
% and it will recover its normal value from exiting a scope limiting group.
-% But \ctanpkg{tableof} (since |1.4a|) under |\etocglobaldefstrue| does a global
-% redefinition of |\contentsline|. Its |\tof at finish| then does a global
-% restore of |\contentsline|, but it will be to the \etoc set
-% value. |\tof at finish| is active only if either the table of contents was
-% typeset using |\tableof|, |\tablenotof|, |\tableoftaggedcontents|, or
-% |\nextocwithtags| was used. If not active it is either undefined (no
+% But \ctanpkg{tableof} (since |1.4a|) under \csa{etocglobaldefstrue} does a global
+% redefinition of \csa{contentsline}. Its \csa{tof at finish} then does a global
+% restore of \csa{contentsline}, but it will be to the \etoc set
+% value. \csa{tof at finish} is active only if either the table of contents was
+% typeset using \csa{tableof}, \csa{tablenotof}, \csa{tableoftaggedcontents}, or
+% \csa{nextocwithtags} was used. If not active it is either undefined (no
% package \ctanpkg{tableof}) or |\@empty|. Prior to \ctanpkg{tableof} |1.4c|, the
-% |\tof at finish| closed a group and could be undefined as well, but not if
-% |\etocglobaldefstrue|.
+% \csa{tof at finish} closed a group and could be undefined as well, but not if
+% \csa{etocglobaldefstrue}.
%
-% \etoc |1.09c| tested here only equality to |\@empty| to decide if it is
-% needed to globally restore |\contentsline| but this meant the global restore
-% was done systematically in case of absence of package \ctanpkg{tableof}.
-%
-% If rather than |\@empty| the |\tof at finish| fall-back was |\relax| we could
-% use here |\@ifundefined| to check in one go (matters of speaking because
-% expansion of |\@ifundefined| is not in "one-go"). Maybe I should update
+% If rather than |\@empty| the \csa{tof at finish} fall-back was |\relax| we could
+% use here \csa{@ifundefined} to check in one go (matters of speaking because
+% expansion of \csa{@ifundefined} is not in "one-go"). Maybe I should update
% \ctanpkg{tableof}, but for time being I will simply add an extra test. All this is
% probably lots of time on irrelevant issue.
% \begin{macrocode}
@@ -9269,13 +8869,6 @@
\@gobble\etoc@
}% end of \Etoc at tableofcontents definition by \etocsettocstyle
}
-% \end{macrocode}
-% |1.08| hacks the begin parts to update therein the \csbc{ifEtoc at isfirst} flag
-% (|2015/03/09|).
-%
-% |1.08c| removes unneeded |\long| from the |\def|'s inside \csbc{etoc at setstyle}
-% (|2015/03/29|).
-% \begin{macrocode}
\def\etocsetstyle{\Etoc at standardfalse\etoc at setstyle}
\long\def\etoc at setstyle#1#2#3#4#5{%
\expandafter\def
@@ -9329,29 +8922,24 @@
% \ctanpkg{babel} and \ctanpkg{babel-french}, because \csa{frenchpartname} does things depending on
% the current value of the counter |part|. The code in recent \ctanpkg{babel-french} (but
% not yet |v2.5a| when \csbc{etocpartname} was introduced) constructs control
-% sequences |\ordinali|, etc... If the part counter is zero, this gives
-% |\ordinal|. Usually this is not defined, hence no error happens (as it is
+% sequences \csa{ordinali}, etc... If the part counter is zero, this gives
+% \csa{ordinal}. Usually this is not defined, hence no error happens (as it is
% constructed via |\csname|), but under class \ctanpkg{memoir} the bug showed up. All
% this to explain that I found out about this long lasting problem only on
% |2015/03/14|. Probably a sign that \etoc's own line styles are rarely
% used...
% \begin{macrocode}
-\def\etocpartname {Part}% modified 1.08b
+\def\etocpartname {Part}
\def\etocbookname {Book}
% \end{macrocode}
-% placeholder for comments
% The macro \csbc{etocdefaultlines} was initially called \csbc{etoctoclines}. Now
% \csbc{etoctoclines} just does \csa{Etoc at standardfalse}.
-% Version |1.07e| has rewritten entirely the stuff related to penalties and
-% \csa{addvspace}, as this was not satisfactory in the earlier versions, which
-% were written at a early stage in the development of the
-% package. Actually I am not fully satisfied with these line styles.
%
% Version |1.09f| wraps \csbc{etocbookname}, respectively
% \csbc{etocpartname}, in the book, resp. part, line styles inside a
% (potential) hyperlink together with the number.
% \begin{macrocode}
-\def\etocdefaultlines{\Etoc at standardfalse %
+\def\etocdefaultlines{\Etoc at standardfalse
%% `book':
\etoc at setstyle{@minustwo}
{\addpenalty\@M\etocskipfirstprefix}
@@ -9424,7 +9012,7 @@
\vbox{\etocname~%
\leaders\box\z@\hfil\box\tw@
\baselineskip\etocbaselinespreadone\baselineskip
- \par}% 1.08b adds the % here
+ \par}%
\else
\vbox{\etocname~%
\leaders\copy\z@\hfil\break
@@ -9486,7 +9074,7 @@
% \begin{macrocode}
\etoc at setstyle{@four}{}{}{}{}%
\etoc at setstyle{@five}{}{}{}{}%
-} % end of \etocdefaultlines!
+}
% \end{macrocode}
% The \csbc{etocinnertopsep} default value is too big as well as \csbc{etocbelowtocskip}
% and \csbc{etocabovetocskip}, I guess, but if I am remember correctly I chose them
@@ -9500,14 +9088,6 @@
\def\etocmulticoltolerance{200}
\def\etocdefaultnbcol{2}
\def\etocinnertopsep{2ex}
-% \end{macrocode}
-% |1.07i| adds a |\nobreak| before the \csbc{etocinnertopsep} and a test of vertical
-% mode to see if truly adding a |\par| is a reasonable idea, in the
-% case of single-column mode.
-%
-% |1.08b| revisits this old code written perhaps at a time I didn't know about
-% |\expandafter| !
-% \begin{macrocode}
\newcommand\etocmulticolstyle[2][\etocdefaultnbcol]{%
\etocsettocstyle
{\let\etocoldpar\par
@@ -9550,8 +9130,7 @@
\def\etocleftrulecolorcmd{\relax}
\def\etocrightrulecolorcmd{\relax}
% \end{macrocode}
-% |1.07i| moves the |\nobreak| to before the |\vskip\etocinnertopsep|
-% (especially important for the single column case).
+% placeholder
% \begin{macrocode}
\def\etoc at ruledheading #1{%
\hb at xt@\linewidth{\color at begingroup
@@ -9581,12 +9160,7 @@
{\end{multicols}}%
\addvspace{\etocbelowtocskip}}}
% \end{macrocode}
-% |1.07k| defines \csbc{Etoc at relax} and \csbc{etocbkgcolorcmd} as |\long|: the user
-% manual says to use |\renewcommand\etocbkgcolorcmd|, and an |\ifx| test is used
-% in the framed style. It was thus a bug to have non-long definitions before. Or
-% I could have said in the user manual to use |\renewcommand*|, or in
-% \csbc{etocframedstyle} I should test for the two, or I should pause to try to
-% remember about this code and think about it.
+% placeholder
% \begin{macrocode}
\def\etocframedmphook{\relax}
\long\def\etocbkgcolorcmd{\relax}
@@ -9806,7 +9380,9 @@
{\ensureonecol \par \begingroup \phantomsection
\ifx\Etoc at aftertitlehook\@empty
\else
- % non-starred variant
+% \end{macrocode}
+% non-starred variant
+% \begin{macrocode}
\ifmem at em@starred at listof
\else
\Etoc at addsuitablecontentsline
@@ -9828,7 +9404,7 @@
{\@nameuse {cfttocafterlisthook}\endgroup\restorefromonecol}}
% \end{macrocode}
% |1.09c| (|2020/05/15|) does an update as \ctanpkg{KOMA-script} has deprecated
-% |\iftocfeature|. Thanks to Bilel Omrani for report. I did not check
+% \csa{iftocfeature}. Thanks to Bilel Omrani for report. I did not check
% if cloning of KOMA code required some further updates.
%
% Finally |1.09f| added some such updates.
@@ -9841,9 +9417,6 @@
\def\etocscrartclstyle{%
\etocsettocstyle
{\let\if at dynlist\if at tocleft
-% \end{macrocode}
-% Added at |1.07m 2015/01/23|.
-% \begin{macrocode}
\def\@currext{toc}%
% \end{macrocode}
% |1.09f| adds this \csa{list at fname} definition hunk although
@@ -9858,10 +9431,6 @@
{}
{\if at twocolumn \aftergroup \twocolumn \onecolumn \fi }}
{}%
-% \end{macrocode}
-% |1.07k|: next line to do as within current |scrartcl 2013/12/19 v3.12|
-% KOMA-Script article class.^^A motivated \par in the env/macrocode/before hook
-% \begin{macrocode}
\etoc at Iftocfeature {toc}{numberline}{\def \nonumberline {\numberline {}}}{}%
\expandafter\tocbasic at listhead\expandafter {\list at fname}%
\begingroup \expandafter \expandafter \expandafter
@@ -9964,10 +9533,6 @@
{\renewcommand*\etocfontone{\normalfont\normalsize}
\renewcommand*\etocstandarddisplaystyle{\etocscrreprtstyle}
\Etoc at redefetocstyle{chapter}}{}
-% \end{macrocode}
-%|1.07k (2014/03/06)| adds the |appendix| to the list of known levels if class
-%\ctanpkg{memoir} is detected.
-% \begin{macrocode}
\@ifclassloaded{memoir}
{\etocsetlevel{appendix}{0}%
\renewcommand*\etocfontone{\normalfont\normalsize}
@@ -9974,15 +9539,6 @@
\etocmemoirtoctotocfmt{chapter}{\contentsname}%
\renewcommand*\etocstandarddisplaystyle{\etocmemoirstyle}
\Etoc at redefetocstyle{chapter}}{}
-% \end{macrocode}
-%|1.07k (2014/03/06)| adds the compatibility with the \ctanpkg{tocloft} package; in
-% compatibility mode etoc will obey the \ctanpkg{tocloft} customisation for the division
-% headings as well as for the toc title.
-%
-%|1.07l (2014/04/02)| fixes the bug from the \ctanpkg{tocloft} compatibility layer which
-%was \ctanpkg{memoir} incompatible: \ctanpkg{memoir} has its version of \ctanpkg{tocloft} which doesn't
-%have the |\if at cftnctoc| boolean.
-% \begin{macrocode}
\def\etoctocloftstyle {%
\etocsettocstyle
{\@cfttocstart\par\begingroup
@@ -10012,18 +9568,18 @@
}%
}
% \end{macrocode}
-% \LaTeX\ 2021 fall release lets |\contentsline| always grab four arguments,
-% so with |1.09e 2021/09/23| we make sure our |\addtocontents| will always
-% provide |\contentsline| with four arguments. This extra |{}| is done
+% \LaTeX\ 2021 fall release lets \csa{contentsline} always grab four arguments,
+% so with |1.09e 2021/09/23| we make sure our \csa{addtocontents} will always
+% provide \csa{contentsline} with four arguments. This extra |{}| is done
% without checking LaTeX's version by laziness, as an impact on documents
% compiled with former LaTeX could be visible only with very special contexts
% that only the author himself would ever consider.
%
-% Let's also add |\protected at file@percent| at |1.09e| although this is a
+% Let's also add \csa{protected at file@percent} at |1.09e| although this is a
% priori of no relevance as \etoc reads the toc file with |\endlinechar=-1|
% regime.
%
-% When using |\addcontentsline| nothing needs to be done as both things are
+% When using \csa{addcontentsline} nothing needs to be done as both things are
% handled by \LaTeX\ upstream.
% \begin{macrocode}
\def\Etoc at addtocontents #1#2%
@@ -10044,9 +9600,6 @@
}
\DeclareRobustCommand*{\etoctoccontentsline}
{\@ifstar{\Etoc at addcontentsline@}{\Etoc at addtocontents}}
-% \end{macrocode}
-% |1.09f| adds \csbc{etocimmediatetoccontentsline}.
-% \begin{macrocode}
\def\Etoc at addtocontents@immediately#1#2{%
\begingroup
\let\Etoc at originalwrite\write
@@ -10064,32 +9617,7 @@
\DeclareRobustCommand*{\etocimmediatetoccontentsline}
{\@ifstar{\Etoc at addcontentsline@@immediately}{\Etoc at addtocontents@immediately}}
% \end{macrocode}
-% All the following added for version |1.07g [2013/10/13]|. Motivated by
-% a demand about |tovsec2|. But it is impossible to make \ctanpkg{tocvsec2}
-% compatible, if not re-doing all `toc' macros in \ctanpkg{tocvsec2}
-% (|1.3, 2011/08/07|). I do not retain the stack idea, which does not convince
-% me as useful. The empty line in the |.toc| file is put there by
-% \ctanpkg{tocvsec2} (see its code line 143).
-%
-% I take this opportunity to add to the start of the toc file
-% |\let\etoc at startlocaltoc\@gobble| in case \etoc is not detected, I should
-% possibly have done that long ago (like I did in \ctanpkg{tableof}).
-%
-% In |1.07h| I decide that I should not have used |\Etoc@| but |\etoc@| for
-% \csa{Etoc at settocdepth}. So I now use lowercase and add a temporary line for
-% transition in the very improbable situation that someone actually did already
-% use the just released |1.07g|.
-%
-% In |1.07i| the deactivation of \csbc{etoc at settocdepth} done at the start
-% of the |.toc| file (for the case this file is used after having
-% removed \etoc from the document, or imported in another document) is
-% done via letting it to |\@gobble| rather than |\count@| (which would
-% not be ok, as what follows would be undefined too). The reason for the
-% |\count@| also used originally in \csbc{etocignoretoctocdepth} is that
-% when I first worked on |1.07g| I possibly had more than one token
-% after \csbc{etoc at settocdepth}, but I changed that later.
-%
-% |1.09| renames \csa{Etoc at resettocdepth} to \csbc{Etoc at restoretocdepth}.
+% placeholder
% \begin{macrocode}
\def\Etoc at storetocdepth {\global\c at etoc@tocdepth\c at tocdepth }
\def\Etoc at restoretocdepth {\global\c at tocdepth\c at etoc@tocdepth }
@@ -10117,7 +9645,7 @@
{\protect\etoc at settocdepth\expandafter\protect\csname Etoc@#1@@\endcsname}}%
}
% \end{macrocode}
-% |1.09f| adds \csbc{etocimmediatesettocdepth.toc}.
+% placeholder
% \begin{macrocode}
\def\etocimmediatesettocdepth #1#{\Etoc at set@toctocdepth at immediately}
\def\Etoc at set@toctocdepth at immediately #1{%
@@ -10134,16 +9662,9 @@
}%
}
% \end{macrocode}
-% |1.07h| adds the depth tags, and an even more general mechanism could be added
-% at some point: we could insert `action' tags and have the user map them to
-% arbitrary commands. For the time being we just provide
-% \csbc{etocdepthtag.toc}\marg{name} and \csbc{etocsettagdepth}\marg{tag\_name}\marg{level} where
-% level is numeric or
-% alphabetical. The numeric
-% level |-3| is now again not accepted by \csbc{etocsetlevel}, it can be used with
-% \csbc{etocsettagdepth} (which accepts equivalently |none|).
+% placeholder
% \begin{macrocode}
-\def\etocdepthtag #1#{\Etoc at depthtag } % \etocdepthtag.toc {name}
+\def\etocdepthtag #1#{\Etoc at depthtag }
\def\Etoc at depthtag #1{\addtocontents {toc}{\protect\etoc at depthtag {#1}}}
% \end{macrocode}
% |1.09f| adds \csbc{etocimmediatedepthtag.toc}. This can serve in some
@@ -10173,9 +9694,7 @@
% \end{macrocode}
% We must cancel all \ctanpkg{tocvsec2} toc-related actions. But a check must be done
% for the memoir class, as its \ctanpkg{tocvsec2} emulation does not have the
-% incompatible things etoc needs to revert. This extra check added with etoc
-% |1.07l|. Release |1.08g| modifies the info message under class memoir (and
-% downgrades it from warning to info).
+% incompatible things etoc needs to revert.
% \begin{macrocode}
\def\Etoc at tocvsec@err #1{\PackageError {etoc}
{the command \protect#1\space is incompatible with etoc}
@@ -10196,8 +9715,11 @@
\def\resettocdepth {\@ifstar {\Etoc at tocvsec@err \resettocdepth }%
{\Etoc at tocvsec@err \resettocdepth }%
}%
- \def\save at tocdepth #1#2#3{}% % if etoc is added to file previously
- \let\reset at tocdepth\relax % using tocvsec2
+% \end{macrocode}
+% If \etoc is added to a \LaTeX{} document using already \ctanpkg{tocvsec2}.
+% \begin{macrocode}
+ \def\save at tocdepth #1#2#3{}%
+ \let\reset at tocdepth\relax
\let\remax at tocdepth\relax
\let\tableofcontents\etoctableofcontents
\PackageWarning {etoc}
@@ -10208,22 +9730,7 @@
}%
}%
% \end{macrocode}
-% |1.07g|. Initial version of \csbc{etocsetnexttocdepth}.
-%
-% |1.08h|: avoid after-effect of consecutive uses of \csbc{etocsetnexttocdepth}
-% with no intervening TOC, due to the fact that the command did an immediate
-% modification of the |tocdepth counter|. This is now delayed until
-% the actual TOC typesetting.
-%
-% |1.09|: slight refactoring of \csbc{etocsetnexttocdepth} to let it be usable
-% from first argument of \csbc{etocsettocstyle} although it is even simpler to
-% use \csbc{etocsettocdepth} there, because the setting is automatically undone
-% at end of TOC.
-%
-% Recall that etoc allows to change all numeric
-% levels assigned to sectioning names, and the one used by
-% \csbc{etocsetnexttocdepth} is determined at time of next toc only, when
-% \csbc{Etoc at tocdepthset} will expand.
+% placeholder
% \begin{macrocode}
\def\invisibletableofcontents {\etocsetnexttocdepth {-3}\tableofcontents }%
\def\invisiblelocaltableofcontents
@@ -10245,13 +9752,8 @@
\global\let\Etoc at tocdepthset\@empty
}%
}%
-\let\Etoc at tocdepthreset\@empty % new 1.08h functioning of \etocsetnexttocdepth
-\let\Etoc at tocdepthset \@empty %
-% \end{macrocode}
-% |1.08k|. Serves to make local TOCs even after headings which were not added
-% to the |.toc| file; but of course the local TOCs can only display
-% sub-headings which made their way into the |.toc| file...
-% \begin{macrocode}
+\let\Etoc at tocdepthreset\@empty
+\let\Etoc at tocdepthset \@empty
\def\etocsetlocaltop #1#{\Etoc at set@localtop}%
\def\Etoc at set@localtop #1{%
\@ifundefined{Etoc@#1@@}%
@@ -10261,7 +9763,7 @@
{\protect\etoc at setlocaltop\expandafter\protect\csname Etoc@#1@@\endcsname}}%
}%
% \end{macrocode}
-% |1.09f| adds \csbc{etocimmediatesetlocaltop.toc}.
+% placeholder
% \begin{macrocode}
\def\etocimmediatesetlocaltop #1#{\Etoc at set@localtop at immediately}%
\def\Etoc at set@localtop at immediately #1{%
@@ -10346,11 +9848,6 @@
}%
\def\Etoc at setlocaltop@doends at dobegins
{\Etoc at doends\Etoc at dobegins\global\Etoc at skipprefixfalse}%
-% \end{macrocode}
-% \begin{macrocode}
-% |1.07h|. In order for the |.toc| file to be usable without error even
-% without etoc. In |1.07i| use of |\@gobble| for \csbc{etoc at settocdepth}.
-% \begin{macrocode}
\addtocontents {toc}{\protect\@ifundefined{etoctocstyle}%
{\let\protect\etoc at startlocaltoc\protect\@gobble
\let\protect\etoc at settocdepth\protect\@gobble
@@ -10366,11 +9863,11 @@
\etocstandarddisplaystyle
\etocobeytoctocdepth
\etocobeydepthtags
-\let\etocaftertochook \@empty % public for end user.
-\let\etocbeforetitlehook \@empty % new with 1.07m
+\let\etocaftertochook \@empty
+\let\etocbeforetitlehook \@empty
% \end{macrocode}
-% |listings| abuses |\tableofcontents| for its |\lstlistoflistings|. It
-% doesn't seem worth to let my version of |\tableofcontents| have to check for
+% |listings| abuses \csa{tableofcontents} for its \csa{lstlistoflistings}. It
+% doesn't seem worth to let my version of \csbc{tableofcontents} have to check for
% this special circumstance. So at |1.09d|, simply add this (and induced
% annoying updates to documentation at at least two locations):
% \begin{macrocode}
Modified: trunk/Master/texmf-dist/tex/latex/etoc/etoc.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/etoc/etoc.sty 2023-01-15 20:54:58 UTC (rev 65549)
+++ trunk/Master/texmf-dist/tex/latex/etoc/etoc.sty 2023-01-15 20:55:22 UTC (rev 65550)
@@ -22,13 +22,13 @@
%% in the same archive or directory.)
%%
%% Package: etoc
-%% Version: 1.09i
+%% Version: 1.1a
%% License: LPPL 1.3c
-%% Copyright (C) 2012-2022 Jean-Francois Burnol
+%% Copyright (C) 2012-2023 Jean-Francois Burnol
%% <jfbu at free dot fr>
-\NeedsTeXFormat{LaTeX2e}
+\NeedsTeXFormat{LaTeX2e}[2020/10/01]
\ProvidesPackage{etoc}
-[2022/11/21 v1.09i Completely customisable TOCs (JFB)]
+[2023/01/14 v1.1a Completely customisable TOCs (JFB)]
\RequirePackage{multicol}
\DeclareOption*{\PackageWarning{etoc}{Option `\CurrentOption' is unknown.}}
\ProcessOptions\relax
@@ -36,8 +36,8 @@
\def\Etoc at par{\par}
\def\etocinline{\def\Etoc at par{}}
\let\etocnopar\etocinline
-\def\etocdisplay{\def\Etoc at par{\par}}% 1.07m 2015/01/23
-\let\Etoc at global\@empty % 1.08 2015/03/10
+\def\etocdisplay{\def\Etoc at par{\par}}
+\let\Etoc at global\@empty
\def\etocglobaldefs{\let\Etoc at global\global\let\tof at global\global}
\def\etoclocaldefs {\let\Etoc at global\@empty\let\tof at global\@empty}
\newif\ifEtoc at jj % book
@@ -50,26 +50,26 @@
\newif\ifEtoc at v % subparagraph
\newif\ifEtoc at number
\newif\ifEtoc at hyperref
-\newif\ifEtoc at parskip % 1.07d
+\newif\ifEtoc at parskip
\newif\ifEtoc at tocwithid
\newif\ifEtoc at standard
-\newif\ifEtoc at skipprefix % 1.08
-\newif\ifEtoc at isfirst % 1.08
+\newif\ifEtoc at skipprefix
+\newif\ifEtoc at isfirst
\newif\ifEtoc at localtoc
\newif\ifEtoc at skipthisone
\newif\ifEtoc at stoptoc
\newif\ifEtoc at notactive
\newif\ifEtoc at mustclosegroup
-\newif\ifEtoc at emptytoc % 1.08e
-\newif\ifEtoc at checksemptiness % 1.08e. Default is 'no checks'.
+\newif\ifEtoc at emptytoc
+\newif\ifEtoc at checksemptiness
\def\etocchecksemptiness {\Etoc at checksemptinesstrue }
-\def\etocdoesnotcheckemptiness {\Etoc at checksemptinessfalse }% 1.08i
-\newif\ifEtoc at notocifnotoc % 1.08e
+\def\etocdoesnotcheckemptiness {\Etoc at checksemptinessfalse }
+\newif\ifEtoc at notocifnotoc
\def\etocnotocifnotoc {\Etoc at checksemptinesstrue\Etoc at notocifnotoctrue }
\def\etoc@{\etoc@}
-\newif\ifEtoc at bracedname % 1.08p
+\newif\ifEtoc at bracedname
\newcounter{etoc at tocid}
-\newcounter{etoc at tocdepth}% 1.07g
+\newcounter{etoc at tocdepth}
\@ifclassloaded{memoir}{\def\Etoc at minf{-\thr@@}}{\def\Etoc at minf{-\tw@}}
\def\Etoc@@minustwo@@{-\tw@}
\let\Etoc@@minusone@@\m at ne
@@ -152,65 +152,7 @@
\etocsetlevel{subparagraph}{5}
\AtBeginDocument{%
\@ifpackageloaded{parskip}{\Etoc at parskiptrue}{}%
-\@ifpackageloaded{hyperref}{%
- \Etoc at hyperreftrue
- \@ifpackagelater{hyperref}{2022/11/13}%
- {%
- \def\Etoc at getthepage {%
- \ifx\Hy at toclinkstart\Etoc at getthepage@token
- \expandafter\expandafter\expandafter\Etoc at getthepage@hyp
- \else
- \expandafter\Etoc at getthepage@nohyp
- \fi}%
- \def\Etoc at getnb@a {%
- \ifx\Hy at toclinkstart\Etoc at getnb@token
- \expandafter\expandafter\expandafter\Etoc at getnb@hyp
- \else
- \expandafter\Etoc at getnb@nohyp
- \fi}%
- \def\Etoc at getit {%
- \ifx\Hy at toclinkstart\Etoc at getit@token
- \expandafter\expandafter\expandafter\Etoc at getit@hyp
- \else
- \expandafter\Etoc at getit@nohyp
- \fi}%
- }%
- {%
- \def\Etoc at getthepage {%
- \ifx\hyper at linkstart\Etoc at getthepage@token
- \expandafter\Etoc at getthepage@hyp
- \else
- \expandafter\Etoc at getthepage@nohyp
- \fi}%
- \def\Etoc at getnb@a {%
- \ifx\hyper at linkstart\Etoc at getnb@token
- \expandafter\Etoc at getnb@hyp
- \else
- \expandafter\Etoc at getnb@nohyp
- \fi}%
- \def\Etoc at getit {%
- \ifx\hyper at linkstart\Etoc at getit@token
- \expandafter\Etoc at getit@hyp
- \else
- \expandafter\Etoc at getit@nohyp
- \fi}%
- }%
- \def\Etoc at et@hop#1#2#3#4#5{#2{#3}{#4}{#5}#1}%
- \let\Etoc at gobblefourorthree\@gobblefour
- }%
- {%
- \let\Etoc at getthepage\Etoc at getthepage@nohyp
- \let\Etoc at getnb@a\Etoc at getnb@nohyp
- \let\Etoc at getit \Etoc at getit@nohyp
- \def\Etoc at et@hop#1#2#3#4{#2{#3}{#4}#1}%
- \long\def\Etoc at gobblefourorthree#1#2#3{}%
- }%
-\@ifl at t@r\fmtversion{2020/10/01}%
- {%
- \def\Etoc at et@hop#1#2#3#4#5{#2{#3}{#4}{#5}#1}%
- \let\Etoc at gobblefourorthree\@gobblefour
- }%
- {}%
+\@ifpackageloaded{hyperref}{\Etoc at hyperreftrue}{}%
}
\def\Etoc at setflags {%
\ifcase \Etoc at level
@@ -360,7 +302,7 @@
\fi
\fi
\fi
- \let\Etoc at next\Etoc at gobblefourorthree
+ \let\Etoc at next\@gobblefour
\ifEtoc at skipthisone
\else
\unless\ifnum\c at tocdepth<\Etoc at level
@@ -373,9 +315,9 @@
\fi
\Etoc at next{#1}%
}
-\def\Etoc at etoccontentsline@ #1{%
- \Etoc at doends % separated since 1.08
- \Etoc at dobegins % separated since 1.08k. Does \Etoc at setflags.
+\def\Etoc at etoccontentsline@ #1#2#3#4{%
+ \Etoc at doends
+ \Etoc at dobegins
\Etoc at global\edef\Etoc at prefix {\expandafter\noexpand
\csname Etoc at prefix@\csname Etoc@#1@\endcsname\endcsname }%
\Etoc at global\edef\Etoc at contents{\expandafter\noexpand
@@ -382,38 +324,80 @@
\csname Etoc at contents@\csname Etoc@#1@\endcsname\endcsname }%
\ifEtoc at skipprefix \Etoc at global\let\Etoc at prefix\@empty\fi
\global\Etoc at skipprefixfalse
- \Etoc at et@hop{\Etoc at prefix\Etoc at contents}{\Etoc at savedcontentsline{#1}}%
+ \Etoc at lxyz{#2}{#3}{#4}%
+ \Etoc at prefix\Etoc at contents
}
-\def\Etoc at lxyz #1#2{%
- \Etoc at global\let\etocthelink\@firstofone % fall-back, was let \@empty up to 1.08i (inc.)
- \Etoc at global\def\etocthename {#1}% (if linked, will be removed later)
- \Etoc at global\def\etocthelinkedname {#1}% (probably redefined later)
- \futurelet\Etoc at getthepage@token
- \Etoc at getthepage #2\etoc@ % defines \etocthelinkedpage
+\def\Etoc at lxyz #1#2#3{%
+ \ifEtoc at hyperref
+ \Etoc at global\def\etocthelink##1{\hyperlink{#3}{##1}}%
+ \else
+ \Etoc at global\let\etocthelink\@firstofone
+ \fi
+ \Etoc at global\def\etocthepage {#2}%
+ \ifEtoc at hyperref
+ \ifx\etocthepage\ltx at empty
+ \Etoc at global\let\etocthelinkedpage\etocthepage
+ \else
+ \Etoc at global\def\etocthelinkedpage{\hyperlink {#3}{#2}}%
+ \fi
+ \else
+ \Etoc at global\let\etocthelinkedpage\etocthepage
+ \fi
+ \Etoc at global\def\etocthename{#1}%
+ \ifEtoc at hyperref
+ \Etoc at global\def\etocthelinkedname{\hyperlink{#3}{#1}}%
+ \else
+ \Etoc at global\let\etocthelinkedname\etocthename
+ \fi
\futurelet\Etoc at getnb@token
- \Etoc@@getnb #1\relax\relax\etoc@ % sets number, name, and \etocthelink
+ \Etoc@@getnb #1\relax\relax\etoc@
\ifEtoc at number
\else
\ifnum\Etoc at level=\m at ne
\futurelet\Etoc at getit@token
- \Etoc@@getit #1\hspace\relax\etoc@ % additional job for parts
+ \Etoc@@getit #1\hspace\relax\etoc@
\fi
\fi
+ \ifEtoc at number
+ \ifEtoc at hyperref
+ \def\Etoc at tmp##1##2{\Etoc at global\def##2{\hyperlink{#3}{##1}}}%
+ \expandafter\Etoc at tmp\expandafter{\etocthename}\etocthelinkedname
+ \expandafter\Etoc at tmp\expandafter{\etocthenumber}\etocthelinkednumber
+ \else
+ \Etoc at global\let\etocthelinkedname\etocthename
+ \Etoc at global\let\etocthelinkednumber\etocthenumber
+ \fi
+ \else
+ \Etoc at global\let\etocthenumber\@empty
+ \Etoc at global\let\etocthelinkednumber\@empty
+ \fi
\Etoc at global\expandafter\let\csname etoclink \endcsname\etocthelink
- \Etoc at global\expandafter\let\csname etocname \endcsname\etocthelinkedname
- \Etoc at global\expandafter\let\csname etocnumber \endcsname\etocthelinkednumber
- \Etoc at global\expandafter\let\csname etocpage \endcsname\etocthelinkedpage
- }
-\def\Etoc at getthepage@nohyp #1\etoc@ {%
- \Etoc at global\def\etocthepage {#1}%
- \Etoc at global\def\etocthelinkedpage {#1}%
+ \Etoc at global\expandafter\let\csname etocname \endcsname\etocthename
+ \Etoc at global\expandafter\let\csname etocnumber \endcsname\etocthenumber
+ \Etoc at global\expandafter\let\csname etocpage \endcsname\etocthepage
+ \ifEtoc at hyperref
+ \Etoc at lxyz@hyper
+ \fi
}
-\def\Etoc at getthepage@hyp #1#2#3#4#5\etoc@ {%
- \Etoc at global\def\etocthepage {#4}%
- \edef\Etoc at tmp {{#3}}%
- \Etoc at global\expandafter\def\expandafter\etocthelinkedpage\expandafter
- {\expandafter\hyperlink \Etoc at tmp{#4}}%
- \Etoc at global\edef\etocthelink##1{\noexpand\hyperlink\Etoc at tmp{##1}}%
+\def\Etoc at lxyz@hyper{%
+ \ifcase\Hy at linktoc
+ % none: nothing to do
+ \or % section (aka name for etoc): link name and number
+ \Etoc at global\expandafter\let\csname etocname \endcsname\etocthelinkedname
+ \Etoc at 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 at empty
+ \else
+ \Etoc at global\expandafter\let\csname etocpage \endcsname\etocthelinkedpage
+ \fi
+ \else % all
+ \Etoc at global\expandafter\let\csname etocname \endcsname\etocthelinkedname
+ \Etoc at global\expandafter\let\csname etocnumber \endcsname\etocthelinkednumber
+ \ifx\etocthepage\ltx at empty
+ \else
+ \Etoc at global\expandafter\let\csname etocpage \endcsname\etocthelinkedpage
+ \fi
+ \fi
}
\def\Etoc@@getnb {%
\Etoc at bracednamefalse
@@ -440,7 +424,7 @@
\ifx\Etoc at getnb@token\bgroup
\expandafter\Etoc at getnb@nohyp at nonbr
\else
- \expandafter\Etoc at getnb@a
+ \expandafter\Etoc at getnb@nohyp
\fi
}
\def\Etoc at getnb@nohyp #1{%
@@ -488,72 +472,15 @@
\fi
\Etoc at global\let\etocthelinkedname \etocthename
}
-\def\Etoc at getnb@hyp #1#2#3#4#5\etoc@ {%
- \edef\Etoc at tmp {{#3}}%
- \Etoc at global\edef\etocthelink ##1{\noexpand\hyperlink {#3}{##1}}%
- \Etoc at global\def\etocthename {#4}% temporary definition
- \Etoc at global\expandafter\def\expandafter\etocthelinkedname
- \expandafter {\expandafter\hyperlink \Etoc at tmp{#4}}%
- \futurelet\Etoc at hyp@getnb at token\Etoc at getnb@hyp at a #4\relax\relax\etoc@
-}
-\def\Etoc at getnb@hyp at a {%
- \ifx\Etoc at hyp@getnb at token\bgroup
- \expandafter\Etoc at getnb@nohyp at nonbr
- \else
- \expandafter\Etoc at getnb@hyp at b
- \fi
-}
-\def\Etoc at getnb@hyp at b #1{%
- \in@{#1}{\numberline\chapternumberline\partnumberline\booknumberline}%
- \ifin@
- \let\Etoc at next\Etoc at getnb@hyp at nmbrd
- \else
- \let\Etoc at next\Etoc at getnb@nohyp at nonbr
- \in@{#1}{\nonumberline}%
- \ifin@
- \ifx\nonumberline\empty
- \let\Etoc at next\Etoc at getnb@hyp at nonumberline
- \else
- \def\Etoc at next{\expandafter\Etoc at getnb@hyp at nmbrd}%
- \fi
- \fi
- \fi
- \Etoc at next #1%
-}
-\def\Etoc at getnb@hyp at nmbrd #1#2#3\relax\relax\etoc@ {%
- \Etoc at global\Etoc at numbertrue
- \Etoc at global\def\etocthenumber {#2}%
- \Etoc at global\expandafter\def\expandafter\etocthelinkednumber
- \expandafter{\expandafter\hyperlink \Etoc at tmp{#2}}%
- \Etoc at global\def\etocthename {#3}%
- \Etoc at global\expandafter\def\expandafter\etocthelinkedname
- \expandafter{\expandafter\hyperlink \Etoc at tmp{#3}}%
-}
-\def\Etoc at getnb@hyp at nonumberline #1\relax\relax\etoc@ {%
- \Etoc at global\Etoc at numberfalse
- \Etoc at global\let\etocthenumber \@empty
- \Etoc at global\let\etocthelinkednumber \@empty
- \ifEtoc at bracedname
- \Etoc at global\expandafter\def\expandafter\etocthename
- \expandafter{\expandafter{#1}}%
- \else
- \Etoc at global\expandafter\def\expandafter\etocthename\expandafter{#1}%
- \fi
- \Etoc at global\expandafter\expandafter\expandafter\def
- \expandafter\expandafter\expandafter\etocthelinkedname
- \expandafter\expandafter\expandafter{%
- \expandafter\expandafter\expandafter\hyperlink
- \expandafter\Etoc at tmp\expandafter{\etocthename}}%
-}
\def\Etoc@@getit{%
\ifEtoc at bracedname
\expandafter\expandafter\expandafter\Etoc at getit@nameisbraced
\expandafter\@firstofone
\else
- \expandafter\Etoc at getit
+ \expandafter\Etoc at getit@nohyp
\fi
}
-\def\Etoc at getit@nameisbraced {\futurelet\Etoc at getit@token\Etoc at getit }
+\def\Etoc at getit@nameisbraced {\futurelet\Etoc at getit@token\Etoc at getit@nohyp }
\def\Etoc at getit@nohyp #1\hspace#2#3\etoc@ {%
\ifx\relax#2%
\else
@@ -571,29 +498,6 @@
\fi
\Etoc at global\let\etocthelinkedname\etocthename
}
-\def\Etoc at getit@hyp #1#2#3#4#5\etoc@ {%
- \edef\Etoc at tmp {{#3}}%
- \Etoc at global\edef\etocthelink ##1{\noexpand\hyperlink \Etoc at tmp{##1}}%
- \Etoc at global\def\etocthename {#4}% temporary definition
- \Etoc at global\expandafter\def\expandafter\etocthelinkedname
- \expandafter{\expandafter\hyperlink \Etoc at tmp{#4}}%
- \Etoc at getit@hyp at a #4\hspace\relax\etoc@
-}
-\def\Etoc at getit@hyp at a #1\hspace#2#3\etoc@ {%
- \ifx\relax#2% not extremely safe
- \else
- \Etoc at global\Etoc at numbertrue
- \Etoc at global\def\etocthenumber {#1}%
- \Etoc at global\expandafter\def\expandafter\etocthelinkednumber
- \expandafter{\expandafter\hyperlink \Etoc at tmp{#1}}%
- \Etoc at getit@hyp at getname #3\etoc@
- \fi
-}
-\def\Etoc at getit@hyp at getname #1\hspace\relax\etoc@ {%
- \Etoc at global\def\etocthename {#1}%
- \Etoc at global\expandafter\def\expandafter\etocthelinkedname
- \expandafter{\expandafter\hyperlink \Etoc at tmp{#1}}%
-}%
\let\etocthename \@empty
\let\etocthenumber \@empty
\let\etocthepage \@empty
@@ -600,7 +504,7 @@
\let\etocthelinkedname \@empty
\let\etocthelinkednumber \@empty
\let\etocthelinkedpage \@empty
-\let\etocthelink \@firstofone % prior to 1.08j its was \let to \@empty
+\let\etocthelink \@firstofone
\DeclareRobustCommand*{\etocname} {}
\DeclareRobustCommand*{\etocnumber}{}
\DeclareRobustCommand*{\etocpage} {}
@@ -738,7 +642,7 @@
\fi
\fi
\fi
- \Etoc at gobblefourorthree\relax
+ \@gobblefour\relax
}
\def\Etoc at testingcontentsline #1{%
\ifEtoc at stoptoc
@@ -751,7 +655,7 @@
\fi
\fi
\fi
- \Etoc at gobblefourorthree\relax
+ \@gobblefour\relax
}
\def\Etoc at localtableofcontents#1{%
\gdef\etoclocaltop{-\@m}%
@@ -759,13 +663,11 @@
\global\Etoc at emptytocfalse
\edef\Etoc at tocid{#1}%
\ifnum\Etoc at tocid<\@ne
- %\PackageWarning{etoc}{Unknown toc reference \@secondoftwo#1. Run LaTeX again}%
\setbox0\hbox{\ref{Unknown toc ref \@secondoftwo#1. Rerun LaTeX}}%
- %\if at filesw\immediate\write\@mainaux{\noexpand\@tempswatrue}\fi
- \global\Etoc at stoptoctrue % do only heading
+ \global\Etoc at stoptoctrue
\gdef\etoclocaltop{-\thr@@}%
\Etoc at tableofcontents
- \expandafter\Etoc at gobbletoetoc@ % skip all the rest
+ \expandafter\Etoc at gobbletoetoc@
\fi
\global\Etoc at notactivetrue
\ifEtoc at checksemptiness
@@ -773,16 +675,12 @@
\fi
\ifEtoc at emptytoc
\ifEtoc at notactive
- %\PackageWarning{etoc}{Unknown toc ID \number\Etoc at tocid. Run LaTeX again}%
\setbox0\hbox{\ref{Unknown toc ID \number\Etoc at tocid. Rerun LaTeX}}%
- %\if at filesw\immediate\write\@mainaux{\noexpand\@tempswatrue}\fi
- \global\Etoc at emptytocfalse % assume real one will be non-empty
- \global\Etoc at stoptoctrue % and print only heading for this pass
+ \global\Etoc at emptytocfalse
+ \global\Etoc at stoptoctrue
\gdef\etoclocaltop{-\thr@@}%
\Etoc at tableofcontents
\expandafter\expandafter\expandafter\Etoc at gobbletoetoc@
- \else
- %% \PackageWarning{etoc}{This toc is apparently empty}%
\fi
\else
\global\Etoc at stoptocfalse
@@ -793,9 +691,9 @@
\fi
\@gobble\etoc@
\endgroup\ifEtoc at mustclosegroup\endgroup\fi
- \Etoc at tocdepthreset % 1.07h, renamed 1.08h
- \etocaftertochook % 1.07g
- \let\Etoc at localtocdepth\c at tocdepth % 1.09
+ \Etoc at tocdepthreset
+ \etocaftertochook
+ \let\Etoc at localtocdepth\c at tocdepth
}% \Etoc at localtableofcontents
\def\Etoc at getrefno #1#2\etoc@ {#1}
\def\Etoc at getref #1{\@ifundefined{r@#1}{0}{\expandafter\expandafter\expandafter
@@ -818,8 +716,8 @@
\fi
\Etoc at tableofcontents
\endgroup\ifEtoc at mustclosegroup\endgroup\fi
- \Etoc at tocdepthreset % 1.07h, renamed 1.08h
- \etocaftertochook % 1.07g
+ \Etoc at tocdepthreset
+ \etocaftertochook
\@gobble\etoc@
}% \Etoc at t@bleofcontents
\def\Etoc at table@fcontents{%
@@ -835,8 +733,8 @@
\let\etocaftercontentshook \@empty
\def\etoctableofcontents{%
\Etoc at openouttoc
- \Etoc at tocdepthset % new with 1.08h (\etocsetnexttocdepth)
- \begingroup % closed in \Etoc at t@bleofcontents or \Etoc at localtableofcontents
+ \Etoc at tocdepthset
+ \begingroup
\@ifstar
{\let\Etoc at aftertitlehook\@empty\Etoc at table@fcontents}
{\def\Etoc at aftertitlehook{\etocaftertitlehook}\Etoc at table@fcontents}%
@@ -845,8 +743,8 @@
\let\tableofcontents\etoctableofcontents
\newcommand*\localtableofcontents{%
\Etoc at openouttoc
- \Etoc at tocdepthset % new with 1.08h (\etocsetnexttocdepth)
- \begingroup % closed in \Etoc at t@bleofcontents or \Etoc at localtableofcontents
+ \Etoc at tocdepthset
+ \begingroup
\@ifstar
{\let\Etoc at aftertitlehook\@empty\Etoc at localtable@fcontents}
{\def\Etoc at aftertitlehook{\etocaftertitlehook}\Etoc at localtable@fcontents}%
@@ -866,27 +764,34 @@
\expandafter\Etoc at gobbletoetoc@
\fi
\Etoc at par
- \etocbeforetitlehook % 1.07m
- \Etoc at storetocdepth % 1.07g
- \let\Etoc at savedcontentsline\contentsline % moved up here 1.08
+ \etocbeforetitlehook
+ \Etoc at storetocdepth
+ \let\Etoc at savedcontentsline\contentsline
\let\contentsline\Etoc at etoccontentsline
\ifEtoc at standard
- \else % moved here from \Etoc at toctoc (1.08)
+ \else
\def\Etoc at levellist@elt####1{%
- \expandafter\let\csname etocsaved####1tocline\expandafter\endcsname
- \csname l@####1\endcsname
- \expandafter\let\csname l@####1\endcsname\Etoc at lxyz}%
+ \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 }%
+ \expandafter\let\csname etocsaved####1tocline\expandafter\endcsname
+ \csname l@####1\endcsname
+ \csname l@####1\endcsname
+ }%
+ }%
\Etoc at levellist
\fi
#1%
\Etoc at tocdepthset
- \ifEtoc at parskip\parskip\z at skip\fi %1.07d
+ \ifEtoc at parskip\parskip\z at skip\fi
\Etoc at aftertitlehook
\gdef\etoclocaltop{-\thr@@}%
\Etoc at toctoc
\etocaftercontentshook
- #2\@nobreakfalse % 1.07d: \@nobreakfalse moved here
- \Etoc at restoretocdepth % 1.07g. moved here from before #2 by 1.08
+ #2\@nobreakfalse
+ \Etoc at restoretocdepth
\ifx\Etoc at global\global
\@ifundefined{tof at finish}
{}
@@ -936,9 +841,9 @@
\def\etoctoclineleaders
{\hbox{\normalfont\normalsize\hb at xt@2ex {\hss.\hss}}}
\def\etocabbrevpagename {p.~}
-\def\etocpartname {Part}% modified 1.08b
+\def\etocpartname {Part}
\def\etocbookname {Book}
-\def\etocdefaultlines{\Etoc at standardfalse %
+\def\etocdefaultlines{\Etoc at standardfalse
%% `book':
\etoc at setstyle{@minustwo}
{\addpenalty\@M\etocskipfirstprefix}
@@ -1011,7 +916,7 @@
\vbox{\etocname~%
\leaders\box\z@\hfil\box\tw@
\baselineskip\etocbaselinespreadone\baselineskip
- \par}% 1.08b adds the % here
+ \par}%
\else
\vbox{\etocname~%
\leaders\copy\z@\hfil\break
@@ -1070,7 +975,7 @@
\addpenalty{-\@highpenalty}}%
\etoc at setstyle{@four}{}{}{}{}%
\etoc at setstyle{@five}{}{}{}{}%
-} % end of \etocdefaultlines!
+}
\def\etocabovetocskip{3.5ex \@plus 1ex \@minus .2ex}
\def\etocbelowtocskip{3.5ex \@plus 1ex \@minus .2ex}
\def\etoccolumnsep{2em}
@@ -1329,7 +1234,6 @@
{\ensureonecol \par \begingroup \phantomsection
\ifx\Etoc at aftertitlehook\@empty
\else
- % non-starred variant
\ifmem at em@starred at listof
\else
\Etoc at addsuitablecontentsline
@@ -1530,7 +1434,7 @@
\endgroup
}%
}
-\def\etocdepthtag #1#{\Etoc at depthtag } % \etocdepthtag.toc {name}
+\def\etocdepthtag #1#{\Etoc at depthtag }
\def\Etoc at depthtag #1{\addtocontents {toc}{\protect\etoc at depthtag {#1}}}
\def\etocimmediatedepthtag #1#{\Etoc at depthtag@immediately }
\def\Etoc at depthtag@immediately #1{%
@@ -1571,8 +1475,8 @@
\def\resettocdepth {\@ifstar {\Etoc at tocvsec@err \resettocdepth }%
{\Etoc at tocvsec@err \resettocdepth }%
}%
- \def\save at tocdepth #1#2#3{}% % if etoc is added to file previously
- \let\reset at tocdepth\relax % using tocvsec2
+ \def\save at tocdepth #1#2#3{}%
+ \let\reset at tocdepth\relax
\let\remax at tocdepth\relax
\let\tableofcontents\etoctableofcontents
\PackageWarning {etoc}
@@ -1602,8 +1506,8 @@
\global\let\Etoc at tocdepthset\@empty
}%
}%
-\let\Etoc at tocdepthreset\@empty % new 1.08h functioning of \etocsetnexttocdepth
-\let\Etoc at tocdepthset \@empty %
+\let\Etoc at tocdepthreset\@empty
+\let\Etoc at tocdepthset \@empty
\def\etocsetlocaltop #1#{\Etoc at set@localtop}%
\def\Etoc at set@localtop #1{%
\@ifundefined{Etoc@#1@@}%
@@ -1674,8 +1578,8 @@
\etocstandarddisplaystyle
\etocobeytoctocdepth
\etocobeydepthtags
-\let\etocaftertochook \@empty % public for end user.
-\let\etocbeforetitlehook \@empty % new with 1.07m
+\let\etocaftertochook \@empty
+\let\etocbeforetitlehook \@empty
\def\etockeeporiginaltableofcontents
{\let\tableofcontents\etocoriginaltableofcontents}%
\endinput
More information about the tex-live-commits
mailing list.