summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/tableof/tableof.sty
blob: c88ab65716a5fa275c99e2b2de3bfd3eb0a3bef4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
%%
%% This is file `tableof.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% tableof.dtx  (with options: `package')
%% 
%% IMPORTANT NOTICE:
%% 
%% For the copyright see the source file.
%% 
%% Any modified versions of this file must be renamed
%% with new filenames distinct from tableof.sty.
%% 
%% For distribution of the original source see the terms
%% for copying and modification in the file tableof.dtx.
%% 
%% This generated file may be distributed as long as the
%% original source files, as listed above, are part of the
%% same distribution. (The sources need not necessarily be
%% in the same archive or directory.)
%%
\ProvidesPackage{tableof}
 [2012/12/06 v1.0 tables of tagged contents (jfB)]
%%
%% Package `tableof' by Jean-Francois Burnol
%% Copyright (C) 2012 by Jean-Francois Burnol
%%
\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}%
  \else
     \let\tof@nextread\tof@readtoc
     \read #1 to \tof@buffer
     \tof@toctoks=\expandafter\expandafter\expandafter
       {\expandafter\the\expandafter\tof@toctoks\tof@buffer}%
  \fi
  \tof@nextread{#1}}
\IfFileExists{\jobname .toc}
    {{\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{}}}
\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
                       \let\tof@next\@secondoftwo\fi}
\def\tof@secondiffalse#1{\csname if@tof#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@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}
\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{%
        \ifx\tof@tags\@empty\edef\tof@tags{#1}\else
        \edef\tof@tags{\tof@tags,#1}\fi}
\def\tof@@stop#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}}
\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}}}
\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}
\endinput
%%
%% End of file `tableof.sty'.