diff options
author | Karl Berry <karl@freefriends.org> | 2018-02-24 22:56:01 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2018-02-24 22:56:01 +0000 |
commit | 31fb4368eaef951f63e88d946055bad4aed58051 (patch) | |
tree | 88b95167c4386c48a44e70b56f9fc630de228352 /Master/texmf-dist/tex/latex/etoc/etoc.sty | |
parent | 639142532220b568f14f469b903c899b573c8a76 (diff) |
etoc (24feb18)
git-svn-id: svn://tug.org/texlive/trunk@46735 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/etoc/etoc.sty')
-rw-r--r-- | Master/texmf-dist/tex/latex/etoc/etoc.sty | 241 |
1 files changed, 134 insertions, 107 deletions
diff --git a/Master/texmf-dist/tex/latex/etoc/etoc.sty b/Master/texmf-dist/tex/latex/etoc/etoc.sty index 1a1f7ab901d..1dec7ee47be 100644 --- a/Master/texmf-dist/tex/latex/etoc/etoc.sty +++ b/Master/texmf-dist/tex/latex/etoc/etoc.sty @@ -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@global\let\etocthelink\@firstofone % fall-back, was let \@empty up to 1.08i (inc.) \Etoc@global\def\etocthename {#1}% (if linked, will be removed later) \Etoc@global\def\etocthelinkedname {#1}% (probably redefined later) - \Etoc@getthepage #2\etoc@ % defines \etocthelinkedpage - \Etoc@getnb #1\relax\relax\etoc@ % sets number, name, and \etocthelink + \futurelet\Etoc@getthepage@token + \Etoc@getthepage #2\etoc@ % defines \etocthelinkedpage + \futurelet\Etoc@getnb@token + \Etoc@getnb #1\relax\relax\etoc@ % sets number, name, and \etocthelink \ifEtoc@number \else \ifnum\Etoc@level=\m@ne - \Etoc@getit #1\hspace\relax\etoc@ % additional job for parts + \futurelet\Etoc@getit@token + \Etoc@getit #1\hspace\relax\etoc@ % additional job for parts \fi \fi \Etoc@global\expandafter\let\csname etoclink \endcsname\etocthelink @@ -353,126 +356,150 @@ \Etoc@global\expandafter\let\csname etocnumber \endcsname\etocthelinkednumber \Etoc@global\expandafter\let\csname etocpage \endcsname\etocthelinkedpage } -\def\Etoc@getthepage #1{% - \let\Etoc@next\Etoc@getthepage@nohyp - \ifEtoc@hyperref - \ifx\hyper@linkstart#1% - \let\Etoc@next\Etoc@getthepage@hyp - \fi - \fi - \Etoc@next #1% +\def\Etoc@getthepage {% + \if1\ifEtoc@hyperref + \ifx\hyper@linkstart\Etoc@getthepage@token1\else0\fi + \else0\fi + \expandafter\Etoc@getthepage@hyp + \else + \expandafter\Etoc@getthepage@nohyp + \fi } \def\Etoc@getthepage@nohyp #1\etoc@ {% \Etoc@global\def\etocthepage {#1}% \Etoc@global\def\etocthelinkedpage {#1}% } \def\Etoc@getthepage@hyp #1#2#3#4#5\etoc@ {% - \Etoc@global\def\etocthepage {#4}% - \edef\Etoc@tmp {{#3}}% - \Etoc@global\expandafter\def\expandafter\etocthelinkedpage\expandafter - {\expandafter\hyperlink \Etoc@tmp{#4}}% - \Etoc@global\edef\etocthelink##1{\noexpand\hyperlink\Etoc@tmp{##1}}% + \Etoc@global\def\etocthepage {#4}% + \edef\Etoc@tmp {{#3}}% + \Etoc@global\expandafter\def\expandafter\etocthelinkedpage\expandafter + {\expandafter\hyperlink \Etoc@tmp{#4}}% + \Etoc@global\edef\etocthelink##1{\noexpand\hyperlink\Etoc@tmp{##1}}% } -\def\Etoc@getnb #1{% - \let\Etoc@next\Etoc@getnb@nohyp - \ifEtoc@hyperref - \ifx\hyper@linkstart#1% - \let\Etoc@next\Etoc@getnb@hyp - \fi - \fi - \Etoc@next #1% +\def\Etoc@getnb {% + \ifx\Etoc@getnb@token\bgroup + \expandafter\Etoc@getnb@nohyp@nonbr + \else + \if1\ifEtoc@hyperref + \ifx\hyper@linkstart\Etoc@getnb@token1\else0\fi + \else0\fi + \expandafter\expandafter\expandafter\Etoc@getnb@hyp + \else + \expandafter\expandafter\expandafter\Etoc@getnb@nohyp + \fi + \fi } -\def\Etoc@getit #1{% - \let\Etoc@next\Etoc@getit@nohyp - \ifEtoc@hyperref - \ifx\hyper@linkstart#1% - \let\Etoc@next\Etoc@getit@hyp - \fi - \fi - \Etoc@next #1% +\def\Etoc@getnb@nohyp #1{% + \in@{#1}{\numberline\chapternumberline\partnumberline\booknumberline}% + \ifin@ + \let\Etoc@next\Etoc@getnb@nohyp@nmbrd + \else + \let\Etoc@next\Etoc@getnb@nohyp@nonbr + \in@{#1}{\nonumberline}% + \ifin@ + \ifx\nonumberline\empty\else\let\Etoc@next\Etoc@getnb@nohyp@nmbrd\fi + \expandafter\expandafter\expandafter\expandafter + \fi + \fi + \Etoc@next #1% } -\begingroup\@tfor\x:=NUMBZRLINZ\do{\catcode\expandafter`\x=12 }\lccode`Z `e -\lowercase{\endgroup -\long\def\Etoc@oneifnumberline #1NUMBZRLINZ#2#3\Etoc@next#4{% - \ifx\etoc@#20\else\ifx\nonumberline#40\else1\fi\fi -}% -\def\Etoc@getnb@nohyp #1#2#3\etoc@ {% - \def\Etoc@getname ##1\relax\relax\etoc@ {% - \Etoc@global\def\etocthename {##1}% - \Etoc@global\def\etocthelinkedname {##1}% - }% - \if1\expandafter\Etoc@oneifnumberline\string#1NUMBZRLINZ\etoc@\Etoc@next{#1}% +\def\Etoc@getnb@nohyp@nmbrd #1#2#3\relax\relax\etoc@ {% + \Etoc@global\Etoc@numbertrue \Etoc@global\def\etocthenumber {#2}% \Etoc@global\def\etocthelinkednumber {#2}% - \Etoc@global\Etoc@numbertrue - \Etoc@getname #3\etoc@ - \else % \etocthename and \etocthelinkedname already defined + \Etoc@global\def\etocthename {#3}% + \Etoc@global\def\etocthelinkedname {#3}% +} +\def\Etoc@getnb@nohyp@nonbr #1\etoc@ {% + % \etocthename and \etocthelinkedname already defined in \Etoc@lxyz + \Etoc@global\Etoc@numberfalse \Etoc@global\let\etocthenumber \@empty \Etoc@global\let\etocthelinkednumber \@empty - \Etoc@global\Etoc@numberfalse - \fi -}% +} \def\Etoc@getnb@hyp #1#2#3#4#5#6\etoc@ {% - \def\Etoc@getname ##1\relax\relax\etoc@ {% - \Etoc@global\def\etocthename {##1}% - \edef\Etoc@tmp {{#3}}% - \Etoc@global\expandafter\def\expandafter\etocthelinkedname\expandafter - {\expandafter\hyperlink \Etoc@tmp{##1}}% - }% - \def\Etoc@getnbr ##1##2##3\etoc@ {% - \if1\expandafter\Etoc@oneifnumberline\string##1NUMBZRLINZ\etoc@\Etoc@next{##1}% - \Etoc@global\def\etocthenumber {##2}% - \edef\Etoc@tmp {{#3}}% - \Etoc@global\expandafter\def\expandafter\etocthelinkednumber - \expandafter{\expandafter\hyperlink \Etoc@tmp{##2}}% - \Etoc@global\Etoc@numbertrue - \Etoc@getname ##3\etoc@ - \else - \Etoc@global\let\etocthenumber \@empty - \Etoc@global\let\etocthelinkednumber \@empty - \Etoc@global\Etoc@numberfalse - \Etoc@global\def\etocthename {#4}% - \edef\Etoc@tmp {{#3}}% - \Etoc@global\expandafter\def\expandafter\etocthelinkedname - \expandafter {\expandafter\hyperlink \Etoc@tmp{#4}}% - \fi - }% - \Etoc@global\edef\etocthelink ##1{\noexpand\hyperlink {#3}{##1}}% - \Etoc@getnbr #4\relax\relax\etoc@ -}} + \edef\Etoc@tmp {{#3}}% + \Etoc@global\edef\etocthelink ##1{\noexpand\hyperlink {#3}{##1}}% + \Etoc@global\def\etocthename {#4}% temporary definition + \Etoc@global\expandafter\def\expandafter\etocthelinkedname + \expandafter {\expandafter\hyperlink \Etoc@tmp{#4}}% + \futurelet\Etoc@hyp@getnb@token\Etoc@hyp@getnb #4\relax\relax\etoc@ +} +\def\Etoc@hyp@getnb {% + \ifx\Etoc@hyp@getnb@token\bgroup + \expandafter\Etoc@hyp@getnb@nonbr + \else + \expandafter\Etoc@getnb@hyp@a + \fi +} +\def\Etoc@getnb@hyp@a #1{% + \in@{#1}{\numberline\chapternumberline\partnumberline\booknumberline}% + \ifin@ + \let\Etoc@next\Etoc@getnb@hyp@nmbrd + \else + \let\Etoc@next\Etoc@getnb@hyp@nonbr + \in@{#1}{\nonumberline}% + \ifin@ + \ifx\nonumberline\empty\else\let\Etoc@next\Etoc@getnb@hyp@nmbrd\fi + \expandafter\expandafter\expandafter\expandafter + \fi + \fi + \Etoc@next #1% +} +\def\Etoc@getnb@hyp@nmbrd #1#2#3\relax\relax\etoc@ {% + \Etoc@global\Etoc@numbertrue + \Etoc@global\def\etocthenumber {#2}% + \Etoc@global\expandafter\def\expandafter\etocthelinkednumber + \expandafter{\expandafter\hyperlink \Etoc@tmp{#2}}% + \Etoc@global\def\etocthename {#3}% + \Etoc@global\expandafter\def\expandafter\etocthelinkedname + \expandafter{\expandafter\hyperlink \Etoc@tmp{#3}}% +} +\let\Etoc@getnb@hyp@nonbr\Etoc@getnb@nohyp@nonbr +\def\Etoc@getit {% + \if1\ifEtoc@hyperref + \ifx\hyper@linkstart\Etoc@getit@token1\else0\fi + \else0\fi + \expandafter\Etoc@getit@hyp + \else + \expandafter\Etoc@getit@nohyp + \fi +} \def\Etoc@getit@nohyp #1\hspace#2#3\etoc@ {% - \def\Etoc@getname ##1\hspace\relax\etoc@ {% - \Etoc@global\def\etocthename {##1}% - \Etoc@global\def\etocthelinkedname {##1}% - }% - \ifx\relax#2% - \else - \Etoc@global\def\etocthenumber {#1}% - \Etoc@global\def\etocthelinkednumber {#1}% - \Etoc@global\Etoc@numbertrue - \Etoc@getname #3\etoc@ - \fi + \ifx\relax#2% + \else + \Etoc@global\def\etocthenumber {#1}% + \Etoc@global\def\etocthelinkednumber {#1}% + \Etoc@global\Etoc@numbertrue + \Etoc@getit@nohyp@getname #3\etoc@ + \fi +} +\def\Etoc@getit@nohyp@getname #1\hspace\relax\etoc@ {% + \Etoc@global\def\etocthename {#1}% + \Etoc@global\def\etocthelinkedname {#1}% } \def\Etoc@getit@hyp #1#2#3#4#5#6\etoc@ {% - \def\Etoc@getname ##1\hspace\relax\etoc@ {% - \Etoc@global\def\etocthename {##1}% - \Etoc@global\expandafter\def\expandafter\etocthelinkedname - \expandafter{\expandafter\hyperlink \Etoc@tmp{##1}}% - }% - \def\Etoc@getnbr ##1\hspace##2##3\etoc@ {% - \ifx\relax##2% - \else - \Etoc@global\def\etocthenumber {##1}% - \Etoc@global\expandafter\def\expandafter\etocthelinkednumber - \expandafter{\expandafter\hyperlink \Etoc@tmp{##1}}% - \Etoc@global\Etoc@numbertrue - \Etoc@getname ##3\etoc@ - \fi - }% - \edef\Etoc@tmp {{#3}}% - \Etoc@getnbr #4\hspace\relax\etoc@ - \Etoc@global\edef\etocthelink ##1{\noexpand\hyperlink\Etoc@tmp{##1}}% + \edef\Etoc@tmp {{#3}}% + \Etoc@global\edef\etocthelink ##1{\noexpand\hyperlink \Etoc@tmp{##1}}% + \Etoc@global\def\etocthename {#4}% temporary definition + \Etoc@global\expandafter\def\expandafter\etocthelinkedname + \expandafter{\expandafter\hyperlink \Etoc@tmp{#4}}% + \Etoc@hyp@getit #4\hspace\relax\etoc@ +} +\def\Etoc@hyp@getit #1\hspace#2#3\etoc@ {% + \ifx\relax#2% not extremely safe + \else + \Etoc@global\Etoc@numbertrue + \Etoc@global\def\etocthenumber {#1}% + \Etoc@global\expandafter\def\expandafter\etocthelinkednumber + \expandafter{\expandafter\hyperlink \Etoc@tmp{#1}}% + \Etoc@getit@hyp@getname #3\etoc@ + \fi } +\def\Etoc@getit@hyp@getname #1\hspace\relax\etoc@ {% + \Etoc@global\def\etocthename {#1}% + \Etoc@global\expandafter\def\expandafter\etocthelinkedname + \expandafter{\expandafter\hyperlink \Etoc@tmp{#1}}% +}% \let\etocthename \@empty \let\etocthenumber \@empty \let\etocthepage \@empty |