summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/pgfopts/pgfopts.sty
blob: 375130f9082547d291279fb793709a6f66a71247 (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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
%%
%% This is file `pgfopts.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% pgfopts.dtx  (with options: `package')
%% ----------------------------------------------------------------
%% pgfopts --- LaTeX package options with pgfkeys
%% E-mail: joseph.wright@morningstar2.co.uk
%% Released under the LaTeX Project Public License v1.3c or later
%% See http://www.latex-project.org/lppl.txt
%% ----------------------------------------------------------------
%% 
\ProvidesPackage{pgfopts}
  [2014/07/10 v2.1a LaTeX package options with pgfkeys]
\RequirePackage{pgfkeys}
\newif\ifpgfopts@process@class
\newcommand*\pgfopts@options@clist{}
\newcommand*\pgfopts@options@execute{}
\newcommand*\pgfopts@key@path{}
\newcommand\pgfopts@process@options[1]{%
  \def\pgfopts@options@clist{}%
  \def\pgfopts@options@execute{}%
  \def\pgfopts@key@path{#1/}%
  \ifx\@currext\@clsextension\else
    \expandafter\pgfopts@check@class@options
  \fi
  \pgfopts@process@local@options
  \pgfopts@options@execute
  \let\CurrentOption\@empty
  \AtEndOfPackage{\let\@unprocessedoptions\relax}%
}
\newcommand*\pgfopts@current@option{}
\newcommand*\pgfopts@check@class@options{%
  \ifpgfopts@process@class
    \ifx\@classoptionslist\relax\else
      \expandafter\expandafter\expandafter
        \pgfopts@check@class@options@aux
    \fi
  \fi
}
\newcommand*\pgfopts@check@class@options@aux{%
  \@for\pgfopts@current@option:=\@classoptionslist\do
    {%
      \pgfkeysifdefined
        {%
          \pgfopts@key@path
          \pgfopts@get@key@name\pgfopts@current@option
          /.@cmd%
        }%
        {%
          \pgfopts@list@add\pgfopts@options@clist\pgfopts@current@option
          \@expandtwoargs\@removeelement\pgfopts@current@option
            \@unusedoptionlist\@unusedoptionlist
        }%
        {}%
    }%
}
\newcommand*\pgfopts@local@options{}
\newcommand*\pgfopts@process@local@options{%
  \begingroup
    \@ifundefined{opt@\@currname.\@currext}%
      {\endgroup}%
      {%
        \toks@\expandafter\expandafter\expandafter
          {\csname opt@\@currname.\@currext\endcsname}%
        \expandafter\endgroup
        \expandafter\def\expandafter\pgfopts@local@options
          \expandafter{\the\toks@}%
        \pgfopts@process@local@options@aux@i
      }%
}
\newcommand*\pgfopts@process@local@options@aux@i{%
  \ifx\@currext\@clsextension
    \expandafter\pgfopts@process@local@options@class
  \else
    \expandafter\pgfopts@process@local@options@package
  \fi
  \ifx\pgfopts@options@clist\@empty\else
    \expandafter\pgfopts@process@local@options@aux@ii
  \fi
}
\newcommand*\pgfopts@process@local@options@aux@ii{%
  \begingroup
    \toks@\expandafter{\pgfopts@options@clist}%
    \edef\pgfopts@options@execute
      {%
        \noexpand\pgfkeys
          {%
            \pgfopts@key@path .cd,%
            \the\toks@
          }%
      }%
  \expandafter\endgroup
  \expandafter\def\expandafter\pgfopts@options@execute
    \expandafter{\pgfopts@options@execute}%
}
\newcommand*\pgfopts@process@local@options@class
  {%
    \pgfkeysifdefined{\pgfopts@key@path .unknown/.@cmd}%
      {\pgfopts@list@add\pgfopts@options@clist\@classoptionslist}
      {\pgfopts@process@local@options@class@aux}%
  }
\newcommand*\pgfopts@process@local@options@class@aux{%
  \@for\pgfopts@current@option:=\pgfopts@local@options\do{%
    \pgfkeysifdefined
      {%
        \pgfopts@key@path
        \pgfopts@get@key@name\pgfopts@current@option
        /.@cmd%
      }%
      {\pgfopts@list@add\pgfopts@options@clist\pgfopts@current@option}%
      {\pgfopts@list@add\@unusedoptionlist\pgfopts@current@option}%
  }%
}
\newcommand*\pgfopts@process@local@options@package{%
  \pgfopts@list@add\pgfopts@options@clist\pgfopts@local@options
}
\newcommand\pgfopts@get@key@name[1]{%
  \expandafter\pgfopts@get@key@name@aux#1=\@nil
}
\def\pgfopts@get@key@name@aux#1=#2\@nil{#1}
\newtoks\pgfopts@list@add@a@toks
\newtoks\pgfopts@list@add@b@toks
\newcommand*\pgfopts@list@add@temp{}
\newcommand\pgfopts@list@add[2]{%
  \pgfopts@list@add@a@toks\expandafter{#2}%
  \def\pgfopts@list@add@temp{#2}%
  \pgfopts@list@add@b@toks\expandafter{#1}%
  \ifx\pgfopts@options@clist\@empty
    \edef#1{\the\pgfopts@list@add@a@toks}%
  \else
    \ifx\pgfopts@list@add@temp\@empty\else
      \edef#1%
        {\the\pgfopts@list@add@b@toks,\the\pgfopts@list@add@a@toks}%
    \fi
  \fi
}
\newcommand*\ProcessPgfOptions{%
  \pgfopts@process@classtrue
  \pgfopts@star@check
}
\newcommand*\ProcessPgfPackageOptions{%
  \pgfopts@process@classfalse
  \pgfopts@star@check
}
\newcommand*\pgfopts@star@check{%
  \@ifstar
    {%
      \begingroup
      \edef\@tempa
        {%
          \endgroup
          \noexpand\pgfopts@process@options{/\@currname}%
        }%
      \@tempa
    }%
    {\pgfopts@process@options}%
}
\@onlypreamble\ProcessPgfOptions
\@onlypreamble\ProcessPgfPackageOptions
%% 
%% Copyright (C) 2008-2011,2013,2014 by
%%   Joseph Wright <joseph.wright@morningstar2.co.uk>
%% 
%% It may be distributed and/or modified under the conditions of
%% the LaTeX Project Public License (LPPL), either version 1.3c of
%% this license or (at your option) any later version.  The latest
%% version of this license is in the file:
%% 
%%    http://www.latex-project.org/lppl.txt
%% 
%% This work is "maintained" (as per LPPL maintenance status) by
%%   Joseph Wright.
%% 
%% This work consists of the file  pgfopts.dtx
%%           and the derived files pgfopts.ins and
%%                                 pgfopts.pdf.
%% 
%%
%% End of file `pgfopts.sty'.