-
Notifications
You must be signed in to change notification settings - Fork 0
/
ltxcmds.sty
361 lines (361 loc) · 8.61 KB
/
ltxcmds.sty
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
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
%%
%% This is file `ltxcmds.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% ltxcmds.dtx (with options: `package')
%%
%% This is a generated file.
%%
%% Copyright (C) 2009, 2010 by
%% Heiko Oberdiek <heiko.oberdiek at googlemail.com>
%%
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either
%% version 1.3c of this license or (at your option) any later
%% version. This version of this license is in
%% http://www.latex-project.org/lppl/lppl-1-3c.txt
%% and the latest version of this license is in
%% http://www.latex-project.org/lppl.txt
%% and version 1.3 or later is part of all distributions of
%% LaTeX version 2005/12/01 or later.
%%
%% This work has the LPPL maintenance status "maintained".
%%
%% This Current Maintainer of this work is Heiko Oberdiek.
%%
%% The Base Interpreter refers to any `TeX-Format',
%% because some files are installed in TDS:tex/generic//.
%%
%% This work consists of the main source file ltxcmds.dtx
%% and the derived files
%% ltxcmds.sty, ltxcmds.pdf, ltxcmds.ins, ltxcmds.drv,
%% ltxcmds-test1.tex.
%%
\begingroup
\catcode44 12 % ,
\catcode45 12 % -
\catcode46 12 % .
\catcode58 12 % :
\catcode64 11 % @
\catcode123 1 % {
\catcode125 2 % }
\expandafter\let\expandafter\x\csname [email protected]\endcsname
\ifx\x\relax % plain-TeX, first loading
\else
\def\empty{}%
\ifx\x\empty % LaTeX, first loading,
% variable is initialized, but \ProvidesPackage not yet seen
\else
\catcode35 6 % #
\expandafter\ifx\csname PackageInfo\endcsname\relax
\def\x#1#2{%
\immediate\write-1{Package #1 Info: #2.}%
}%
\else
\def\x#1#2{\PackageInfo{#1}{#2, stopped}}%
\fi
\x{ltxcmds}{The package is already loaded}%
\aftergroup\endinput
\fi
\fi
\endgroup
\begingroup
\catcode35 6 % #
\catcode40 12 % (
\catcode41 12 % )
\catcode44 12 % ,
\catcode45 12 % -
\catcode46 12 % .
\catcode47 12 % /
\catcode58 12 % :
\catcode64 11 % @
\catcode91 12 % [
\catcode93 12 % ]
\catcode123 1 % {
\catcode125 2 % }
\expandafter\ifx\csname ProvidesPackage\endcsname\relax
\def\x#1#2#3[#4]{\endgroup
\immediate\write-1{Package: #3 #4}%
\xdef#1{#4}%
}%
\else
\def\x#1#2[#3]{\endgroup
#2[{#3}]%
\ifx#1\@undefined
\xdef#1{#3}%
\fi
\ifx#1\relax
\xdef#1{#3}%
\fi
}%
\fi
\expandafter\x\csname [email protected]\endcsname
\ProvidesPackage{ltxcmds}%
[2010/03/09 v1.4 LaTeX kernel commands for general use (HO)]
\begingroup
\catcode123 1 % {
\catcode125 2 % }
\def\x{\endgroup
\expandafter\edef\csname LTXcmds@AtEnd\endcsname{%
\catcode35 \the\catcode35\relax
\catcode64 \the\catcode64\relax
\catcode123 \the\catcode123\relax
\catcode125 \the\catcode125\relax
}%
}%
\x
\catcode35 6 % #
\catcode64 11 % @
\catcode123 1 % {
\catcode125 2 % }
\def\TMP@EnsureCode#1#2{%
\edef\LTXcmds@AtEnd{%
\LTXcmds@AtEnd
\catcode#1 \the\catcode#1\relax
}%
\catcode#1 #2\relax
}
\TMP@EnsureCode{40}{12}% (
\TMP@EnsureCode{41}{12}% )
\TMP@EnsureCode{45}{12}% -
\TMP@EnsureCode{46}{12}% .
\TMP@EnsureCode{47}{12}% /
\TMP@EnsureCode{60}{12}% <
\TMP@EnsureCode{61}{12}% =
\TMP@EnsureCode{62}{12}% >
\TMP@EnsureCode{91}{12}% [
\TMP@EnsureCode{96}{12}% `
\TMP@EnsureCode{93}{12}% ]
\TMP@EnsureCode{94}{12}% ^ (superscript) (!)
\TMP@EnsureCode{124}{12}% |
\chardef\ltx@zero=0 %
\chardef\ltx@one=1 %
\chardef\ltx@two=2 %
\chardef\ltx@cclv=255 %
\long\def\ltx@gobble#1{}
\long\def\ltx@gobbletwo#1#2{}
\long\def\ltx@gobblethree#1#2#3{}
\long\def\ltx@gobblefour#1#2#3#4{}
\long\def\ltx@firstofone#1{#1}
\long\def\ltx@firstoftwo#1#2{#1}
\long\def\ltx@secondoftwo#1#2{#2}
\long\def\ltx@car#1#2\@nil{#1}
\long\def\ltx@cdr#1#2\@nil{#2}
\long\def\ltx@ReturnAfterFi#1\fi{#1}
\long\def\ltx@ReturnAfterFi#1\else#2\fi{#1}
\def\ltx@empty{}
\def\ltx@space{ }
\begingroup
\lccode`0=`\%\relax
\lowercase{\endgroup
\def\ltx@percentchar{0}%
}
\begingroup
\lccode`0=`\\\relax
\lowercase{\endgroup
\def\ltx@backslashchar{0}%
}
\def\ltx@newif#1{%
\begingroup
\escapechar=-1 %
\expandafter\endgroup
\expandafter\LTXcmds@newif\string#1\@nil
}
\begingroup
\escapechar=-1 %
\expandafter\endgroup
\expandafter\def\expandafter\LTXcmds@newif\string\if#1\@nil{%
\expandafter\edef\csname#1true\endcsname{%
\let
\expandafter\noexpand\csname if#1\endcsname
\noexpand\iftrue
}%
\expandafter\edef\csname#1false\endcsname{%
\let
\expandafter\noexpand\csname if#1\endcsname
\noexpand\iffalse
}%
\csname#1false\endcsname
}
\def\ltx@LocalExpandAfter{%
\begingroup
\expandafter\expandafter\expandafter
\endgroup
\expandafter
}
\ltx@LocalExpandAfter
\ifx\csname ifcsname\endcsname\relax
\def\ltx@ifundefined#1{%
\expandafter\ifx\csname #1\endcsname\relax
\expandafter\ltx@firstoftwo
\else
\expandafter\ltx@secondoftwo
\fi
}%
\def\ltx@IfUndefined#1{%
\begingroup\expandafter\expandafter\expandafter\endgroup
\expandafter\ifx\csname #1\endcsname\relax
\expandafter\ltx@firstoftwo
\else
\expandafter\ltx@secondoftwo
\fi
}%
\expandafter\ltx@gobble
\else
\expandafter\ltx@firstofone
\fi
{%
\def\ltx@ifundefined#1{%
\ifcsname #1\endcsname
\expandafter\ifx\csname #1\endcsname\relax
\expandafter\expandafter\expandafter\ltx@firstoftwo
\else
\expandafter\expandafter\expandafter\ltx@secondoftwo
\fi
\else
\expandafter\ltx@firstoftwo
\fi
}%
\let\ltx@IfUndefined\ltx@ifundefined
}
\def\ltx@RemovePrefix#1>{}
\def\ltx@StripPrefix{%
\expandafter\ltx@RemovePrefix
}
\def\ltx@clsextension{cls}
\def\ltx@pkgextension{sty}
\def\ltx@iffileloaded#1{%
\ltx@ifundefined{ver@#1}\ltx@secondoftwo\ltx@firstoftwo
}
\def\ltx@ifclassloaded#1{%
\ltx@iffileloaded{#1.\ltx@clsextension}%
}
\def\ltx@ifpackageloaded#1{%
\ltx@iffileloaded{#1.\ltx@pkgextension}%
}
\def\ltx@iffilelater#1#2{%
\ltx@iffileloaded{#1}{%
\expandafter\LTXcmds@IfLater\expandafter{%
\number
\expandafter\expandafter\expandafter\LTXcmds@ParseVersion
\expandafter\expandafter\expandafter{%
\csname ver@#1\endcsname
}%
\expandafter}\expandafter{%
\number
\expandafter\LTXcmds@ParseVersion\expandafter{#2}%
}%
}\ltx@secondoftwo
}
\def\LTXcmds@IfLater#1#2{%
\ifcase 0%
\ifnum#1<19940101 %
\else
\ifnum#2<19940101 %
\else
\ifnum#2>#1 %
\else
1%
\fi
\fi
\fi
\ltx@space
\expandafter\ltx@secondoftwo
\else
\expandafter\ltx@firstoftwo
\fi
}
\def\ltx@ifclasslater#1{%
\ltx@ifclasslater{#1.\ltx@clsextension}%
}
\def\ltx@ifpackagelater#1{%
\ltx@iffilelater{#1.\ltx@pkgextension}%
}
\ltx@IfUndefined{pdfmatch}{%
\def\LTXcmds@ParseVersion#1{%
\LTXcmds@@ParseVersion#10000/00/00\@nil
}%
\def\LTXcmds@@ParseVersion#1#2#3#4/#5#6/#7#8#9\@nil{%
#1#2#3#4#5#6#7#8%
}%
}{%
\def\LTXcmds@ParseVersion#1{%
\ifnum\pdfmatch{%
^%
(199[4-9]|[2-9][0-9][0-9][0-9])/%
(0[1-9]|1[0-2])/%
(0[1-9]|[1-2][0-9]|3[0-1])%
}{#1}=1 %
\ltx@StripPrefix\pdflastmatch1 %
\ltx@StripPrefix\pdflastmatch2 %
\ltx@StripPrefix\pdflastmatch3 %
\else
0%
\fi
}%
}
\def\ltx@GlobalAppendToMacro#1#2{%
\ifx\ltx@undefined#1%
\let#1\ltx@empty
\else
\ifx\relax#1%
\let#1\ltx@empty
\fi
\fi
\begingroup
\toks0\expandafter{#1#2}%
\xdef#1{\the\toks0}%
\endgroup
}
\def\ltx@LocalAppendToMacro#1#2{%
\global\let\LTXcmds@gtemp#1%
\ifx\ltx@undefined\LTXcmds@gtemp
\global\let\LTXcmds@gtemp\ltx@empty
\else
\ifx\relax\LTXcmds@gtemp
\global\letLTXcmds@gtemp\ltx@empty
\fi
\fi
\begingroup
\toks0\expandafter{\LTXcmds@gtemp#2}%
\xdef\LTXcmds@gtemp{\the\toks0}%
\endgroup
\let#1\LTXcmds@gtemp
}
\long\def\ltx@ifnextchar#1#2#3{%
\begingroup
\let\LTXcmds@CharToken= #1\relax
\toks\ltx@zero{#2}%
\toks\ltx@two{#3}%
\futurelet\LTXcmds@LetToken\LTXcmds@ifnextchar
}
\def\LTXcmds@ifnextchar{%
\ifx\LTXcmds@LetToken\LTXcmds@CharToken
\expandafter\endgroup\the\toks\expandafter\ltx@zero
\else
\ifx\LTXcmds@LetToken\LTXcmds@SpaceToken
\expandafter\expandafter\expandafter\LTXcmds@@ifnextchar
\else
\expandafter\endgroup\the\toks
\expandafter\expandafter\expandafter\ltx@two
\fi
\fi
}
\begingroup
\def\x#1{\endgroup
\def\LTXcmds@@ifnextchar#1{%
\futurelet\LTXcmds@LetToken\LTXcmds@ifnextchar
}%
}%
\x{ }
\begingroup
\def\x#1{\endgroup
\let\LTXcmds@SpaceToken= #1%
}%
\x{ }
\LTXcmds@AtEnd
\endinput
%%
%% End of file `ltxcmds.sty'.