diff options
Diffstat (limited to 'Master/texmf-dist/tex/latex/tableof/tableof.sty')
-rw-r--r-- | Master/texmf-dist/tex/latex/tableof/tableof.sty | 145 |
1 files changed, 77 insertions, 68 deletions
diff --git a/Master/texmf-dist/tex/latex/tableof/tableof.sty b/Master/texmf-dist/tex/latex/tableof/tableof.sty index 0a3723f9327..73d4b1a944f 100644 --- a/Master/texmf-dist/tex/latex/tableof/tableof.sty +++ b/Master/texmf-dist/tex/latex/tableof/tableof.sty @@ -22,41 +22,41 @@ %% in the same archive or directory.) %% \ProvidesPackage{tableof} - [2013/03/04 v1.2 tables of tagged contents (jfB)] + [2015/02/11 v1.3 Tables of tagged contents (jfB)] %% -%% Package `tableof' by Jean-Francois Burnol -%% Copyright (C) 2012,2013 by Jean-Francois Burnol +%% Package: tableof +%% Version: 1.3 (2015/02/11) +%% License: LPPL 1.3c +%% Copyright (C) 2012-2015 Jean-Francois Burnol <jfbu at free dot fr> %% \NeedsTeXFormat{LaTeX2e} \DeclareOption*{\PackageWarning{tableof}{Option `\CurrentOption' is unknown.}} \ProcessOptions\relax \newtoks\tof@toctoks -\def\tof@readtoc#1{% - \ifeof #1 - \let\tof@nextread\@gobble - \global\tof@toctoks\expandafter{\the\tof@toctoks}% +\def\tof@readtoc {% + \ifeof \tof@tf \else - \let\tof@nextread\tof@readtoc - \read #1 to \tof@buffer + \read\tof@tf to \tof@buffer \tof@toctoks\expandafter\expandafter\expandafter {\expandafter\the\expandafter\tof@toctoks\tof@buffer}% - \fi - \tof@nextread{#1}} -\IfFileExists{\jobname .toc} - {{% \endlinechar-1 + \expandafter\tof@readtoc + \fi } +\AtBeginDocument{\IfFileExists{\jobname.toc} + {{\endlinechar-1 \makeatletter \newread\tof@tf \openin\tof@tf\@filef@und - \tof@readtoc\tof@tf - \closein\tof@tf}}{} + \tof@readtoc + \global\tof@toctoks=\expandafter{\the\tof@toctoks}% + \closein\tof@tf}}{}} \AtBeginDocument{ - \addtocontents{toc}{\string\@ifundefined{tof@begin}} - \addtocontents{toc}{{\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}{}} + \addtocontents{toc}{\string\@ifundefined{tof@begin}% + {\let\string\tof@begin\relax + \let\string\tof@finish\relax + \let\string\tof@starttags\string\@gobble + \let\string\tof@stoptags\string\@gobble + \let\string\tof@tagthis\string\@gobble + \let\string\tof@untagthis\string\@gobble}{}} \addtocontents{toc}{\string\tof@begin} \@ifpackageloaded{hyperref} {\def\tof@gobblethree@orfour#1#2#3#4{}% @@ -66,22 +66,22 @@ \newcommand\tofOpenTocFileForWrite{% \if@filesw \newwrite \tf@toc - \immediate \openout \tf@toc \jobname .toc\relax + \immediate \openout \tf@toc \jobname.toc\relax \fi} \def\tof@tags{} \def\tof@tags@tmp{} \def\tof@untags@tmp{} -\def\tof@true#1{\expandafter\let\csname tofsw@#1\endcsname\iftrue} +\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 tofsw@#1\endcsname\else - \let\tof@next\@secondoftwo\fi} -\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@secondiftrue#1% + {\csname tofsw@#1\endcsname \let\tof@next\@secondoftwo\fi} +\def\tof@secondiffalse#1% + {\csname tofsw@#1\endcsname\else\let\tof@next\@secondoftwo\fi} +\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@filter#1#2{\ifx#1#2\else \ifx\tof@tmptags\@empty\edef\tof@tmptags{#2}\else \edef\tof@tmptags{\tof@tmptags,#2}\fi\fi} @@ -99,67 +99,76 @@ \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{% + \def\tof@tagthis ####1{\def\tof@tags@tmp{####1}}% + \def\tof@untagthis ####1{\def\tof@untags@tmp{####1}}% + \def\contentsline {#1}}} +\def\tof@zapspaces #1 #2{#1#2\tof@zapspaces }% +\def\tof@cleanspaces #1#2{\edef\tof@tmp {{\tof@zapspaces #2 \@gobble}}% + \expandafter #1\tof@tmp } +\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{% + \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{% + \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{% + \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*\tableof{\@ifstar{\tof@or}{\tof@and}} -\newcommand*\tablenotof{\@ifstar{\tof@nand}{\tof@nor}} -\def\tof@nextof@or#1{\toks\z@{\tof@setflags{#1}% + \the\tof@toctoks } +\newcommand*\tableof{\@ifstar{\tof@cleanspaces\tof@or} + {\tof@cleanspaces\tof@and}} +\newcommand*\tablenotof{\@ifstar{\tof@cleanspaces\tof@nand} + {\tof@cleanspaces\tof@nor}} +\def\tof@nextof@or #1{\toks@{\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}% + \@ifstar{\tof@cleanspaces\tof@nextof@nand} + {\tof@cleanspaces\tof@nextof@nor}} +\def\tof@nextof@and #1{\toks@{\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@ + \@ifstar{\tof@cleanspaces\tof@nextof@nand} + {\tof@cleanspaces\tof@nextof@nor}} +\def\tof@nextof@nor #1{% + \toks@\expandafter{\the\toks@ {\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@}% - \tof@printtoc} -\def\tof@nextof@nand#1{% - \toks\z@\expandafter{\the\toks\z@ + \expandafter\tof@init\expandafter{\the\toks@}% + \tof@printtoc } +\def\tof@nextof@nand #1{% + \toks@\expandafter{\the\toks@ {\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@}% - \tof@printtoc} + \expandafter\tof@init\expandafter{\the\toks@}% + \tof@printtoc } \newcommand*{\nexttocwithtags}{\let\tof@printtoc\relax - \@ifstar{\tof@nextof@or}{\tof@nextof@and}} + \@ifstar{\tof@cleanspaces\tof@nextof@or} + {\tof@cleanspaces\tof@nextof@and}} \newcommand*{\tableoftaggedcontents}{\def\tof@printtoc{\the\tof@toctoks}% - \@ifstar{\tof@nextof@or}{\tof@nextof@and}} -\newcommand*\toftagthis[1]{\addtocontents{toc} - {\string\tof@tagthis{#1}}} -\newcommand*\tofuntagthis[1]{\addtocontents{toc} - {\string\tof@untagthis{#1}}} -\newcommand*\toftagstart[1]{\addtocontents{toc} - {\string\tof@starttags{#1}}} -\newcommand*\toftagstop[1]{\addtocontents{toc} - {\string\tof@stoptags{#1}}} + \@ifstar{\tof@cleanspaces\tof@nextof@or} + {\tof@cleanspaces\tof@nextof@and}} +\newcommand*\toftagthis[1] + {\addtocontents{toc}{\string\tof@tagthis {\tof@zapspaces #1 \@gobble }}} +\newcommand*\tofuntagthis[1] + {\addtocontents{toc}{\string\tof@untagthis{\tof@zapspaces #1 \@gobble }}} +\newcommand*\toftagstart[1] + {\addtocontents{toc}{\string\tof@starttags{\tof@zapspaces #1 \@gobble }}} +\newcommand*\toftagstop[1] + {\addtocontents{toc}{\string\tof@stoptags {\tof@zapspaces #1 \@gobble }}} \endinput %% %% End of file `tableof.sty'. |