texlive[46735] Master/texmf-dist: etoc (24feb18)

commits+karl at tug.org commits+karl at tug.org
Sat Feb 24 23:56:01 CET 2018


Revision: 46735
          http://tug.org/svn/texlive?view=revision&revision=46735
Author:   karl
Date:     2018-02-24 23:56:01 +0100 (Sat, 24 Feb 2018)
Log Message:
-----------
etoc (24feb18)

Modified Paths:
--------------
    trunk/Master/texmf-dist/doc/latex/etoc/README.md
    trunk/Master/texmf-dist/doc/latex/etoc/etoc-DE.pdf
    trunk/Master/texmf-dist/doc/latex/etoc/etoc.pdf
    trunk/Master/texmf-dist/source/latex/etoc/etoc.dtx
    trunk/Master/texmf-dist/source/latex/etoc/etoc.ins
    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	2018-02-24 22:55:48 UTC (rev 46734)
+++ trunk/Master/texmf-dist/doc/latex/etoc/README.md	2018-02-24 22:56:01 UTC (rev 46735)
@@ -1,6 +1,6 @@
 <!-- -->
 
-    Source:  etoc.dtx (v1.08m-2018/02/07)
+    Source:  etoc.dtx (v1.08n-2018/02/23)
     Author:  Jean-Francois Burnol
     Author:  Christine Roemer et al. (German tranlation)
     Info:    Completely customisable TOCs
@@ -116,6 +116,11 @@
 RECENT CHANGES
 ==============
 
+v1.08n \[2018/02/23\]
+---------------------
+
+Refactoring of core macros detecting `\numberline` and its variants.
+
 v1.08m \[2018/02/07\]
 ---------------------
 

Modified: trunk/Master/texmf-dist/doc/latex/etoc/etoc-DE.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/etoc/etoc.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/source/latex/etoc/etoc.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex/etoc/etoc.dtx	2018-02-24 22:55:48 UTC (rev 46734)
+++ trunk/Master/texmf-dist/source/latex/etoc/etoc.dtx	2018-02-24 22:56:01 UTC (rev 46735)
@@ -2,12 +2,12 @@
 % 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: <07-02-2018 at 23:54:39 CET>}%
+\def\etocdtxtimestamp {Time-stamp: <23-02-2018 at 22:07:11 CET>}%
 %</none>
 %<*!readme>
 %%
 %% Package: etoc
-%% Version: 1.08m-2018/02/07
+%% Version: 1.08n-2018/02/23
 %% License: LPPL 1.3c
 %% Copyright (C) 2012-2018 Jean-Francois Burnol
 %%                         <jfbu at free dot fr>
@@ -17,14 +17,14 @@
 %%
 %</!readme>
 %<*insfile>
-\def\etocpkgdate        {2018/02/07}
-\def\etocdocdate        {2018/02/07}
-\def\etocpkgversion     {v1.08m}
+\def\etocpkgdate        {2018/02/23}
+\def\etocdocdate        {2018/02/23}
+\def\etocpkgversion     {v1.08n}
 \def\etocpkgdescription {Completely customisable TOCs (JFB)}
 %</insfile>
 %<*none>
-\def\etocDEpkgdate      {23.10.2017}% METTRE À JOUR À CHAQUE BUMP!
-\def\etocDEdocdate      {23.10.2017}
+\def\etocDEpkgdate      {23.02.2018}% METTRE À JOUR À CHAQUE BUMP!
+\def\etocDEdocdate      {23.02.2018}
 \def\etocDEDEdocdate    {09.04.2015}%
 \def\etocDEDEpkgversion {v1.08d}%
 % Definition of \etocLicense
@@ -35,7 +35,7 @@
     \catcode32=13\catcode`\\=12^^Brelax^^A
 ^^Bfirstofone{^^Bendgroup^^Bdef^^BetocLicense^^A
 {% Package: etoc
-% Version: 1.08m-2018/02/07
+% Version: 1.08n-2018/02/23
 % License: LPPL 1.3c
 % Copyright (C) 2012-2018 Jean-Francois Burnol <jfbu at free dot fr>
 % Copyright (C) 2014-2018 Christine Roemer <Christine_Roemer at t-online dot de>
@@ -69,7 +69,7 @@
 %<*readme>
 <!-- -->
 
-    Source:  etoc.dtx (v1.08m-2018/02/07)
+    Source:  etoc.dtx (v1.08n-2018/02/23)
     Author:  Jean-Francois Burnol
     Author:  Christine Roemer et al. (German tranlation)
     Info:    Completely customisable TOCs
@@ -185,6 +185,11 @@
 RECENT CHANGES
 ==============
 
+v1.08n \[2018/02/23\]
+---------------------
+
+Refactoring of core macros detecting `\numberline` and its variants.
+
 v1.08m \[2018/02/07\]
 ---------------------
 
@@ -10907,8 +10912,12 @@
 
 \begin{multicols}{2}
 \begin{jfverbatim}
-v1.08m [2018/02/07]^
+v1.08n [2018/02/23]^
 
+   Refactoring of core macros detecting \numberline and its variants.
+
+~v1.08m [2018/02/07]^
+
    Fix to 1.08k's introduced incompatibility with KOMA-script
    and tocbasic's \nonumberline.
 
@@ -11984,17 +11993,22 @@
 % \csa{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
 % |\etocglobaldefs|.
+%
+% |1.08n| adds |\futurelet|-based methods to avoid unbracing things.
 %    \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)
-    \Etoc at getthepage #2\etoc@ % defines \etocthelinkedpage
-    \Etoc at getnb #1\relax\relax\etoc@  % sets number, name, and \etocthelink
+    \futurelet\Etoc at getthepage@token
+       \Etoc at getthepage #2\etoc@ % defines \etocthelinkedpage
+    \futurelet\Etoc at getnb@token
+       \Etoc at getnb #1\relax\relax\etoc@  % sets number, name, and \etocthelink
     \ifEtoc at number
     \else
      \ifnum\Etoc at level=\m at ne
-       \Etoc at getit #1\hspace\relax\etoc@   % additional job for parts
+       \futurelet\Etoc at getit@token
+          \Etoc at getit #1\hspace\relax\etoc@   % additional job for parts
      \fi
     \fi
     \Etoc at global\expandafter\let\csname etoclink \endcsname\etocthelink
@@ -12005,16 +12019,18 @@
 %    \end{macrocode}
 % |1.08| adds the |\Etoc at global|'s.
 %
-% |1.08j| fixes old |\ifx #1\hyperlink at start| bug.
+% |1.08j| fixes an old |\ifx #1\hyperlink at start| bug.
+%
+% Potential (but rather exotic) brace removal problems wiped away at |1.08n|.
 %    \begin{macrocode}
-\def\Etoc at getthepage #1{%
-  \let\Etoc at next\Etoc at getthepage@nohyp
-  \ifEtoc at hyperref
-   \ifx\hyper at linkstart#1%
-    \let\Etoc at next\Etoc at getthepage@hyp
-   \fi
-  \fi
-  \Etoc at next #1%
+\def\Etoc at getthepage {%
+    \if1\ifEtoc at hyperref
+        \ifx\hyper at linkstart\Etoc at getthepage@token1\else0\fi
+        \else0\fi
+       \expandafter\Etoc at getthepage@hyp
+    \else
+       \expandafter\Etoc at getthepage@nohyp
+    \fi
 }
 \def\Etoc at getthepage@nohyp #1\etoc@ {%
     \Etoc at global\def\etocthepage       {#1}%
@@ -12036,36 +12052,33 @@
 % which contains the |\Hy at tocdestname| already expanded.
 %    \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}}%
+    \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}}%
 }
 %    \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 braced tokens. As this is rare condition, it had not been
-% reported so far by my single user user-base.
+% 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|.
 %    \begin{macrocode}
-\def\Etoc at getnb #1{%
-  \let\Etoc at next\Etoc at getnb@nohyp
-  \ifEtoc at hyperref
-   \ifx\hyper at linkstart#1%
-    \let\Etoc at next\Etoc at getnb@hyp
-   \fi
-  \fi
-  \Etoc at next #1%
+\def\Etoc at getnb {%
+    \ifx\Etoc at getnb@token\bgroup
+       \expandafter\Etoc at getnb@nohyp at nonbr
+    \else
+       \if1\ifEtoc at hyperref
+            \ifx\hyper at linkstart\Etoc at getnb@token1\else0\fi
+           \else0\fi
+        \expandafter\expandafter\expandafter\Etoc at getnb@hyp
+       \else
+        \expandafter\expandafter\expandafter\Etoc at getnb@nohyp
+       \fi
+    \fi
 }
-\def\Etoc at getit #1{%
-  \let\Etoc at next\Etoc at getit@nohyp
-  \ifEtoc at hyperref
-   \ifx\hyper at linkstart#1%
-    \let\Etoc at next\Etoc at getit@hyp
-   \fi
-  \fi
-  \Etoc at next #1%
-}
 %    \end{macrocode}
 % |1.08| adds the |\Etoc at global|'s.
 %
@@ -12078,28 +12091,44 @@
 %
 % |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
+% |\Etoc at getnb| so here |#1| is guaranteed not braced now.
+%
+% |1.08n| tries to handle reasonably the |\nonumberline| of KOMA-script.
+% If it expands to |\numberline{}|, \etoc will thus consider the line
+% numbered with an empty number.
 %    \begin{macrocode}
-\begingroup\@tfor\x:=NUMBZRLINZ\do{\catcode\expandafter`\x=12 }\lccode`Z `e
-\lowercase{\endgroup
-\long\def\Etoc at oneifnumberline #1NUMBZRLINZ#2#3\Etoc at next#4{%
-   \ifx\etoc@#20\else\ifx\nonumberline#40\else1\fi\fi
-}%
-\def\Etoc at getnb@nohyp #1#2#3\etoc@ {%
-    \def\Etoc at getname ##1\relax\relax\etoc@ {%
-      \Etoc at global\def\etocthename       {##1}%
-      \Etoc at global\def\etocthelinkedname {##1}%
-     }%
-  \if1\expandafter\Etoc at oneifnumberline\string#1NUMBZRLINZ\etoc@\Etoc at next{#1}%
+\def\Etoc at getnb@nohyp #1{%
+    \in@{#1}{\numberline\chapternumberline\partnumberline\booknumberline}%
+    \ifin@
+       \let\Etoc at next\Etoc at getnb@nohyp at nmbrd
+    \else
+       \let\Etoc at next\Etoc at getnb@nohyp at nonbr
+       \in@{#1}{\nonumberline}%
+       \ifin@
+           \ifx\nonumberline\empty\else\let\Etoc at next\Etoc at getnb@nohyp at nmbrd\fi
+           \expandafter\expandafter\expandafter\expandafter
+       \fi
+    \fi
+    \Etoc at next #1%
+}           
+\def\Etoc at getnb@nohyp at nmbrd #1#2#3\relax\relax\etoc@ {%
+    \Etoc at global\Etoc at numbertrue
     \Etoc at global\def\etocthenumber       {#2}%
     \Etoc at global\def\etocthelinkednumber {#2}%
-    \Etoc at global\Etoc at numbertrue
-    \Etoc at getname #3\etoc@
-  \else % \etocthename and \etocthelinkedname already defined
+    \Etoc at global\def\etocthename         {#3}%
+    \Etoc at global\def\etocthelinkedname   {#3}%
+}
+\def\Etoc at getnb@nohyp at nonbr #1\etoc@ {%
+    % \etocthename and \etocthelinkedname already defined in \Etoc at lxyz
+    \Etoc at global\Etoc at numberfalse
     \Etoc at global\let\etocthenumber       \@empty
     \Etoc at global\let\etocthelinkednumber \@empty
-    \Etoc at global\Etoc at numberfalse
-  \fi
-}%
+}
 %    \end{macrocode}
 % |1.07n| replaces use of |\toks@| by macro |\Etoc at tmp|. |1.08| adds
 % the |\Etoc at global|'s.
@@ -12108,51 +12137,75 @@
 %
 % |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|.
 %    \begin{macrocode}
 \def\Etoc at getnb@hyp #1#2#3#4#5#6\etoc@ {%
-         \def\Etoc at getname ##1\relax\relax\etoc@ {%
-         \Etoc at global\def\etocthename {##1}%
-         \edef\Etoc at tmp   {{#3}}%
-         \Etoc at global\expandafter\def\expandafter\etocthelinkedname\expandafter
-                              {\expandafter\hyperlink \Etoc at tmp{##1}}%
-         }%
-         \def\Etoc at getnbr ##1##2##3\etoc@ {%
-          \if1\expandafter\Etoc at oneifnumberline\string##1NUMBZRLINZ\etoc@\Etoc at next{##1}%
-            \Etoc at global\def\etocthenumber {##2}%
-            \edef\Etoc at tmp   {{#3}}%
-            \Etoc at global\expandafter\def\expandafter\etocthelinkednumber
-                        \expandafter{\expandafter\hyperlink \Etoc at tmp{##2}}%
-            \Etoc at global\Etoc at numbertrue
-            \Etoc at getname ##3\etoc@
-          \else
-            \Etoc at global\let\etocthenumber       \@empty
-            \Etoc at global\let\etocthelinkednumber \@empty
-            \Etoc at global\Etoc at numberfalse
-            \Etoc at global\def\etocthename {#4}%
-            \edef\Etoc at tmp   {{#3}}%
-            \Etoc at global\expandafter\def\expandafter\etocthelinkedname
-                        \expandafter {\expandafter\hyperlink \Etoc at tmp{#4}}%
-          \fi
-         }%
-  \Etoc at global\edef\etocthelink ##1{\noexpand\hyperlink {#3}{##1}}%
-  \Etoc at getnbr #4\relax\relax\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 hyp@getnb #4\relax\relax\etoc@
+}
+\def\Etoc at hyp@getnb {%
+    \ifx\Etoc at hyp@getnb at token\bgroup
+       \expandafter\Etoc at hyp@getnb at nonbr
+    \else
+       \expandafter\Etoc at getnb@hyp at a
+    \fi
+}
+\def\Etoc at getnb@hyp at a #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@hyp at nonbr
+       \in@{#1}{\nonumberline}%
+       \ifin@
+           \ifx\nonumberline\empty\else\let\Etoc at next\Etoc at getnb@hyp at nmbrd\fi
+           \expandafter\expandafter\expandafter\expandafter
+       \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}}%
+}
+\let\Etoc at getnb@hyp at nonbr\Etoc at getnb@nohyp at nonbr
 %    \end{macrocode}
 % |1.08| adds the |\Etoc at global|'s.
+%
+% |1.08n| refactors this but it is still not extremely robust.
 %    \begin{macrocode}
+\def\Etoc at getit {%
+    \if1\ifEtoc at hyperref
+        \ifx\hyper at linkstart\Etoc at getit@token1\else0\fi
+        \else0\fi
+       \expandafter\Etoc at getit@hyp
+    \else
+       \expandafter\Etoc at getit@nohyp
+    \fi
+}
 \def\Etoc at getit@nohyp #1\hspace#2#3\etoc@ {%
-    \def\Etoc at getname ##1\hspace\relax\etoc@ {%
-       \Etoc at global\def\etocthename       {##1}%
-       \Etoc at global\def\etocthelinkedname {##1}%
-    }%
-  \ifx\relax#2%
-  \else
-        \Etoc at global\def\etocthenumber       {#1}%
-        \Etoc at global\def\etocthelinkednumber {#1}%
-        \Etoc at global\Etoc at numbertrue
-        \Etoc at getname #3\etoc@
-  \fi
+    \ifx\relax#2%
+    \else
+      \Etoc at global\def\etocthenumber       {#1}%
+      \Etoc at global\def\etocthelinkednumber {#1}%
+      \Etoc at global\Etoc at numbertrue
+      \Etoc at getit@nohyp at getname #3\etoc@
+    \fi
 }
+\def\Etoc at getit@nohyp at getname #1\hspace\relax\etoc@ {%
+    \Etoc at global\def\etocthename       {#1}%
+    \Etoc at global\def\etocthelinkedname {#1}%
+}
 %    \end{macrocode}
 % |1.07n| replaces use of |\toks@| by macro |\Etoc at tmp|. |1.08| adds
 % the |\Etoc at global|'s.
@@ -12164,27 +12217,32 @@
 % |\ifx| bug in |\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.
 %    \begin{macrocode}
 \def\Etoc at getit@hyp #1#2#3#4#5#6\etoc@ {%
-    \def\Etoc 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}}%
-    }%
-    \def\Etoc at getnbr ##1\hspace##2##3\etoc@ {%
-       \ifx\relax##2%
-       \else
-         \Etoc at global\def\etocthenumber {##1}%
-         \Etoc at global\expandafter\def\expandafter\etocthelinkednumber
-                     \expandafter{\expandafter\hyperlink \Etoc at tmp{##1}}%
-         \Etoc at global\Etoc at numbertrue
-         \Etoc at getname ##3\etoc@
-       \fi
-    }%
-  \edef\Etoc at tmp {{#3}}%
-  \Etoc at getnbr #4\hspace\relax\etoc@
-  \Etoc at global\edef\etocthelink ##1{\noexpand\hyperlink\Etoc at tmp{##1}}%
+    \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 hyp@getit #4\hspace\relax\etoc@
 }
+\def\Etoc at hyp@getit #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 |\etocname|
 % etc.. be simply the robust variant of |\etocthelinkedname| etc...
@@ -13674,7 +13732,7 @@
   Grave accent  \`     Left brace    \{     Vertical bar  \|
   Right brace   \}     Tilde         \~}
 
-\CheckSum{3313}%
+\CheckSum{3375}%
 
 \csname check at checksum\endcsname
 \Finale

Modified: trunk/Master/texmf-dist/source/latex/etoc/etoc.ins
===================================================================
--- trunk/Master/texmf-dist/source/latex/etoc/etoc.ins	2018-02-24 22:55:48 UTC (rev 46734)
+++ trunk/Master/texmf-dist/source/latex/etoc/etoc.ins	2018-02-24 22:56:01 UTC (rev 46735)
@@ -1,6 +1,6 @@
 %%
 %% Package: etoc
-%% Version: 1.08m-2018/02/07
+%% Version: 1.08n-2018/02/23
 %% License: LPPL 1.3c
 %% Copyright (C) 2012-2018 Jean-Francois Burnol
 %%                         <jfbu at free dot fr>
@@ -8,9 +8,9 @@
 %%                         <Christine_Roemer at t-online dot de>
 %% and collaborators for the translation into German of the documentation
 %%
-\def\etocpkgdate        {2018/02/07}
-\def\etocdocdate        {2018/02/07}
-\def\etocpkgversion     {v1.08m}
+\def\etocpkgdate        {2018/02/23}
+\def\etocdocdate        {2018/02/23}
+\def\etocpkgversion     {v1.08n}
 \def\etocpkgdescription {Completely customisable TOCs (JFB)}
 %% Run etex on this file to extract from etoc.dtx:
 %%        etoc.sty, etoc.tex, etoc-DE.tex and README.md

Modified: trunk/Master/texmf-dist/tex/latex/etoc/etoc.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/etoc/etoc.sty	2018-02-24 22:55:48 UTC (rev 46734)
+++ trunk/Master/texmf-dist/tex/latex/etoc/etoc.sty	2018-02-24 22:56:01 UTC (rev 46735)
@@ -23,10 +23,10 @@
 %%
 \NeedsTeXFormat{LaTeX2e}
 \ProvidesPackage{etoc}
- [2018/02/07 v1.08m Completely customisable TOCs (JFB)]
+ [2018/02/23 v1.08n Completely customisable TOCs (JFB)]
 %%
 %% Package: etoc
-%% Version: 1.08m-2018/02/07
+%% Version: 1.08n-2018/02/23
 %% License: LPPL 1.3c
 %% Copyright (C) 2012-2018 Jean-Francois Burnol
 %%                         <jfbu at free dot fr>
@@ -340,12 +340,15 @@
     \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)
-    \Etoc at getthepage #2\etoc@ % defines \etocthelinkedpage
-    \Etoc at getnb #1\relax\relax\etoc@  % sets number, name, and \etocthelink
+    \futurelet\Etoc at getthepage@token
+       \Etoc at getthepage #2\etoc@ % defines \etocthelinkedpage
+    \futurelet\Etoc at getnb@token
+       \Etoc at getnb #1\relax\relax\etoc@  % sets number, name, and \etocthelink
     \ifEtoc at number
     \else
      \ifnum\Etoc at level=\m at ne
-       \Etoc at getit #1\hspace\relax\etoc@   % additional job for parts
+       \futurelet\Etoc at getit@token
+          \Etoc at getit #1\hspace\relax\etoc@   % additional job for parts
      \fi
     \fi
     \Etoc at global\expandafter\let\csname etoclink \endcsname\etocthelink
@@ -353,14 +356,14 @@
     \Etoc at global\expandafter\let\csname etocnumber \endcsname\etocthelinkednumber
     \Etoc at global\expandafter\let\csname etocpage \endcsname\etocthelinkedpage
     }
-\def\Etoc at getthepage #1{%
-  \let\Etoc at next\Etoc at getthepage@nohyp
-  \ifEtoc at hyperref
-   \ifx\hyper at linkstart#1%
-    \let\Etoc at next\Etoc at getthepage@hyp
-   \fi
-  \fi
-  \Etoc at next #1%
+\def\Etoc at getthepage {%
+    \if1\ifEtoc at hyperref
+        \ifx\hyper at linkstart\Etoc at getthepage@token1\else0\fi
+        \else0\fi
+       \expandafter\Etoc at getthepage@hyp
+    \else
+       \expandafter\Etoc at getthepage@nohyp
+    \fi
 }
 \def\Etoc at getthepage@nohyp #1\etoc@ {%
     \Etoc at global\def\etocthepage       {#1}%
@@ -367,112 +370,136 @@
     \Etoc at global\def\etocthelinkedpage {#1}%
 }
 \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}}%
+    \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 getnb #1{%
-  \let\Etoc at next\Etoc at getnb@nohyp
-  \ifEtoc at hyperref
-   \ifx\hyper at linkstart#1%
-    \let\Etoc at next\Etoc at getnb@hyp
-   \fi
-  \fi
-  \Etoc at next #1%
+\def\Etoc at getnb {%
+    \ifx\Etoc at getnb@token\bgroup
+       \expandafter\Etoc at getnb@nohyp at nonbr
+    \else
+       \if1\ifEtoc at hyperref
+            \ifx\hyper at linkstart\Etoc at getnb@token1\else0\fi
+           \else0\fi
+        \expandafter\expandafter\expandafter\Etoc at getnb@hyp
+       \else
+        \expandafter\expandafter\expandafter\Etoc at getnb@nohyp
+       \fi
+    \fi
 }
-\def\Etoc at getit #1{%
-  \let\Etoc at next\Etoc at getit@nohyp
-  \ifEtoc at hyperref
-   \ifx\hyper at linkstart#1%
-    \let\Etoc at next\Etoc at getit@hyp
-   \fi
-  \fi
-  \Etoc at next #1%
+\def\Etoc at getnb@nohyp #1{%
+    \in@{#1}{\numberline\chapternumberline\partnumberline\booknumberline}%
+    \ifin@
+       \let\Etoc at next\Etoc at getnb@nohyp at nmbrd
+    \else
+       \let\Etoc at next\Etoc at getnb@nohyp at nonbr
+       \in@{#1}{\nonumberline}%
+       \ifin@
+           \ifx\nonumberline\empty\else\let\Etoc at next\Etoc at getnb@nohyp at nmbrd\fi
+           \expandafter\expandafter\expandafter\expandafter
+       \fi
+    \fi
+    \Etoc at next #1%
 }
-\begingroup\@tfor\x:=NUMBZRLINZ\do{\catcode\expandafter`\x=12 }\lccode`Z `e
-\lowercase{\endgroup
-\long\def\Etoc at oneifnumberline #1NUMBZRLINZ#2#3\Etoc at next#4{%
-   \ifx\etoc@#20\else\ifx\nonumberline#40\else1\fi\fi
-}%
-\def\Etoc at getnb@nohyp #1#2#3\etoc@ {%
-    \def\Etoc at getname ##1\relax\relax\etoc@ {%
-      \Etoc at global\def\etocthename       {##1}%
-      \Etoc at global\def\etocthelinkedname {##1}%
-     }%
-  \if1\expandafter\Etoc at oneifnumberline\string#1NUMBZRLINZ\etoc@\Etoc at next{#1}%
+\def\Etoc at getnb@nohyp at nmbrd #1#2#3\relax\relax\etoc@ {%
+    \Etoc at global\Etoc at numbertrue
     \Etoc at global\def\etocthenumber       {#2}%
     \Etoc at global\def\etocthelinkednumber {#2}%
-    \Etoc at global\Etoc at numbertrue
-    \Etoc at getname #3\etoc@
-  \else % \etocthename and \etocthelinkedname already defined
+    \Etoc at global\def\etocthename         {#3}%
+    \Etoc at global\def\etocthelinkedname   {#3}%
+}
+\def\Etoc at getnb@nohyp at nonbr #1\etoc@ {%
+    % \etocthename and \etocthelinkedname already defined in \Etoc at lxyz
+    \Etoc at global\Etoc at numberfalse
     \Etoc at global\let\etocthenumber       \@empty
     \Etoc at global\let\etocthelinkednumber \@empty
-    \Etoc at global\Etoc at numberfalse
-  \fi
-}%
+}
 \def\Etoc at getnb@hyp #1#2#3#4#5#6\etoc@ {%
-         \def\Etoc at getname ##1\relax\relax\etoc@ {%
-         \Etoc at global\def\etocthename {##1}%
-         \edef\Etoc at tmp   {{#3}}%
-         \Etoc at global\expandafter\def\expandafter\etocthelinkedname\expandafter
-                              {\expandafter\hyperlink \Etoc at tmp{##1}}%
-         }%
-         \def\Etoc at getnbr ##1##2##3\etoc@ {%
-          \if1\expandafter\Etoc at oneifnumberline\string##1NUMBZRLINZ\etoc@\Etoc at next{##1}%
-            \Etoc at global\def\etocthenumber {##2}%
-            \edef\Etoc at tmp   {{#3}}%
-            \Etoc at global\expandafter\def\expandafter\etocthelinkednumber
-                        \expandafter{\expandafter\hyperlink \Etoc at tmp{##2}}%
-            \Etoc at global\Etoc at numbertrue
-            \Etoc at getname ##3\etoc@
-          \else
-            \Etoc at global\let\etocthenumber       \@empty
-            \Etoc at global\let\etocthelinkednumber \@empty
-            \Etoc at global\Etoc at numberfalse
-            \Etoc at global\def\etocthename {#4}%
-            \edef\Etoc at tmp   {{#3}}%
-            \Etoc at global\expandafter\def\expandafter\etocthelinkedname
-                        \expandafter {\expandafter\hyperlink \Etoc at tmp{#4}}%
-          \fi
-         }%
-  \Etoc at global\edef\etocthelink ##1{\noexpand\hyperlink {#3}{##1}}%
-  \Etoc at getnbr #4\relax\relax\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 hyp@getnb #4\relax\relax\etoc@
+}
+\def\Etoc at hyp@getnb {%
+    \ifx\Etoc at hyp@getnb at token\bgroup
+       \expandafter\Etoc at hyp@getnb at nonbr
+    \else
+       \expandafter\Etoc at getnb@hyp at a
+    \fi
+}
+\def\Etoc at getnb@hyp at a #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@hyp at nonbr
+       \in@{#1}{\nonumberline}%
+       \ifin@
+           \ifx\nonumberline\empty\else\let\Etoc at next\Etoc at getnb@hyp at nmbrd\fi
+           \expandafter\expandafter\expandafter\expandafter
+       \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}}%
+}
+\let\Etoc at getnb@hyp at nonbr\Etoc at getnb@nohyp at nonbr
+\def\Etoc at getit {%
+    \if1\ifEtoc at hyperref
+        \ifx\hyper at linkstart\Etoc at getit@token1\else0\fi
+        \else0\fi
+       \expandafter\Etoc at getit@hyp
+    \else
+       \expandafter\Etoc at getit@nohyp
+    \fi
+}
 \def\Etoc at getit@nohyp #1\hspace#2#3\etoc@ {%
-    \def\Etoc at getname ##1\hspace\relax\etoc@ {%
-       \Etoc at global\def\etocthename       {##1}%
-       \Etoc at global\def\etocthelinkedname {##1}%
-    }%
-  \ifx\relax#2%
-  \else
-        \Etoc at global\def\etocthenumber       {#1}%
-        \Etoc at global\def\etocthelinkednumber {#1}%
-        \Etoc at global\Etoc at numbertrue
-        \Etoc at getname #3\etoc@
-  \fi
+    \ifx\relax#2%
+    \else
+      \Etoc at global\def\etocthenumber       {#1}%
+      \Etoc at global\def\etocthelinkednumber {#1}%
+      \Etoc at global\Etoc at numbertrue
+      \Etoc at getit@nohyp at getname #3\etoc@
+    \fi
 }
+\def\Etoc at getit@nohyp at getname #1\hspace\relax\etoc@ {%
+    \Etoc at global\def\etocthename       {#1}%
+    \Etoc at global\def\etocthelinkedname {#1}%
+}
 \def\Etoc at getit@hyp #1#2#3#4#5#6\etoc@ {%
-    \def\Etoc 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}}%
-    }%
-    \def\Etoc at getnbr ##1\hspace##2##3\etoc@ {%
-       \ifx\relax##2%
-       \else
-         \Etoc at global\def\etocthenumber {##1}%
-         \Etoc at global\expandafter\def\expandafter\etocthelinkednumber
-                     \expandafter{\expandafter\hyperlink \Etoc at tmp{##1}}%
-         \Etoc at global\Etoc at numbertrue
-         \Etoc at getname ##3\etoc@
-       \fi
-    }%
-  \edef\Etoc at tmp {{#3}}%
-  \Etoc at getnbr #4\hspace\relax\etoc@
-  \Etoc at global\edef\etocthelink ##1{\noexpand\hyperlink\Etoc at tmp{##1}}%
+    \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 hyp@getit #4\hspace\relax\etoc@
 }
+\def\Etoc at hyp@getit #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



More information about the tex-live-commits mailing list