summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/tableof/tableof.sty
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2012-12-15 00:26:47 +0000
committerKarl Berry <karl@freefriends.org>2012-12-15 00:26:47 +0000
commit6c2053928d978eb2ece483b2b88ae89d5a5353be (patch)
treed9077f696001a83dfba0fd69301e372a17b05597 /Master/texmf-dist/tex/latex/tableof/tableof.sty
parentf578adf9b821e3531047240f907fb16c2af2d923 (diff)
tableof (14dec12)
git-svn-id: svn://tug.org/texlive/trunk@28534 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/tableof/tableof.sty')
-rw-r--r--Master/texmf-dist/tex/latex/tableof/tableof.sty145
1 files changed, 84 insertions, 61 deletions
diff --git a/Master/texmf-dist/tex/latex/tableof/tableof.sty b/Master/texmf-dist/tex/latex/tableof/tableof.sty
index c88ab65716a..196296f9569 100644
--- a/Master/texmf-dist/tex/latex/tableof/tableof.sty
+++ b/Master/texmf-dist/tex/latex/tableof/tableof.sty
@@ -22,7 +22,7 @@
%% in the same archive or directory.)
%%
\ProvidesPackage{tableof}
- [2012/12/06 v1.0 tables of tagged contents (jfB)]
+ [2012/12/13 v1.1 tables of tagged contents (jfB)]
%%
%% Package `tableof' by Jean-Francois Burnol
%% Copyright (C) 2012 by Jean-Francois Burnol
@@ -43,93 +43,116 @@
\fi
\tof@nextread{#1}}
\IfFileExists{\jobname .toc}
- {{\endlinechar=-1 \makeatletter
+ {{% \endlinechar-1
+ \makeatletter
\newread\tof@tf
\openin\tof@tf\@filef@und
\tof@readtoc\tof@tf
\closein\tof@tf}}{}
\AtBeginDocument{
-\@ifpackageloaded{hyperref}
- {\def\tof@gobblethree@orfour#1#2#3#4{}%
- \ifx\hyper@last\@undefined\tof@toctoks{}\fi}
- {\def\tof@gobblethree@orfour#1#2#3{}}}
+ \addtocontents{toc}{\string\@ifundefined\string{tof@begin\string}}
+ \addtocontents{toc}{\string{\let\string\tof@begin\string\relax%
+ \string\let\string\tof@finish\string\relax%
+ \string\let\string\tof@starttags\string\@gobble%
+ \string\let\string\tof@stoptags\string\@gobble%
+ \string\let\string\tof@tagthis\string\@gobble%
+ \string\let\string\tof@untagthis\string\@gobble\string}\string{\string}}
+ \addtocontents{toc}{\string\tof@begin}
+ \@ifpackageloaded{hyperref}
+ {\def\tof@gobblethree@orfour#1#2#3#4{}%
+ \ifx\hyper@last\@undefined\tof@toctoks{}\fi}
+ {\def\tof@gobblethree@orfour#1#2#3{}}}
+\AtEndDocument{\addtocontents{toc}{\string\tof@finish}}
+\newcommand\tofOpenTocFileForWrite{%
+\expandafter\newwrite \csname tf@toc\endcsname
+\immediate \openout \csname tf@toc\endcsname \jobname .toc\relax}
\def\tof@tags{}
\def\tof@tags@tmp{}
\def\tof@untags@tmp{}
-\def\tof@true#1{\expandafter\let\csname if@tof#1.\endcsname\iftrue}
-\def\tof@false#1{\expandafter\let\csname if@tof#1.\endcsname\iffalse}
-\def\tof@secondiftrue#1{\csname if@tof#1.\endcsname
+\def\tof@true#1{\expandafter\let\csname tofsw@#1\endcsname\iftrue}
+\def\tof@false#1{\expandafter\let\csname tofsw@#1\endcsname\iffalse}
+\def\tof@secondiftrue#1{\csname tofsw@#1\endcsname
\let\tof@next\@secondoftwo\fi}
-\def\tof@secondiffalse#1{\csname if@tof#1.\endcsname\else
+\def\tof@secondiffalse#1{\csname tofsw@#1\endcsname\else
\let\tof@next\@secondoftwo\fi}
-\def\tof@setflags#1{%
- \let\tof@next\@firstoftwo
+\def\tof@setflags#1{\let\tof@next\@firstoftwo
\@for\@tempa:=#1\do{\tof@true{\@tempa}}%
\@for\@tempa:=\tof@tags\do{\tof@false{\@tempa}}%
\@for\@tempa:=\tof@tags@tmp\do{\tof@false{\@tempa}}%
- \@for\@tempa:=\tof@untags@tmp\do{\tof@true{\@tempa}}%
- \def\tof@tags@tmp{}\def\tof@untags@tmp{}}
-\def\tof@and#1{%
- \def\contentsline{%
- \tof@setflags{#1}%
- \@for\@tempa:=#1\do{\tof@secondiftrue{\@tempa}}%
- \tof@next\tof@savedcontentsline\tof@gobblethree@orfour}
- \the\tof@toctoks
- \endgroup}
-\def\tof@or#1{%
- \def\contentsline{%
- \tof@setflags{#1}%
- \@for\@tempa:=#1\do{\tof@secondiffalse{\@tempa}}%
- \tof@next\tof@gobblethree@orfour\tof@savedcontentsline}
- \the\tof@toctoks
- \endgroup}
-\def\tof@nor#1{%
- \def\contentsline{%
- \tof@setflags{#1}%
- \@for\@tempa:=#1\do{\tof@secondiffalse{\@tempa}}%
- \tof@next\tof@savedcontentsline\tof@gobblethree@orfour}
- \the\tof@toctoks
- \endgroup}
-\def\tof@nand#1{%
- \def\contentsline{%
- \tof@setflags{#1}%
- \@for\@tempa:=#1\do{\tof@secondiftrue{\@tempa}}%
- \tof@next\tof@gobblethree@orfour\tof@savedcontentsline}
- \the\tof@toctoks
- \endgroup}
+ \@for\@tempa:=\tof@untags@tmp\do{\tof@true{\@tempa}}}
\def\tof@filter#1#2{\ifx#1#2\else
\ifx\tof@tmptags\@empty\edef\tof@tmptags{#2}\else
\edef\tof@tmptags{\tof@tmptags,#2}\fi\fi}
-\def\tof@@start#1{%
+\def\tof@@starttags#1{%
\ifx\tof@tags\@empty\edef\tof@tags{#1}\else
\edef\tof@tags{\tof@tags,#1}\fi}
-\def\tof@@stop#1{%
+\def\tof@@stoptags#1{%
\@for\@tempa:=#1\do{\def\tof@tmptags{}%
\@for\@tempb:=\tof@tags\do{\tof@filter\@tempa\@tempb}%
\edef\tof@tags{\tof@tmptags}}}
-\let\tof@start\@gobble
-\let\tof@stop\@gobble
-\let\tof@tagthis\@gobble
-\let\tof@untagthis\@gobble
-\def\tof@init{\begingroup
- \let\tof@savedcontentsline\contentsline
- \let\tof@start\tof@@start
- \let\tof@stop\tof@@stop
- \def\tof@tagthis##1{\def\tof@tags@tmp{##1}}%
- \def\tof@untagthis##1{\def\tof@untags@tmp{##1}}}
-\newcommand\tableof{\tof@init\@ifstar{\tof@or}{\tof@and}}
-\newcommand\tablenotof{\tof@init\@ifstar{\tof@nand}{\tof@nor}}
+\def\tof@init#1{%
+ \def\tof@begin{%
+ \begingroup
+ \let\tof@finish\endgroup
+ \let\tof@savedcontentsline\contentsline
+ \let\tof@starttags\tof@@starttags
+ \let\tof@stoptags\tof@@stoptags
+ \def\tof@tagthis####1{\def\tof@tags@tmp{####1}}%
+ \def\tof@untagthis####1{\def\tof@untags@tmp{####1}}%
+ \def\contentsline{#1}}}
+\def\tof@and#1{%
+ \tof@init{\tof@setflags{#1}\def\tof@tags@tmp{}\def\tof@untags@tmp{}%
+ \@for\@tempa:=#1\do{\tof@secondiftrue{\@tempa}}%
+ \tof@next\tof@savedcontentsline\tof@gobblethree@orfour}%
+ \the\tof@toctoks}
+\def\tof@or#1{%
+ \tof@init{\tof@setflags{#1}\def\tof@tags@tmp{}\def\tof@untags@tmp{}%
+ \@for\@tempa:=#1\do{\tof@secondiffalse{\@tempa}}%
+ \tof@next\tof@gobblethree@orfour\tof@savedcontentsline}%
+ \the\tof@toctoks}
+\def\tof@nor#1{%
+ \tof@init{\tof@setflags{#1}\def\tof@tags@tmp{}\def\tof@untags@tmp{}%
+ \@for\@tempa:=#1\do{\tof@secondiffalse{\@tempa}}%
+ \tof@next\tof@savedcontentsline\tof@gobblethree@orfour}%
+ \the\tof@toctoks}
+\def\tof@nand#1{%
+ \tof@init{\tof@setflags{#1}\def\tof@tags@tmp{}\def\tof@untags@tmp{}%
+ \@for\@tempa:=#1\do{\tof@secondiftrue{\@tempa}}%
+ \tof@next\tof@gobblethree@orfour\tof@savedcontentsline}%
+ \the\tof@toctoks}
+\newcommand\nexttocwithtags{\@ifstar{\tof@nextof@or}{\tof@nextof@and}}
+\def\tof@nextof@or#1{\toks\z@{\tof@setflags{#1}%
+ \@for\@tempa:=#1\do{\tof@secondiffalse{\@tempa}}%
+ \tof@next
+ {\def\tof@tags@tmp{}\def\tof@untags@tmp{}\tof@gobblethree@orfour}}%
+ \@ifstar{\tof@nextof@nand}{\tof@nextof@nor}}
+\def\tof@nextof@and#1{\toks\z@{\tof@setflags{#1}%
+ \@for\@tempa:=#1\do{\tof@secondiftrue{\@tempa}}%
+ \tof@next\@secondoftwo\@firstoftwo
+ {\def\tof@tags@tmp{}\def\tof@untags@tmp{}\tof@gobblethree@orfour}}%
+ \@ifstar{\tof@nextof@nand}{\tof@nextof@nor}}
+\def\tof@nextof@nor#1{%
+ \toks\z@\expandafter{\the\toks\z@
+ {\tof@setflags{#1}\def\tof@tags@tmp{}\def\tof@untags@tmp{}%
+ \@for\@tempa:=#1\do{\tof@secondiffalse{\@tempa}}%
+ \tof@next\tof@savedcontentsline\tof@gobblethree@orfour}}%
+ \expandafter\tof@init\expandafter{\the\toks\z@}}
+\def\tof@nextof@nand#1{%
+ \toks\z@\expandafter{\the\toks\z@
+ {\tof@setflags{#1}\def\tof@tags@tmp{}\def\tof@untags@tmp{}%
+ \@for\@tempa:=#1\do{\tof@secondiftrue{\@tempa}}%
+ \tof@next\tof@gobblethree@orfour\tof@savedcontentsline}}%
+ \expandafter\tof@init\expandafter{\the\toks\z@}}
+\newcommand\tableof{\@ifstar{\tof@or}{\tof@and}}
+\newcommand\tablenotof{\@ifstar{\tof@nand}{\tof@nor}}
\newcommand*\toftagthis[1]{\addtocontents{toc}
{\string\tof@tagthis\string{#1\string}}}
\newcommand*\tofuntagthis[1]{\addtocontents{toc}
{\string\tof@untagthis\string{#1\string}}}
\newcommand*\toftagstart[1]{\addtocontents{toc}
- {\string\tof@start\string{#1\string}}}
+ {\string\tof@starttags\string{#1\string}}}
\newcommand*\toftagstop[1]{\addtocontents{toc}
- {\string\tof@stop\string{#1\string}}}
-\newcommand\tofOpenTocFileForWrite{%
-\expandafter\newwrite \csname tf@toc\endcsname
-\immediate \openout \csname tf@toc\endcsname \jobname .toc\relax}
+ {\string\tof@stoptags\string{#1\string}}}
\endinput
%%
%% End of file `tableof.sty'.