Debian Codegraph @

texmf-dist/source/generic/gobble/gobble.dtx

raw
1 % \iffalse meta-comment
2 %<=*COPYRIGHT>
3 %% Copyright (C) 2012-2019 by Martin Scharrer <[email protected]>
4 %% ----------------------------------------------------------------------
5 %% This work may be distributed and/or modified under the
6 %% conditions of the LaTeX Project Public License, either version 1.3
7 %% of this license or (at your option) any later version.
8 %% The latest version of this license is in
9 %% http://www.latex-project.org/lppl.txt
10 %% and version 1.3 or later is part of all distributions of LaTeX
11 %% version 2005/12/01 or later.
12 %%
13 %% This work has the LPPL maintenance status `maintained'.
14 %%
15 %% The Current Maintainer of this work is Martin Scharrer.
16 %%
17 %% This work consists of the files gobble.dtx and gobble.ins
18 %% and the derived files gobble.sty, gobble-user.sty,
19 %% gobble.tex and gobble-user.tex
20 %%
21 %<=/COPYRIGHT>
22 % \fi
23 %
24 % \iffalse
25 %<*driver>
26 \ProvidesFile{gobble.dtx}[%
27 %<=*DATE>
28 2019/01/04
29 %<=/DATE>
30 %<=*VERSION>
31 v0.2
32 %<=/VERSION>
33 DTX file for the gobble package]
34 \documentclass{ydoc}
35 \GetFileInfo{gobble.dtx}
36 \usepackage{gobble}[\filedate]
37 \EnableCrossrefs
38 \CodelineIndex
39 \RecordChanges
40 \begin{document}
41 \DocInput{\jobname.dtx}
42 \PrintChanges
43 \PrintIndex
44 \end{document}
45 %</driver>
46 % \fi
47 %
48 % \CheckSum{0}
49 %
50 % \CharacterTable
51 % {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
52 % Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
53 % Digits \0\1\2\3\4\5\6\7\8\9
54 % Exclamation \! Double quote \" Hash (number) \#
55 % Dollar \$ Percent \% Ampersand \&
56 % Acute accent \' Left paren \( Right paren \)
57 % Asterisk \* Plus \+ Comma \,
58 % Minus \- Point \. Solidus \/
59 % Colon \: Semicolon \; Less than \<
60 % Equals \= Greater than \> Question mark \?
61 % Commercial at \@ Left bracket \[ Backslash \\
62 % Right bracket \] Circumflex \^ Underscore \_
63 % Grave accent \` Left brace \{ Vertical bar \|
64 % Right brace \} Tilde \~}
65 %
66 %
67 % \changes{v0.1}{2012/06/09}{First version.}
68 %
69 % \DoNotIndex{\newcommand,\newenvironment}
70 %
71 % \GetFileInfo{gobble.dtx}
72 % \author{Martin Scharrer}
73 % \email{[email protected]}
74 % \ifdefined\repository
75 % \repository{https://bitbucket.org/martin_scharrer/gobble}
76 % \fi
77 %
78 % \maketitle
79 %
80 % \begin{abstract}\noindent
81 % The \pkg{gobble} \LaTeX\ package provides more macros to discard (gobble)
82 % macro arguments. These macros are by default only for package
83 % and class writers, but are exported to the user level by the
84 % \pkg{gobble-user} package.
85 % The macros are also available as generic packages for other \TeX\ formats.
86 % \end{abstract}
87 %
88 % \section{Macros}
89 %
90 % \subsection{Macros for Package/Class Writers}
91 % The following macros are provided by the generic \file{gobble.tex} and the \LaTeX\ package \pkg{gobble}.
92 % Some are already provided by the \LaTeX\ kernel.
93 %
94 % \DescribeMacro\@gobble
95 % \DescribeMacro\@gobbletwo
96 % \DescribeMacro\@gobblethree
97 % \DescribeMacro\@gobblefour
98 % Gobbles one, two, three or four mandatory arguments.
99 %
100 % \DescribeMacro\@gobbleopt
101 % \DescribeMacro\@gobbletwoopt
102 % \DescribeMacro\@gobbleallopt
103 % Gobbles one, two or all found optional arguments if present.
104 %
105 % \DescribeMacro\@gobbletwoopttwo
106 % Gobbles (up to) two optional arguments if present and then two mandatory arguments.
107 %
108 % \DescribeMacro\@firstofone
109 % Reads one argument and expands to it, i.e.\ removes the braces around it.
110 %
111 % \DescribeMacro\@firstoftwo
112 % Reads two arguments and expands to the first one while discarding the second one.
113 %
114 % \DescribeMacro\@secondoftwo
115 % Reads two arguments and expands to the second one while discarding the first one.
116 %
117 % \DescribeMacro\@firstofthree
118 % \DescribeMacro\@secondofthree
119 % \DescribeMacro\@thirdofthree
120 % These macros read three arguments and expand to the first, second or third one, respectively, while discarding the other.
121 %
122 % \DescribeMacro\@gobbletofi{<code>}<discarded code>\AlsoMacro{fi}
123 % \DescribeMacro\@gobbletoelse{<code>}<discarded code>\AlsoMacro{else}
124 % \DescribeMacro\@gobbletoor{<code>}<discarded code>\AlsoMacro{or}
125 % These macros read one argument and then gobble everything to the next \Macro{fi}, \Macro{else} or \Macro{or},
126 % respectively. Afterwards they expand to the first argument.
127 % This allows to break out of an \Macro{if..} or \Macro{ifcase} branch, which is sometimes required if code should be
128 % executed after the conditional.
129 %
130 % \subsection{User Level Macros}
131 % The following macros are provided by the generic \file{gobble-user.tex} and the \LaTeX\ package \pkg{gobble-user}.
132 % These also load the \file{gobble.tex} file or package \pkg{gobble} package, respectively.
133 %
134 % They macros are identical to the corresponding versions with the leading `|@|', but can be used freely in a user
135 % document.
136 %
137 %
138 % \DescribeMacro\gobble
139 % \DescribeMacro\gobbletwo
140 % \DescribeMacro\gobblethree
141 % \DescribeMacro\gobblefour
142 %
143 % \DescribeMacro\gobbleopt
144 % \DescribeMacro\gobbletwoopt
145 % \DescribeMacro\gobbleallopt
146 %
147 % \DescribeMacro\gobbletwoopttwo
148 %
149 % \DescribeMacro\firstofone
150 %
151 % \DescribeMacro\firstoftwo
152 % \DescribeMacro\secondoftwo
153 %
154 % \DescribeMacro\firstofthree
155 % \DescribeMacro\secondofthree
156 % \DescribeMacro\thirdofthree
157 %
158 % \DescribeMacro\gobbletofi
159 % \DescribeMacro\gobbletoelse
160 % \DescribeMacro\gobbletoor
161 %
162 %
163 % \StopEventually{}
164 % \clearpage
165 % \section{Implementation}
166 %
167 % \iffalse
168 %<*gobble.sty>
169 % \fi
170 % \begin{macrocode}
171 %<!COPYRIGHT>
172 \NeedsTeXFormat{LaTeX2e}[1999/12/01]
173 \ProvidesPackage{gobble}[%
174 %<!DATE>
175 %<!VERSION>
176 %<*DRIVER>
177 2099/01/01 develop
178 %</DRIVER>
179 Provides more gobble macros]
180 % \end{macrocode}
181 %
182 % \begin{macrocode}
183 \input{gobble}
184 % \end{macrocode}
185
186 % \iffalse
187 %</gobble.sty>
188 % \fi
189 %
190 % \iffalse
191 %<*gobble-user.sty>
192 % \fi
193 % \begin{macrocode}
194 %<!COPYRIGHT>
195 \NeedsTeXFormat{LaTeX2e}[1999/12/01]
196 \ProvidesPackage{gobble-user}[%
197 %<!DATE>
198 %<!VERSION>
199 %<*DRIVER>
200 2099/01/01 develop
201 %</DRIVER>
202 Provides user level macros]
203 % \end{macrocode}
204 %
205 % \begin{macrocode}
206 \RequirePackage{gobble}
207 \input{gobble-user}
208 % \end{macrocode}
209
210 % \iffalse
211 %</gobble-user.sty>
212 % \fi
213 %
214 % \iffalse
215 %<*gobble.tex>
216 % \fi
217 %
218 % \begin{macrocode}
219 \expandafter\ifx\csname gobble.tex loaded\endcsname\relax
220 \expandafter\def\csname gobble.tex loaded\endcsname{1}%
221 \else
222 \expandafter\endinput
223 \fi
224 % \end{macrocode}
225 %
226 % \begin{macro}{\gobbletex@catcode}
227 % \begin{macrocode}
228 \expandafter\edef\csname gobbletex@catcode\endcsname{%
229 \catcode`\noexpand\@=\the\catcode`\@%
230 }%
231 \catcode`\@=11
232 % \end{macrocode}
233 % \end{macro}
234 %
235 %
236 % \begin{macro}{\@gobble}
237 % \begin{macro}{\@gobbletwo}
238 % \begin{macro}{\@gobblethree}
239 % \begin{macro}{\@gobblefour}
240 % \begin{macrocode}
241 \long\def\@gobble#1{}%
242 \long\def\@gobbletwo#1#2{}%
243 \long\def\@gobblethree#1#2#3{}%
244 \long\def\@gobblefour#1#2#3#4{}%
245 % \end{macrocode}
246 % \end{macro}
247 % \end{macro}
248 % \end{macro}
249 % \end{macro}
250 %
251 %
252 % \begin{macro}{\@gobbleopt}
253 % \begin{macrocode}
254 \long\def\@gobbleopt{%
255 \@ifnextchar[%
256 {\@gobbleopt@}%
257 {}%
258 }%
259 % \end{macrocode}
260 % \end{macro}
261 %
262 % \begin{macro}{\@gobbleopt@}
263 % \begin{macrocode}
264 \def\@gobbleopt@[#1]{}%
265 % \end{macrocode}
266 % \end{macro}
267 %
268 %
269 % \begin{macro}{\@gobbletwoopt}
270 % \begin{macrocode}
271 \long\def\@gobbletwoopt{%
272 \@ifnextchar[%
273 {\@gobbletwoopt@}%
274 {}%
275 }%
276 % \end{macrocode}
277 % \end{macro}
278 %
279 % \begin{macro}{\@gobbletwoopt@}
280 % \begin{macrocode}
281 \def\@gobbletwoopt@[#1]{\@gobbleopt}%
282 % \end{macrocode}
283 % \end{macro}
284 %
285 %
286 % \begin{macro}{\@gobbleallopt}
287 % \begin{macrocode}
288 \long\def\@gobbleallopt{%
289 \@ifnextchar[%
290 {\@gobbleallopt@}%
291 {}%
292 }%
293 % \end{macrocode}
294 % \end{macro}
295 %
296 %
297 % \begin{macro}{\@gobbleallopt@}
298 % \begin{macrocode}
299 \long\def\@gobbleallopt@[#1]{%
300 \@ifnextchar[%
301 {\@gobbleallopt@}%
302 {}%
303 }%
304 % \end{macrocode}
305 % \end{macro}
306 %
307 %
308 %
309 % \begin{macro}{\@gobbletwoopttwo}
310 % \begin{macrocode}
311 \long\def\@gobbletwoopttwo{%
312 \@ifnextchar[%
313 {\@gobbletwoopttwo@}%
314 {\@gobbletwo}%
315 }%
316 % \end{macrocode}
317 % \end{macro}
318 %
319 % \begin{macro}{\@gobbletwoopttwo@}
320 % \begin{macrocode}
321 \long\def\@gobbletwoopttwo@[#1]{%
322 \@ifnextchar[%
323 {\@gobbletwoopttwo@@}%
324 {\@gobbletwo}%
325 }%
326 % \end{macrocode}
327 % \end{macro}
328 %
329 % \begin{macro}{\@gobbletwoopttwo@@}
330 % \begin{macrocode}
331 \long\def\@gobbletwoopttwo@@[#1]{%
332 \@gobbletwo
333 }%
334 % \end{macrocode}
335 % \end{macro}
336 %
337 % \begin{macro}{\@firstofone}
338 % \begin{macrocode}
339 \long\def\@firstofone#1{#1}%
340 % \end{macrocode}
341 % \end{macro}
342 %
343 % \begin{macro}{\@firstoftwo}
344 % \begin{macro}{\@secondoftwo}
345 % \begin{macrocode}
346 \long\def\@firstoftwo#1#2{#1}%
347 \long\def\@secondoftwo#1#2{#2}%
348 % \end{macrocode}
349 % \end{macro}
350 % \end{macro}
351 %
352 %
353 % \begin{macro}{\@firstofthree}
354 % \begin{macro}{\@secondofthree}
355 % \begin{macro}{\@thirdofthree}
356 % \begin{macrocode}
357 \long\def\@firstofthree#1#2#3{#1}%
358 \long\def\@secondofthree#1#2#3{#2}%
359 \long\def\@thirdofthree#1#2#3{#3}%
360 % \end{macrocode}
361 % \end{macro}
362 % \end{macro}
363 % \end{macro}
364 %
365 %
366 % \begin{macro}{\@gobbletofi}
367 % \begin{macro}{\@gobbletoelse}
368 % \begin{macro}{\@gobbletoor}
369 % \begin{macrocode}
370 \long\def\@gobbletofi#1#2\fi{\fi#1}%
371 \long\def\@gobbletoelse#1#2\else{\else#1}%
372 \long\def\@gobbletoor#1#2\or{\or#1}%
373 % \end{macrocode}
374 % \end{macro}
375 % \end{macro}
376 % \end{macro}
377 %
378 % \begin{macrocode}
379 \gobbletex@catcode
380 % \end{macrocode}
381 %
382 % \iffalse
383 %</gobble.tex>
384 % \fi
385 %
386 % \iffalse
387 %<*gobble-user.tex>
388 % \fi
389 % \begin{macrocode}
390 \expandafter\ifx\csname gobble-user.tex loaded\endcsname\relax
391 \expandafter\def\csname gobble-user.tex loaded\endcsname{1}%
392 \else
393 \expandafter\endinput
394 \fi
395 % \end{macrocode}
396 %
397 % \begin{macrocode}
398 \input{gobble}
399 % \end{macrocode}
400 %
401 % \begin{macro}{\gobbletex@catcode}
402 % \begin{macrocode}
403 \expandafter\edef\csname gobbletex@catcode\endcsname{%
404 \catcode`\noexpand\@=\the\catcode`\@%
405 }%
406 \catcode`\@=11
407 % \end{macrocode}
408 % \end{macro}
409 %
410 %
411 % \begin{macro}{\gobble}
412 % \begin{macro}{\gobbletwo}
413 % \begin{macro}{\gobblethree}
414 % \begin{macro}{\gobblefour}
415 % \begin{macrocode}
416 \let\gobble\@gobble
417 \let\gobbletwo\@gobbletwo
418 \let\gobblethree\@gobblethree
419 \let\gobblefour\@gobblefour
420 % \end{macrocode}
421 % \end{macro}
422 % \end{macro}
423 % \end{macro}
424 % \end{macro}
425 %
426 %
427 % \begin{macro}{\gobbleopt}
428 % \begin{macrocode}
429 \let\gobbleopt\@gobbleopt
430 % \end{macrocode}
431 % \end{macro}
432 %
433 % \begin{macro}{\gobbletwoopt}
434 % \begin{macrocode}
435 \let\gobbletwoopt\@gobbletwoopt
436 % \end{macrocode}
437 % \end{macro}
438 %
439 %
440 % \begin{macro}{\gobbleallopt}
441 % \begin{macrocode}
442 \let\gobbleallopt\@gobbleallopt
443 % \end{macrocode}
444 % \end{macro}
445 %
446 %
447 % \begin{macro}{\gobbletwoopttwo}
448 % \begin{macrocode}
449 \let\gobbletwoopttwo\@gobbletwoopttwo
450 % \end{macrocode}
451 % \end{macro}
452 %
453 % \begin{macro}{\firstofone}
454 % \begin{macrocode}
455 \let\firstofone\@firstofone
456 % \end{macrocode}
457 % \end{macro}
458 %
459 % \begin{macro}{\firstoftwo}
460 % \begin{macro}{\secondoftwo}
461 % \begin{macrocode}
462 \let\firstoftwo\@firstoftwo
463 \let\secondoftwo\@secondoftwo
464 % \end{macrocode}
465 % \end{macro}
466 % \end{macro}
467 %
468 % \begin{macro}{\firstofthree}
469 % \begin{macro}{\secondofthree}
470 % \begin{macro}{\thirdofthree}
471 % \begin{macrocode}
472 \let\firstofthree\@firstofthree
473 \let\secondofthree\@secondofthree
474 \let\thirdofthree\@thirdofthree
475 % \end{macrocode}
476 % \end{macro}
477 % \end{macro}
478 % \end{macro}
479 %
480 %
481 % \begin{macro}{\gobbletofi}
482 % \begin{macro}{\gobbletoelse}
483 % \begin{macro}{\gobbletoor}
484 % \begin{macrocode}
485 \let\gobbletofi\@gobbletofi
486 \let\gobbletoelse\@gobbletoelse
487 \let\gobbletoor\@gobbletoor
488 % \end{macrocode}
489 % \end{macro}
490 % \end{macro}
491 % \end{macro}
492 %
493 % \begin{macrocode}
494 \gobbletex@catcode
495 % \end{macrocode}
496 %
497 % \iffalse
498 %</gobble-user.tex>
499 % \fi
500 %
501 % \Finale
502 \endinput