diff options
author | Karl Berry <karl@freefriends.org> | 2019-03-10 21:00:10 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2019-03-10 21:00:10 +0000 |
commit | a72845cd2b20bb3de0abf721035298d0779a7ecd (patch) | |
tree | fcb8eec05141384db5613d7f4f8247f42785b010 /Master/texmf-dist/tex/latex/etoc | |
parent | 2120f9138b95149fb0f94b826587f7f22ea1f859 (diff) |
etoc (10mar19)
git-svn-id: svn://tug.org/texlive/trunk@50317 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/etoc')
-rw-r--r-- | Master/texmf-dist/tex/latex/etoc/etoc.sty | 108 |
1 files changed, 64 insertions, 44 deletions
diff --git a/Master/texmf-dist/tex/latex/etoc/etoc.sty b/Master/texmf-dist/tex/latex/etoc/etoc.sty index 4cb310fe559..20f51125d70 100644 --- a/Master/texmf-dist/tex/latex/etoc/etoc.sty +++ b/Master/texmf-dist/tex/latex/etoc/etoc.sty @@ -23,14 +23,14 @@ %% \NeedsTeXFormat{LaTeX2e} \ProvidesPackage{etoc} - [2018/07/04 v1.08p Completely customisable TOCs (JFB)] + [2019/03/09 v1.09 Completely customisable TOCs (JFB)] %% %% Package: etoc -%% Version: 1.08p-2018/07/04 +%% Version: 1.09-2019/03/09 %% License: LPPL 1.3c -%% Copyright (C) 2012-2018 Jean-Francois Burnol +%% Copyright (C) 2012-2019 Jean-Francois Burnol %% <jfbu at free dot fr> -%% Copyright (C) 2014-2018 Christine Roemer +%% Copyright (C) 2014-2019 Christine Roemer %% <Christine_Roemer at t-online dot de> %% and collaborators for the translation into German of the documentation %% @@ -85,7 +85,6 @@ \chardef\Etoc@@four@@ 4 \chardef\Etoc@@five@@ 5 \chardef\Etoc@@six@@ 6 -%%\let\Etoc@localtop\Etoc@@minustwo@@ % 1.08e does it at each local TOC. \def\Etoc@@minustwo@{minustwo} \def\Etoc@@minusone@{minusone} \def\Etoc@@zero@ {zero} @@ -304,7 +303,7 @@ \ifEtoc@notactive\Etoc@setflags \Etoc@skipthisonetrue \else - \ifnum\Etoc@level<\Etoc@localtop + \unless\ifnum\Etoc@level>\etoclocaltop \Etoc@skipthisonetrue \global\Etoc@stoptoctrue \fi @@ -315,8 +314,7 @@ \let\Etoc@next\Etoc@gobblefourorthree \ifEtoc@skipthisone \else - \ifnum\c@tocdepth<\Etoc@level - \else + \unless\ifnum\c@tocdepth<\Etoc@level \ifEtoc@standard \let\Etoc@next\Etoc@savedcontentsline \else @@ -620,14 +618,15 @@ \def\etoc@@startlocaltoc#1#2{% \ifEtoc@localtoc \ifnum #1=#2\relax - \ifEtoc@jj \global\let\Etoc@localtop\Etoc@@minusone@@ \fi - \ifEtoc@j \global\let\Etoc@localtop\Etoc@@zero@@ \fi - \ifEtoc@ \global\let\Etoc@localtop\Etoc@@one@@ \fi - \ifEtoc@i \global\let\Etoc@localtop\Etoc@@two@@ \fi - \ifEtoc@ii \global\let\Etoc@localtop\Etoc@@three@@ \fi - \ifEtoc@iii \global\let\Etoc@localtop\Etoc@@four@@ \fi - \ifEtoc@iv \global\let\Etoc@localtop\Etoc@@five@@ \fi - \ifEtoc@v \global\let\Etoc@localtop\Etoc@@six@@ \fi + \ifEtoc@jj \global\let\etoclocaltop\Etoc@@minustwo@@\fi + \ifEtoc@j \global\let\etoclocaltop\Etoc@@minusone@@\fi + \ifEtoc@ \global\let\etoclocaltop\Etoc@@zero@@ \fi + \ifEtoc@i \global\let\etoclocaltop\Etoc@@one@@ \fi + \ifEtoc@ii \global\let\etoclocaltop\Etoc@@two@@ \fi + \ifEtoc@iii \global\let\etoclocaltop\Etoc@@three@@ \fi + \ifEtoc@iv \global\let\etoclocaltop\Etoc@@four@@ \fi + \ifEtoc@v \global\let\etoclocaltop\Etoc@@five@@ \fi + \global\c@tocdepth\Etoc@localtocdepth \global\Etoc@notactivefalse \global\Etoc@vfalse \global\Etoc@ivfalse @@ -649,7 +648,7 @@ \ifEtoc@localtoc \def\etoc@startlocaltoc##1{% \ifnum##1=\Etoc@tocid\relax - \global\let\Etoc@localtop\Etoc@level + \global\let\etoclocaltop\Etoc@level \global\Etoc@notactivefalse \fi }% \let\contentsline\Etoc@testingcontentslinelocal @@ -658,7 +657,7 @@ \fi \Etoc@storetocdepth \the\Etoc@toctoks - \Etoc@resettocdepth + \Etoc@restoretocdepth \endgroup } \DeclareRobustCommand*\etocifwasempty @@ -673,9 +672,8 @@ \global\expandafter\let\expandafter\Etoc@level\csname Etoc@#1@@\endcsname \ifEtoc@notactive \else - \ifnum\Etoc@level>\Etoc@localtop - \ifnum\Etoc@level>\c@tocdepth - \else + \ifnum\Etoc@level>\etoclocaltop + \unless\ifnum\Etoc@level>\Etoc@localtocdepth \global\Etoc@emptytocfalse \global\Etoc@stoptoctrue \fi @@ -692,8 +690,7 @@ \else \ifnum\csname Etoc@#1@@\endcsname=\Etoc@@six@@ \else - \ifnum\csname Etoc@#1@@\endcsname>\c@tocdepth - \else + \unless\ifnum\csname Etoc@#1@@\endcsname>\c@tocdepth \global\Etoc@emptytocfalse \global\Etoc@stoptoctrue \fi @@ -702,6 +699,7 @@ \Etoc@gobblefourorthree\relax } \def\Etoc@localtableofcontents#1{% + \gdef\etoclocaltop{-\@m}% \Etoc@localtoctrue \global\Etoc@emptytocfalse \edef\Etoc@tocid{#1}% @@ -710,11 +708,14 @@ \setbox0\hbox{\ref{Unknown toc ref \@secondoftwo#1. Rerun LaTeX}}% %\if@filesw\immediate\write\@mainaux{\noexpand\@tempswatrue}\fi \global\Etoc@stoptoctrue % do only heading + \gdef\etoclocaltop{-\thr@@}% \Etoc@tableofcontents \expandafter\Etoc@gobbletoetoc@ % skip all the rest \fi \global\Etoc@notactivetrue - \ifEtoc@checksemptiness \Etoc@setemptytocbool \fi + \ifEtoc@checksemptiness + \Etoc@setemptytocbool + \fi \ifEtoc@emptytoc \ifEtoc@notactive %\PackageWarning{etoc}{Unknown toc ID \number\Etoc@tocid. Run LaTeX again}% @@ -722,6 +723,7 @@ %\if@filesw\immediate\write\@mainaux{\noexpand\@tempswatrue}\fi \global\Etoc@emptytocfalse % assume real one will be non-empty \global\Etoc@stoptoctrue % and print only heading for this pass + \gdef\etoclocaltop{-\thr@@}% \Etoc@tableofcontents \expandafter\expandafter\expandafter\Etoc@gobbletoetoc@ \else @@ -730,15 +732,16 @@ \else \global\Etoc@stoptocfalse \global\Etoc@notactivetrue - \global\let\Etoc@localtop\Etoc@@minustwo@@ - \edef\etoc@startlocaltoc##1{\noexpand\etoc@@startlocaltoc{##1}{\Etoc@tocid}}% + \edef\etoc@startlocaltoc##1% + {\noexpand\etoc@@startlocaltoc{##1}{\Etoc@tocid}}% \Etoc@tableofcontents \fi \@gobble\etoc@ \endgroup\ifEtoc@mustclosegroup\endgroup\fi \Etoc@tocdepthreset % 1.07h, renamed 1.08h \etocaftertochook % 1.07g -} + \let\Etoc@localtocdepth\c@tocdepth % 1.09 +}% \Etoc@localtableofcontents \def\Etoc@getrefno #1#2\etoc@ {#1} \def\Etoc@getref #1{\@ifundefined{r@#1}{0}{\expandafter\expandafter\expandafter \Etoc@getrefno\csname r@#1\endcsname\relax\etoc@}} @@ -747,6 +750,7 @@ \@firstofone{\def\Etoc@again} {\futurelet\Etoc@nexttoken\Etoc@t@bleofcontents} \def\Etoc@dothis #1#2\etoc@ {\fi #1} \def\Etoc@t@bleofcontents{% + \gdef\etoclocaltop{-\@M}% \ifx\Etoc@nexttoken\label\Etoc@dothis{\expandafter\Etoc@label\@gobble}\fi \ifx\Etoc@nexttoken\@sptoken\Etoc@dothis{\Etoc@again}\fi \ifx\Etoc@nexttoken\ref\Etoc@dothis{\expandafter\Etoc@ref\@gobble}\fi @@ -762,7 +766,7 @@ \Etoc@tocdepthreset % 1.07h, renamed 1.08h \etocaftertochook % 1.07g \@gobble\etoc@ - } + }% \Etoc@t@bleofcontents \def\Etoc@table@fcontents{% \refstepcounter{etoc@tocid}% \Etoc@tocwithidfalse @@ -776,23 +780,31 @@ \let\etocaftercontentshook \@empty \def\etoctableofcontents{% \Etoc@openouttoc - \Etoc@tocdepthset % new with 1.08h + \Etoc@tocdepthset % new with 1.08h (\etocsetnexttocdepth) \begingroup % closed in \Etoc@t@bleofcontents or \Etoc@localtableofcontents \let\tof@begingroup\@empty \let\tof@endgroup \@empty \@ifstar {\def\Etoc@aftertitlehook{}\Etoc@table@fcontents} - {\let\Etoc@aftertitlehook\etocaftertitlehook\Etoc@table@fcontents}} + {\let\Etoc@aftertitlehook\etocaftertitlehook\Etoc@table@fcontents}% +}% \etoctableofcontents \let\tableofcontents\etoctableofcontents \newcommand*\localtableofcontents{% \Etoc@openouttoc - \Etoc@tocdepthset % new with 1.08h + \Etoc@tocdepthset % new with 1.08h (\etocsetnexttocdepth) \begingroup % closed in \Etoc@t@bleofcontents or \Etoc@localtableofcontents \let\tof@begingroup\@empty \let\tof@endgroup \@empty \@ifstar {\def\Etoc@aftertitlehook{}\Etoc@localtable@fcontents} - {\let\Etoc@aftertitlehook\etocaftertitlehook\Etoc@localtable@fcontents}} + {\let\Etoc@aftertitlehook\etocaftertitlehook\Etoc@localtable@fcontents}% +}% \localtableofcontents +\newcommand*\localtableofcontentswithrelativedepth[1]{% + \edef\Etoc@localtocdepth + {\numexpr\noexpand\etoclocaltop+\the\numexpr#1\relax\relax}% + \localtableofcontents +}% \localtableofcontentswithrelativedepth +\let\Etoc@localtocdepth\c@tocdepth \long\def\Etoc@gobbletoetoc@ #1\etoc@ {} \newcommand\etocsettocstyle[2]{% \def\Etoc@tableofcontents @@ -815,12 +827,14 @@ \Etoc@levellist \fi #1% + \Etoc@tocdepthset \ifEtoc@parskip\parskip\z@skip\fi %1.07d \Etoc@aftertitlehook + \gdef\etoclocaltop{-\thr@@}% \Etoc@toctoc \etocaftercontentshook #2\@nobreakfalse % 1.07d: \@nobreakfalse moved here - \Etoc@resettocdepth % 1.07g. moved here from before #2 by 1.08 + \Etoc@restoretocdepth % 1.07g. moved here from before #2 by 1.08 \ifx\Etoc@global\global \ifx\tof@finish\@empty \else @@ -1380,8 +1394,8 @@ \addcontentsline {toc}{#1}{#2}} \DeclareRobustCommand*{\etoctoccontentsline} {\@ifstar{\Etoc@addcontentsline@}{\Etoc@addtocontents}} -\def\Etoc@storetocdepth {\global\c@etoc@tocdepth\c@tocdepth } -\def\Etoc@resettocdepth {\global\c@tocdepth\c@etoc@tocdepth } +\def\Etoc@storetocdepth {\global\c@etoc@tocdepth\c@tocdepth } +\def\Etoc@restoretocdepth {\global\c@tocdepth\c@etoc@tocdepth } \def\etocobeytoctocdepth {\def\etoc@settocdepth {\afterassignment\Etoc@@nottoodeep \global\c@tocdepth}} \def\Etoc@@nottoodeep {\ifnum\c@tocdepth>\c@etoc@tocdepth @@ -1456,13 +1470,21 @@ \@ifundefined{Etoc@#1@@} {\PackageWarning{etoc} {Unknown sectioning unit #1, \protect\etocsetnextocdepth\space ignored}} - {\def\Etoc@tocdepthset - {\edef\Etoc@tocdepthreset {% - \global\c@tocdepth\the\c@tocdepth\space - \global\let\noexpand\Etoc@tocdepthreset\noexpand\@empty }% - \global\c@tocdepth\csname Etoc@#1@@\endcsname - \global\let\Etoc@tocdepthset\@empty}}% + {\Etoc@setnexttocdepth{\csname Etoc@#1@@\endcsname}}% +}% +\def\Etoc@setnexttocdepth#1{% + \def\Etoc@tocdepthset{% + \Etoc@tocdepthreset + \edef\Etoc@tocdepthreset {% + \global\c@tocdepth\the\c@tocdepth\space + \global\let\noexpand\Etoc@tocdepthreset\noexpand\@empty + }% + \global\c@tocdepth#1% + \global\let\Etoc@tocdepthset\@empty + }% }% +\let\Etoc@tocdepthreset\@empty % new 1.08h functioning of \etocsetnexttocdepth +\let\Etoc@tocdepthset \@empty % \def\etocsetlocaltop #1#{\Etoc@set@localtop}% \def\Etoc@set@localtop #1{% \@ifundefined{Etoc@#1@@}% @@ -1484,7 +1506,7 @@ \Etoc@setflags \Etoc@skipthisonetrue \else - \ifnum\Etoc@level<\Etoc@localtop + \unless\ifnum\Etoc@level>\etoclocaltop \Etoc@skipthisonetrue \global\Etoc@stoptoctrue \fi @@ -1517,8 +1539,6 @@ \etocstandarddisplaystyle \etocobeytoctocdepth \etocobeydepthtags -\let\Etoc@tocdepthreset\@empty % new 1.08h functioning of \etocsetnexttocdepth -\let\Etoc@tocdepthset \@empty % \let\etocaftertochook \@empty % public for end user. \let\etocbeforetitlehook \@empty % new with 1.07m \endinput |