From 6786e1175d7ca2cad33e03d7bdf74cfb5cc87e13 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Thu, 29 Sep 2016 20:34:36 +0000 Subject: overlays (29sep16) git-svn-id: svn://tug.org/texlive/trunk@42182 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/tex/latex/etoc/etoc.sty | 175 ++++++++++++++---------------- 1 file changed, 83 insertions(+), 92 deletions(-) (limited to 'Master/texmf-dist/tex/latex') diff --git a/Master/texmf-dist/tex/latex/etoc/etoc.sty b/Master/texmf-dist/tex/latex/etoc/etoc.sty index cb369569476..7ccfa626511 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} - [2016/09/25 v1.08h Completely customisable TOCs (JFB)] + [2016/09/29 v1.08i Completely customisable TOCs (JFB)] %% %% Package: etoc -%% Version: 1.08h-2016/09/25 +%% Version: 1.08i-2016/09/29 %% License: LPPL 1.3c %% Copyright (C) 2012-2016 Jean-Francois Burnol %% @@ -67,9 +67,10 @@ \newif\ifEtoc@mustclosegroup \newif\ifEtoc@emptytoc % 1.08e \newif\ifEtoc@checksemptiness % 1.08e. Default is 'no checks'. -\newcommand*\etocchecksemptiness {\Etoc@checksemptinesstrue } +\def\etocchecksemptiness {\Etoc@checksemptinesstrue } +\def\etocdoesnotcheckemptiness {\Etoc@checksemptinessfalse }% 1.08i \newif\ifEtoc@notocifnotoc % 1.08e -\newcommand*\etocnotocifnotoc {\Etoc@checksemptinesstrue\Etoc@notocifnotoctrue } +\def\etocnotocifnotoc {\Etoc@checksemptinesstrue\Etoc@notocifnotoctrue } \def\etoc@{\etoc@} \newcounter{etoc@tocid} \newcounter{etoc@tocdepth}% 1.07g @@ -155,9 +156,9 @@ \@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@gobblesixorfive#1#2#3#4#5#6{}} + \long\def\Etoc@gobblefourorthree#1#2#3#4{}} {\def\Etoc@et@hop#1#2#3#4{#2{#3}{#4}#1}% - \long\def\Etoc@gobblesixorfive#1#2#3#4#5{}}% + \long\def\Etoc@gobblefourorthree#1#2#3{}}% } \def\Etoc@setflags {% \ifcase \Etoc@level @@ -239,32 +240,33 @@ \def\Etoc@etoccontentsline #1{% \global\expandafter\let\expandafter\Etoc@level\csname Etoc@#1@@\endcsname \Etoc@skipthisonefalse - \ifnum\Etoc@level=\Etoc@@six@@ - \Etoc@skipthisonetrue + \ifnum\Etoc@level=\Etoc@@six@@\Etoc@skipthisonetrue \else - \ifEtoc@localtoc - \let\Etoc@next\relax - \ifEtoc@stoptoc - \Etoc@skipthisonetrue - \fi - \ifnum\Etoc@level<\Etoc@localtop - \def\Etoc@next{\global\Etoc@stoptoctrue}% - \Etoc@skipthisonetrue - \fi - \ifEtoc@notactive - \def\Etoc@next{\Etoc@setflags}% - \Etoc@skipthisonetrue + \ifEtoc@localtoc + \ifEtoc@stoptoc\Etoc@skipthisonetrue + \else + \ifEtoc@notactive\Etoc@setflags\Etoc@skipthisonetrue + \else + \ifnum\Etoc@level<\Etoc@localtop\Etoc@skipthisonetrue + \global\Etoc@stoptoctrue \fi - \Etoc@next + \fi \fi + \fi \fi - \let\Etoc@next\Etoc@gobblesixorfive - \ifnum\c@tocdepth<\Etoc@level - \else - \ifEtoc@skipthisone - \else - \ifEtoc@standard\let\Etoc@next\@thirdofthree - \else + \let\Etoc@next\Etoc@gobblefourorthree + \ifEtoc@skipthisone\else + \ifnum\c@tocdepth<\Etoc@level\else + \ifEtoc@standard + \let\Etoc@next\Etoc@savedcontentsline + \else + \let\Etoc@next\Etoc@etoccontentsline@ + \fi + \fi + \fi + \Etoc@next {#1}% +} +\def\Etoc@etoccontentsline@ #1{% \Etoc@doends \let\Etoc@next\@empty \Etoc@global\Etoc@isfirstfalse @@ -289,16 +291,13 @@ \fi \Etoc@setflags \Etoc@next - \let\Etoc@next\@empty - \Etoc@global\expandafter\def\expandafter\Etoc@prefix\expandafter - {\csname Etoc@prefix@\csname Etoc@#1@\endcsname\endcsname }% - \Etoc@global\expandafter\def\expandafter\Etoc@contents\expandafter - {\csname Etoc@contents@\csname Etoc@#1@\endcsname\endcsname }% + \Etoc@global\edef\Etoc@prefix {\expandafter\noexpand + \csname Etoc@prefix@\csname Etoc@#1@\endcsname\endcsname }% + \Etoc@global\edef\Etoc@contents{\expandafter\noexpand + \csname Etoc@contents@\csname Etoc@#1@\endcsname\endcsname }% \ifEtoc@skipprefix \Etoc@global\let\Etoc@prefix\@empty\fi \global\Etoc@skipprefixfalse - \fi\fi\fi - \Etoc@next - \Etoc@et@hop{\Etoc@prefix\Etoc@contents}{\Etoc@savedcontentsline{#1}}% + \Etoc@et@hop{\Etoc@prefix\Etoc@contents}{\Etoc@savedcontentsline{#1}}% } \def\Etoc@lxyz #1#2{% \Etoc@global\@namedef {etoclink }{\leavevmode}% fall-back @@ -522,18 +521,22 @@ } \let\etoc@startlocaltoc\@gobble \def\Etoc@setemptytocbool {% - \global\Etoc@stoptocfalse \global\Etoc@emptytoctrue + \global\Etoc@stoptocfalse \global\let\Etoc@level\Etoc@minf \begingroup - \def\etoc@startlocaltoc##1{% + \ifEtoc@localtoc + \def\etoc@startlocaltoc##1{% \ifnum##1=\Etoc@tocid\relax \global\let\Etoc@localtop\Etoc@level \global\Etoc@notactivefalse \fi }% - \let\contentsline\Etoc@testingcontentsline + \let\contentsline\Etoc@testingcontentslinelocal + \else + \let\contentsline\Etoc@testingcontentsline + \fi \Etoc@storetocdepth - \the\Etoc@toctoks + \the\Etoc@toctoks \Etoc@resettocdepth \endgroup } @@ -541,31 +544,40 @@ {\ifEtoc@emptytoc\expandafter\@firstoftwo\else\expandafter\@secondoftwo\fi } \expandafter \let\expandafter\etocxifwasempty\csname etocifwasempty \endcsname -\def\Etoc@testingcontentsline #1{% - \ifEtoc@stoptoc - \else - \ifnum\csname Etoc@#1@@\endcsname=\Etoc@@six@@ - \else +\def\Etoc@testingcontentslinelocal #1{% + \ifEtoc@stoptoc\else\ifnum\csname Etoc@#1@@\endcsname=\Etoc@@six@@\else \global\expandafter\let\expandafter\Etoc@level\csname Etoc@#1@@\endcsname - \ifEtoc@notactive - \else - \ifnum\Etoc@level>\c@tocdepth - \else + \ifEtoc@notactive\else + \ifnum\Etoc@level>\Etoc@localtop + \ifnum\Etoc@level>\c@tocdepth\else + \global\Etoc@emptytocfalse + \global\Etoc@stoptoctrue + \fi + \else \global\Etoc@stoptoctrue - \ifnum\Etoc@level>\Etoc@localtop\global\Etoc@emptytocfalse\fi - \fi\fi + \fi + \fi \fi\fi - \Etoc@gobblesixorfive\relax\relax\relax + \Etoc@gobblefourorthree\relax +} +\def\Etoc@testingcontentsline #1{% + \ifEtoc@stoptoc\else + \ifnum\csname Etoc@#1@@\endcsname=\Etoc@@six@@\else + \ifnum\csname Etoc@#1@@\endcsname>\c@tocdepth\else + \global\Etoc@emptytocfalse + \global\Etoc@stoptoctrue + \fi\fi\fi + \Etoc@gobblefourorthree\relax } \def\Etoc@localtableofcontents#1{% - \edef\Etoc@tocid{#1}% + \Etoc@localtoctrue \global\Etoc@emptytocfalse + \edef\Etoc@tocid{#1}% \ifnum\Etoc@tocid<\@ne - \PackageWarning{etoc}{Unknown toc reference \@secondoftwo#1. Run LaTeX again}% - % versions < 1.08e did not do any printing, 1.08e prints the toc heading. - \global\Etoc@notactivetrue + %\PackageWarning{etoc}{Unknown toc reference \@secondoftwo#1. Run LaTeX again}% + \setbox0\hbox{\ref{etoc-ref \@secondoftwo#1: run LaTeX again!}}% + %\if@filesw\immediate\write\@mainaux{\noexpand\@tempswatrue}\fi \global\Etoc@stoptoctrue % do only heading - \Etoc@localtoctrue % needed for stoptoc obedience \Etoc@tableofcontents \expandafter\Etoc@gobbletoetoc@ % skip all the rest \fi @@ -573,18 +585,17 @@ \ifEtoc@checksemptiness \Etoc@setemptytocbool \fi \ifEtoc@emptytoc \ifEtoc@notactive - \PackageWarning{etoc}{Unknown toc ID \number\Etoc@tocid. Run LaTeX again}% - % emptiness undecided. Declare it non empty. - \global\Etoc@emptytocfalse - \global\Etoc@stoptoctrue % do only heading - \Etoc@localtoctrue + %\PackageWarning{etoc}{Unknown toc ID \number\Etoc@tocid. Run LaTeX again}% + \setbox0\hbox{\ref{etoc-id \number\Etoc@tocid: run LaTeX again!}}% + %\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 \Etoc@tableofcontents \expandafter\expandafter\expandafter\Etoc@gobbletoetoc@ \else %% \PackageWarning{etoc}{This toc is apparently empty}% \fi \else - \Etoc@localtoctrue \global\Etoc@stoptocfalse \global\Etoc@notactivetrue \global\let\Etoc@localtop\Etoc@@minustwo@@ @@ -604,34 +615,15 @@ \@firstofone{\def\Etoc@again} {\futurelet\Etoc@nexttoken\Etoc@t@bleofcontents} \def\Etoc@dothis #1#2\etoc@ {\fi #1} \def\Etoc@t@bleofcontents{% - \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{\Etoc@tocwithidfalse\expandafter\Etoc@ref\@gobble}% - \fi - \ifEtoc@tocwithid - \Etoc@dothis{\Etoc@localtableofcontents{\c@etoc@tocid}}% - \fi - \global\Etoc@notactivefalse - \global\Etoc@emptytocfalse - \ifEtoc@checksemptiness - \let\Etoc@tocid\z@ - \global\let\Etoc@localtop\Etoc@minf - \Etoc@setemptytocbool - \fi - \ifEtoc@emptytoc - \ifEtoc@notocifnotoc\else - \Etoc@localtocfalse - \Etoc@tableofcontents - \fi - \else - \Etoc@localtocfalse - \Etoc@tableofcontents - \fi + \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 + \ifEtoc@tocwithid\Etoc@dothis{\Etoc@localtableofcontents{\c@etoc@tocid}}\fi + \global\Etoc@emptytocfalse\ifEtoc@checksemptiness\Etoc@setemptytocbool\fi + \ifEtoc@emptytoc\ifEtoc@notocifnotoc + \expandafter\expandafter\expandafter\@gobble + \fi\fi + \Etoc@tableofcontents \endgroup\ifEtoc@mustclosegroup\endgroup\fi \Etoc@tocdepthreset % 1.07h, renamed 1.08h \etocaftertochook % 1.07g @@ -654,7 +646,6 @@ \begingroup % closed in \Etoc@t@bleofcontents or \Etoc@localtableofcontents \let\tof@begingroup\@empty \let\tof@endgroup \@empty - \def\etoc@startlocaltoc##1{\etoc@@startlocaltoc{##1}{\c@etoc@tocid}}% \@ifstar {\def\Etoc@aftertitlehook{}\Etoc@table@fcontents} {\let\Etoc@aftertitlehook\etocaftertitlehook\Etoc@table@fcontents}} -- cgit v1.2.3