summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/etoc
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2013-02-24 22:52:02 +0000
committerKarl Berry <karl@freefriends.org>2013-02-24 22:52:02 +0000
commitc8a9826216b33cc752a7d5f5502bbf565e07d002 (patch)
treebdf0f4acd3bec9fdcffed64075aa80e9dca57d13 /Master/texmf-dist/tex/latex/etoc
parent1bf864481b4d669293f0176fd20de5c60c4bc00f (diff)
etoc (24feb13)
git-svn-id: svn://tug.org/texlive/trunk@29222 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/etoc')
-rw-r--r--Master/texmf-dist/tex/latex/etoc/etoc.sty126
1 files changed, 65 insertions, 61 deletions
diff --git a/Master/texmf-dist/tex/latex/etoc/etoc.sty b/Master/texmf-dist/tex/latex/etoc/etoc.sty
index f5ece10416c..166b4711d04 100644
--- a/Master/texmf-dist/tex/latex/etoc/etoc.sty
+++ b/Master/texmf-dist/tex/latex/etoc/etoc.sty
@@ -22,7 +22,7 @@
%% in the same archive or directory.)
%%
\ProvidesPackage{etoc}
- [2013/02/22 v1.07c easily customizable TOCs (jfB)]
+ [2013/02/24 v1.07d easily customizable TOCs (jfB)]
%%
%% Package `etoc' by Jean-Francois Burnol
%% Copyright (C) 2012, 2013 by Jean-Francois Burnol
@@ -45,6 +45,7 @@
\newif\ifEtoc@v % subparagraph
\newif\ifEtoc@number
\newif\ifEtoc@hyperref
+\newif\ifEtoc@parskip % 1.07d
\newif\ifEtoc@tocwithid
\newif\ifEtoc@standard
\newif\ifEtoc@part
@@ -54,7 +55,6 @@
\newif\ifEtoc@notactive
\newcounter{etoc@tocid}
\newif\ifEtoc@mustclosegroup
-\newif\ifEtoc@tocopenedforwrite
\@ifclassloaded{memoir}{\def\Etoc@minf{-\thr@@}}{\def\Etoc@minf{-\tw@}}
\def\Etoc@@minustwo@@{-\tw@}
\let\Etoc@@minusone@@\m@ne
@@ -171,11 +171,11 @@
\fi
\fi}
\AtBeginDocument{%
+\@ifpackageloaded{parskip}{\Etoc@parskiptrue}{}%
\@ifpackageloaded{hyperref}{\Etoc@hyperreftrue
\def\Etoc@et@hop#1#2#3#4#5{#1{#3}{#4}{#5}#2}%
\long\def\Etoc@gobblesixorfive#1#2#3#4#5#6{}}
- {\Etoc@hyperreffalse
- \def\Etoc@et@hop#1#2#3#4{#1{#3}{#4}#2}%
+ {\def\Etoc@et@hop#1#2#3#4{#1{#3}{#4}#2}%
\long\def\Etoc@gobblesixorfive#1#2#3#4#5{}}%
}
\def\Etoc@swa#1{%
@@ -282,10 +282,10 @@
\Etoc@next
\@firstoftwo{\Etoc@swa{#1}}{\Etoc@swb{#1}}}
\def\Etoc@lxyz #1#2{%
- \@namedef{etoclink }##1{##1}% fall-back if no links
- \@namedef{etocpage }{\leavevmode #2}%
+ \@namedef{etoclink }{\leavevmode}% fall-back
+ \@namedef{etocpage }{\leavevmode #2}% fall-back
\Etoc@getthepage #2\etoc@
- \@namedef{etocname }{\leavevmode #1}%
+ \@namedef{etocname }{\leavevmode #1}% fall-back
\def\etocthename{#1}%
\Etoc@getnb #1\relax\relax\etoc@
\ifEtoc@number\else
@@ -373,18 +373,12 @@
\Etoc@getname ##3\etoc@
\fi}%
\Etoc@getnbr #4\hspace\relax\etoc@}
-\edef\etocpage{\noexpand\protect\expandafter
- \noexpand\csname etocpage \endcsname}
-\edef\etocname{\noexpand\protect\expandafter
- \noexpand\csname etocname \endcsname}
-\edef\etocnumber{\noexpand\protect\expandafter
- \noexpand\csname etocnumber \endcsname}
-\edef\etoclink{\noexpand\protect\expandafter
- \noexpand\csname etoclink \endcsname}
-\@namedef{etocifnumbered }{\ifEtoc@number
- \expandafter\@firstoftwo\else\expandafter\@secondoftwo\fi}
-\edef\etocifnumbered{\noexpand\protect\expandafter\noexpand
- \csname etocifnumbered \endcsname}
+\DeclareRobustCommand*{\etocname} {}
+\DeclareRobustCommand*{\etocnumber}{}
+\DeclareRobustCommand*{\etocpage} {}
+\DeclareRobustCommand*{\etoclink} {}
+\DeclareRobustCommand*{\etocifnumbered}
+ {\ifEtoc@number\expandafter\@firstoftwo\else\expandafter\@secondoftwo\fi}
\def\Etoc@readtoc#1{%
\ifeof #1
\let\Etoc@nextread\@gobble
@@ -398,25 +392,31 @@
\Etoc@nextread{#1}%
}
\IfFileExists{\jobname .toc}
- {{\endlinechar=-1 \makeatletter
- \newread\Etoc@tf
- \openin\Etoc@tf\@filef@und
- \Etoc@readtoc\Etoc@tf
- \closein\Etoc@tf}}{\typeout{No file \jobname .toc.}}
-\def\Etoc@starttoc{%
-\begingroup
-\makeatletter
-\ifEtoc@hyperref
+ {{\endlinechar=-1
+ \makeatletter
+ \newread\Etoc@tf
+ \openin\Etoc@tf\@filef@und
+ \Etoc@readtoc\Etoc@tf
+ \closein\Etoc@tf}}
+ {\typeout{No file \jobname .toc.}}
+\def\Etoc@openouttoc{% formerly \Etoc@starttoc
+%% 1.07d: parskip and \@nobreakfalse stuff moved to \Etoc@tableofcontents
+ \ifEtoc@hyperref
\ifx\hyper@last\@undefined
- \ltx@ifpackageloaded {parskip}{\parskip \z@ }{}%
- \IfFileExists {\jobname .toc}
- {\Hy@WarningNoLine
- {old toc file detected, not used; run LaTeX again (cheers from etoc)}%
- \global\Etoc@toctoks={}}
-{}\fi\fi
-\if@filesw \newwrite \tf@toc
-\immediate \openout \tf@toc \jobname .toc\relax \fi \@nobreakfalse
-\endgroup}
+ \IfFileExists{\jobname .toc}
+ {\Hy@WarningNoLine
+ {old toc file detected, not used; run LaTeX again (cheers from etoc)}%
+ \global\Etoc@toctoks={}%
+ }
+ {}%
+ \fi
+ \fi
+ \if@filesw
+ \newwrite \tf@toc
+ \immediate \openout \tf@toc \jobname .toc\relax
+ \fi
+ \gdef\Etoc@openouttoc{}% 1.07d, rather than using a boolean
+}
\def\Etoc@toctoc{%
\global\Etoc@vfalse
\global\Etoc@ivfalse
@@ -494,7 +494,7 @@
\global\Etoc@stoptocfalse
\global\Etoc@notactivetrue
\Etoc@tableofcontents}%
- \endgroup\ifEtoc@mustclosegroup\expandafter\endgroup\fi}
+ \endgroup\ifEtoc@mustclosegroup\endgroup\fi}
\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@}}
@@ -518,7 +518,7 @@
\global\Etoc@notactivefalse
\Etoc@tableofcontents
\endgroup
- \ifEtoc@mustclosegroup\expandafter\endgroup\fi}%
+ \ifEtoc@mustclosegroup\endgroup\fi}%
\fi
\fi\fi\fi\Etoc@next}
\def\table@fcontents{%
@@ -534,38 +534,42 @@
\newcommand*\etocaftertitlehook{}
\newcommand*\etocaftercontentshook{}
\renewcommand*\tableofcontents{%
- \ifEtoc@tocopenedforwrite\else\Etoc@starttoc\fi
- \global\Etoc@tocopenedforwritetrue
- \Etoc@par\begingroup
- \def\etoc@startlocaltoc##1{\etoc@@startlocaltoc{##1}{\c@etoc@tocid}}%
- \@ifstar
- {\def\Etoc@aftertitlehook{}\table@fcontents}
- {\let\Etoc@aftertitlehook\etocaftertitlehook\table@fcontents}}
+ \Etoc@openouttoc
+ \Etoc@par
+ \begingroup % closed in \Etoc@t@bleofcontents or \Etoc@localtableofcontents
+ \def\etoc@startlocaltoc##1{\etoc@@startlocaltoc{##1}{\c@etoc@tocid}}%
+ \@ifstar
+ {\def\Etoc@aftertitlehook{}\table@fcontents}
+ {\let\Etoc@aftertitlehook\etocaftertitlehook\table@fcontents}}
\newcommand*\localtableofcontents{%
- \ifEtoc@tocopenedforwrite\else\Etoc@starttoc\fi
- \global\Etoc@tocopenedforwritetrue
- \Etoc@par\begingroup\@ifstar
- {\def\Etoc@aftertitlehook{}\localtable@fcontents}
- {\let\Etoc@aftertitlehook\etocaftertitlehook\localtable@fcontents}}
+ \Etoc@openouttoc
+ \Etoc@par
+ \begingroup % closed in \Etoc@t@bleofcontents or \Etoc@localtableofcontents
+ \@ifstar
+ {\def\Etoc@aftertitlehook{}\localtable@fcontents}
+ {\let\Etoc@aftertitlehook\etocaftertitlehook\localtable@fcontents}}
\newcommand\etocsettocstyle[2]{%
\def\Etoc@tableofcontents
-{\ifnum\c@tocdepth>\Etoc@minf\let\Etoc@@next\@firstofone\else
-\let\Etoc@@next\@gobble\fi
-\Etoc@@next{#1\Etoc@aftertitlehook
+{\ifnum\c@tocdepth>\Etoc@minf
+ \let\Etoc@@next\@firstofone\else
+ \let\Etoc@@next\@gobble
+\fi
+\Etoc@@next{#1\ifEtoc@parskip\parskip\z@skip\fi %1.07d
+ \Etoc@aftertitlehook
\let\Etoc@savedcontentsline\contentsline
\let\contentsline\Etoc@etoccontentsline
\Etoc@toctoc
- \let\Etoc@n@xt\relax
+ \let\Etoc@@next\relax
\ifEtoc@tocwithid\else
\ifEtoc@localtoc
\ifEtoc@notactive
- \def\Etoc@n@xt{\Etoc@localtocfalse
- \global\Etoc@notactivefalse
- \Etoc@toctoc}%
- \fi\fi\fi
- \Etoc@n@xt
+ \def\Etoc@@next{\Etoc@localtocfalse
+ \global\Etoc@notactivefalse
+ \Etoc@toctoc}%
+ \fi\fi\fi
+ \Etoc@@next
\etocaftercontentshook
- #2}}}
+ #2\@nobreakfalse}}} % 1.07d: \@nobreakfalse moved here
\newcommand*\etocsetstyle{\Etoc@standardfalse\etoc@setstyle}
\long\def\etoc@setstyle#1#2#3#4#5{%
\long\expandafter\def