diff options
author | Karl Berry <karl@freefriends.org> | 2022-08-31 20:17:10 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2022-08-31 20:17:10 +0000 |
commit | 4e9313146db51b1de8d36a12a57139c970aca05b (patch) | |
tree | 2ea87ca35ef51d252822d93f50635aea2f007aeb /Master/texmf-dist/tex/latex | |
parent | f899363d96052e89d9d81c5b4598da38838946c8 (diff) |
etoc (31aug22)
git-svn-id: svn://tug.org/texlive/trunk@64249 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex')
-rw-r--r-- | Master/texmf-dist/tex/latex/etoc/etoc.sty | 175 |
1 files changed, 135 insertions, 40 deletions
diff --git a/Master/texmf-dist/tex/latex/etoc/etoc.sty b/Master/texmf-dist/tex/latex/etoc/etoc.sty index 365b6b148c8..30f4245840c 100644 --- a/Master/texmf-dist/tex/latex/etoc/etoc.sty +++ b/Master/texmf-dist/tex/latex/etoc/etoc.sty @@ -23,16 +23,13 @@ %% \NeedsTeXFormat{LaTeX2e} \ProvidesPackage{etoc} - [2021/09/23 v1.09e Completely customisable TOCs (JFB)] + [2022/08/30 v1.09f Completely customisable TOCs (JFB)] %% %% Package: etoc -%% Version: 1.09e +%% Version: 1.09f %% License: LPPL 1.3c -%% Copyright (C) 2012-2021 Jean-Francois Burnol +%% Copyright (C) 2012-2022 Jean-Francois Burnol %% <jfbu at free dot fr> -%% Copyright (C) 2014-2015 Christine Roemer and collaborators -%% <Christine_Roemer at t-online dot de> -%% (translation into German of the documentation) \RequirePackage{multicol} \DeclareOption*{\PackageWarning{etoc}{Option `\CurrentOption' is unknown.}} \ProcessOptions\relax @@ -158,13 +155,15 @@ \@ifpackageloaded{parskip}{\Etoc@parskiptrue}{}% \@ifpackageloaded{hyperref}{\Etoc@hyperreftrue \def\Etoc@et@hop#1#2#3#4#5{#2{#3}{#4}{#5}#1}% - \long\def\Etoc@gobblefourorthree#1#2#3#4{}} + \let\Etoc@gobblefourorthree\@gobblefour} {\def\Etoc@et@hop#1#2#3#4{#2{#3}{#4}#1}% \long\def\Etoc@gobblefourorthree#1#2#3{}}% -\@ifl@t@r\fmtversion{2021/11/15}{% +\@ifl@t@r\fmtversion{2021/11/15}% + {% \def\Etoc@et@hop#1#2#3#4#5{#2{#3}{#4}{#5}#1}% \let\Etoc@gobblefourorthree\@gobblefour - }{}% + }% + {}% } \def\Etoc@setflags {% \ifcase \Etoc@level @@ -380,11 +379,10 @@ } \def\Etoc@@getnb {% \Etoc@bracednamefalse - \ifx\Etoc@getnb@token\bgroup - \expandafter\Etoc@getnb@checkifbraced - \else - \expandafter\Etoc@getnb - \fi + \let\Etoc@next\Etoc@getnb + \ifx\Etoc@getnb@token\@sptoken\let\Etoc@next\Etoc@getnb@nohyp@nonbr\fi + \ifx\Etoc@getnb@token\bgroup \let\Etoc@next\Etoc@getnb@checkifbraced\fi + \Etoc@next } \def\Etoc@tworelax{\relax\relax} \def\Etoc@getnb@checkifbraced #1#2\etoc@ {% @@ -421,8 +419,11 @@ \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 + \ifx\nonumberline\empty + \let\Etoc@next\Etoc@getnb@nohyp@nonumberline + \else + \def\Etoc@next{\expandafter\Etoc@getnb@nohyp@nmbrd}% + \fi \fi \fi \Etoc@next #1% @@ -432,19 +433,29 @@ \Etoc@global\def\etocthenumber {#2}% \Etoc@global\def\etocthelinkednumber {#2}% \ifEtoc@bracedname - \Etoc@global\def\etocthename {{#3}}% - \Etoc@global\def\etocthelinkedname {{#3}}% + \Etoc@global\def\etocthename{{#3}}% \else - \Etoc@global\def\etocthename {#3}% - \Etoc@global\def\etocthelinkedname {#3}% + \Etoc@global\def\etocthename{#3}% \fi + \Etoc@global\let\etocthelinkedname \etocthename } \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 } +\def\Etoc@getnb@nohyp@nonumberline #1\relax\relax\etoc@ {% + \Etoc@global\Etoc@numberfalse + \Etoc@global\let\etocthenumber \@empty + \Etoc@global\let\etocthelinkednumber \@empty + \ifEtoc@bracedname + \Etoc@global\expandafter\def\expandafter\etocthename + \expandafter{\expandafter{#1}}% + \else + \Etoc@global\expandafter\def\expandafter\etocthename\expandafter{#1}% + \fi + \Etoc@global\let\etocthelinkedname \etocthename +} \def\Etoc@getnb@hyp #1#2#3#4#5#6\etoc@ {% \edef\Etoc@tmp {{#3}}% \Etoc@global\edef\etocthelink ##1{\noexpand\hyperlink {#3}{##1}}% @@ -455,7 +466,7 @@ } \def\Etoc@getnb@hyp@a {% \ifx\Etoc@hyp@getnb@token\bgroup - \expandafter\Etoc@getnb@hyp@nonbr + \expandafter\Etoc@getnb@nohyp@nonbr \else \expandafter\Etoc@getnb@hyp@b \fi @@ -465,11 +476,14 @@ \ifin@ \let\Etoc@next\Etoc@getnb@hyp@nmbrd \else - \let\Etoc@next\Etoc@getnb@hyp@nonbr + \let\Etoc@next\Etoc@getnb@nohyp@nonbr \in@{#1}{\nonumberline}% \ifin@ - \ifx\nonumberline\empty\else\let\Etoc@next\Etoc@getnb@hyp@nmbrd\fi - \expandafter\expandafter\expandafter\expandafter + \ifx\nonumberline\empty + \let\Etoc@next\Etoc@getnb@hyp@nonumberline + \else + \def\Etoc@next{\expandafter\Etoc@getnb@hyp@nmbrd}% + \fi \fi \fi \Etoc@next #1% @@ -483,7 +497,22 @@ \Etoc@global\expandafter\def\expandafter\etocthelinkedname \expandafter{\expandafter\hyperlink \Etoc@tmp{#3}}% } -\let\Etoc@getnb@hyp@nonbr\Etoc@getnb@nohyp@nonbr +\def\Etoc@getnb@hyp@nonumberline #1\relax\relax\etoc@ {% + \Etoc@global\Etoc@numberfalse + \Etoc@global\let\etocthenumber \@empty + \Etoc@global\let\etocthelinkednumber \@empty + \ifEtoc@bracedname + \Etoc@global\expandafter\def\expandafter\etocthename + \expandafter{\expandafter{#1}}% + \else + \Etoc@global\expandafter\def\expandafter\etocthename\expandafter{#1}% + \fi + \Etoc@global\expandafter\expandafter\expandafter\def + \expandafter\expandafter\expandafter\etocthelinkedname + \expandafter\expandafter\expandafter{% + \expandafter\expandafter\expandafter\hyperlink + \expandafter\Etoc@tmp\expandafter{\etocthename}}% +} \def\Etoc@@getit{% \ifEtoc@bracedname \expandafter\expandafter\expandafter\Etoc@getit@nameisbraced @@ -514,11 +543,10 @@ \def\Etoc@getit@nohyp@getname #1\hspace\relax\etoc@ {% \ifEtoc@bracedname \Etoc@global\def\etocthename {{#1}}% - \Etoc@global\def\etocthelinkedname {{#1}}% \else \Etoc@global\def\etocthename {#1}% - \Etoc@global\def\etocthelinkedname {#1}% \fi + \Etoc@global\let\etocthelinkedname\etocthename } \def\Etoc@getit@hyp #1#2#3#4#5#6\etoc@ {% \edef\Etoc@tmp {{#3}}% @@ -898,9 +926,10 @@ \leftskip \etocminustwoleftmargin \rightskip \etocminustworightmargin \parfillskip \@flushglue - \vbox{\etocifnumbered{\etocbookname\enspace\etocnumber:\quad}{}\etocname - \baselineskip\etocbaselinespreadminustwo\baselineskip - \par}% + \vbox{\etocifnumbered{\etoclink{\etocbookname\enspace\etocthenumber:\quad}}{}% + \etocname + \baselineskip\etocbaselinespreadminustwo\baselineskip + \par}% \addpenalty\@M\addvspace{\etocsepminusone}% \endgroup} {}% @@ -915,7 +944,8 @@ \leftskip \etocminusoneleftmargin \rightskip \etocminusonerightmargin \parfillskip \@flushglue - \vbox{\etocifnumbered{\etocpartname\enspace\etocnumber.\quad}{}\etocname + \vbox{\etocifnumbered{\etoclink{\etocpartname\enspace\etocthenumber.\quad}}{}% + \etocname \baselineskip\etocbaselinespreadminusone\baselineskip \par}% \addpenalty\@M\addvspace{\etocsepzero}% @@ -1288,18 +1318,25 @@ \fi \parskip \cftparskip \@nameuse {cfttocbeforelisthook}} {\@nameuse {cfttocafterlisthook}\endgroup\restorefromonecol}} -\ifdefined\Iftocfeature\def\etoc@Iftocfeature{\Iftocfeature}\else\def\etoc@Iftocfeature{\iftocfeature}\fi +\ifdefined\Iftocfeature + \def\etoc@Iftocfeature{\Iftocfeature}% +\else + \def\etoc@Iftocfeature{\iftocfeature}% +\fi \def\etocscrartclstyle{% \etocsettocstyle {\let\if@dynlist\if@tocleft - \def\@currext{toc}% added 1.07m 2015/01/23 + \def\@currext{toc}% + \@ifundefined{listoftocname}% + {\def\list@fname{\listofname~toc}}% + {\expandafter\let\expandafter\list@fname\csname listoftocname\endcsname}% \etoc@Iftocfeature {toc}{onecolumn} {\etoc@Iftocfeature {toc}{leveldown} {} {\if@twocolumn \aftergroup \twocolumn \onecolumn \fi }} {}% \etoc@Iftocfeature {toc}{numberline}{\def \nonumberline {\numberline {}}}{}% - \tocbasic@listhead {\listoftocname}% + \expandafter\tocbasic@listhead\expandafter {\list@fname}% \begingroup \expandafter \expandafter \expandafter \endgroup \expandafter \ifx @@ -1310,12 +1347,18 @@ \PackageInfo {tocbasic}% {character protrusion at toc deactivated}}% \fi + \etoc@Iftocfeature{toc}{noparskipfake}{}{% + \ifvmode \@tempskipa\lastskip \vskip-\lastskip + \addtolength{\@tempskipa}{\parskip}\vskip\@tempskipa\fi + }% \setlength {\parskip }{\z@ }% \setlength {\parindent }{\z@ }% \setlength {\parfillskip }{\z@ \@plus 1fil}% \csname tocbasic@@before@hook\endcsname \csname tb@toc@before@hook\endcsname} - {\csname tb@toc@after@hook\endcsname + {% + \providecommand\tocbasic@end@toc@file{}\tocbasic@end@toc@file + \csname tb@toc@after@hook\endcsname \csname tocbasic@@after@hook\endcsname}} \let\etocscrbookstyle\etocscrartclstyle \let\etocscrreprtstyle\etocscrartclstyle @@ -1403,11 +1446,27 @@ \ifdefined\protected@file@percent\protected@file@percent\fi }% \fi} -\def\Etoc@addcontentsline@ #1#2#3% - {\@namedef{toclevel@#1}{#3}% - \addcontentsline {toc}{#1}{#2}} +\def\Etoc@addcontentsline@ #1#2#3{% + \@namedef{toclevel@#1}{#3}\addcontentsline {toc}{#1}{#2}% +} \DeclareRobustCommand*{\etoctoccontentsline} {\@ifstar{\Etoc@addcontentsline@}{\Etoc@addtocontents}} +\def\Etoc@addtocontents@immediately#1#2{% + \begingroup + \let\Etoc@originalwrite\write + \def\write{\immediate\Etoc@originalwrite}% + \Etoc@addtocontents{#1}{#2}% + \endgroup +} +\def\Etoc@addcontentsline@@immediately#1#2#3{% + \begingroup + \let\Etoc@originalwrite\write + \def\write{\immediate\Etoc@originalwrite}% + \Etoc@addcontentsline@{#1}{#2}{#3}% + \endgoroup +} +\DeclareRobustCommand*{\etocimmediatetoccontentsline} + {\@ifstar{\Etoc@addcontentsline@@immediately}{\Etoc@addtocontents@immediately}} \def\Etoc@storetocdepth {\global\c@etoc@tocdepth\c@tocdepth } \def\Etoc@restoretocdepth {\global\c@tocdepth\c@etoc@tocdepth } \def\etocobeytoctocdepth {\def\etoc@settocdepth @@ -1433,8 +1492,30 @@ {\addtocontents {toc} {\protect\etoc@settocdepth\expandafter\protect\csname Etoc@#1@@\endcsname}}% } +\def\etocimmediatesettocdepth #1#{\Etoc@set@toctocdepth@immediately} +\def\Etoc@set@toctocdepth@immediately #1{% + \@ifundefined{Etoc@#1@@}% + {\PackageWarning{etoc} + {Unknown sectioning depth #1, \protect\etocimmediatesettocdepth.toc ignored}}% + {\begingroup + \let\Etoc@originalwrite\write + \def\write{\immediate\Etoc@originalwrite}% + \addtocontents {toc} + {\protect\etoc@settocdepth\expandafter\protect + \csname Etoc@#1@@\endcsname}% + \endgroup + }% +} \def\etocdepthtag #1#{\Etoc@depthtag } % \etocdepthtag.toc {name} \def\Etoc@depthtag #1{\addtocontents {toc}{\protect\etoc@depthtag {#1}}} +\def\etocimmediatedepthtag #1#{\Etoc@depthtag@immediately } +\def\Etoc@depthtag@immediately #1{% + \begingroup + \let\Etoc@originalwrite\write + \def\write{\immediate\Etoc@originalwrite}% + \addtocontents {toc}{\protect\etoc@depthtag {#1}}% + \endgroup +} \def\etocignoredepthtags {\let\etoc@depthtag \@gobble } \def\etocobeydepthtags {\let\etoc@depthtag \Etoc@depthtag@ } \def\Etoc@depthtag@ #1{\@ifundefined{Etoc@depthof@#1}% @@ -1507,6 +1588,20 @@ {\addtocontents {toc} {\protect\etoc@setlocaltop\expandafter\protect\csname Etoc@#1@@\endcsname}}% }% +\def\etocimmediatesetlocaltop #1#{\Etoc@set@localtop@immediately}% +\def\Etoc@set@localtop@immediately #1{% + \@ifundefined{Etoc@#1@@}% + {\PackageWarning{etoc} + {Unknown sectioning depth #1, \protect\etocimmediatesetlocaltop.toc ignored}}% + {\begingroup + \let\Etoc@originalwrite\write + \def\write{\immediate\Etoc@originalwrite}% + \addtocontents {toc} + {\protect\etoc@setlocaltop\expandafter\protect + \csname Etoc@#1@@\endcsname}% + \endgroup + }% +}% \def\etoc@setlocaltop #1{% \global\let\Etoc@level #1% \Etoc@skipthisonefalse @@ -1539,7 +1634,7 @@ \fi \fi \fi - \Etoc@next{\Etoc@doends\Etoc@dobegins}% + \Etoc@next{\Etoc@doends\Etoc@dobegins\global\Etoc@skipprefixfalse}% }% \addtocontents {toc}{\protect\@ifundefined{etoctocstyle}% {\let\protect\etoc@startlocaltoc\protect\@gobble |