Debian Codegraph @

texmf-dist/tex/latex/kvoptions/kvoptions-patch.sty

raw
1 %%
2 %% This is file `kvoptions-patch.sty',
3 %% generated with the docstrip utility.
4 %%
5 %% The original source files were:
6 %%
7 %% kvoptions.dtx (with options: `patch')
8 %%
9 %% This is a generated file.
10 %%
11 %% Project: kvoptions
12 %% Version: 2022-06-15 v3.15
13 %%
14 %% Copyright (C)
15 %% 2004, 2006, 2007, 2009-2011 Heiko Oberdiek
16 %% 2016-2022 Oberdiek Package Support Group
17 %%
18 %% This work may be distributed and/or modified under the
19 %% conditions of the LaTeX Project Public License, either
20 %% version 1.3c of this license or (at your option) any later
21 %% version. This version of this license is in
22 %% https://www.latex-project.org/lppl/lppl-1-3c.txt
23 %% and the latest version of this license is in
24 %% https://www.latex-project.org/lppl.txt
25 %% and version 1.3 or later is part of all distributions of
26 %% LaTeX version 2005/12/01 or later.
27 %%
28 %% This work has the LPPL maintenance status "maintained".
29 %%
30 %% The Current Maintainers of this work are
31 %% Heiko Oberdiek and the Oberdiek Package Support Group
32 %% https://github.com/ho-tex/kvoptions/issues
33 %%
34 %% This work consists of the main source file kvoptions.dtx
35 %% and the derived files
36 %% kvoptions.sty, kvoptions.pdf, kvoptions.ins, kvoptions.drv,
37 %% kvoptions-patch.sty, example-mycolorsetup.sty,
38 %% kvoptions-test1.tex, kvoptions-test2.tex,
39 %% kvoptions-test3.tex, kvoptions-test4.tex,
40 %% kvoptions-test4.sty.
41 %%
42 %% No we don't need the option 'color'.
43 %% With color support option 'emphcolor' will dynamically
44 %% change the color of \emph statements.
45 \providecommand\IfFormatAtLeastTF{\@ifl@t@r\fmtversion}
46 \IfFormatAtLeastTF{2020/10/01}{\PackageWarning{kvoptions-patch}%
47 {kvoptions-patch is not compatible with \MessageBreak
48 LaTeX \fmtversion\MessageBreak Loading is aborted}{}}{}
49 \IfFormatAtLeastTF{2020/10/01}{\endinput}{}
50
51 \def\KVO@IfDefThen#1#2{%
52 \ifx#1\ltx@undefined
53 \else
54 \ifx#1\relax
55 \else
56 #2%
57 \fi
58 \fi
59 }%
60 \def\KVO@GetClassOptionsList{%
61 \let\KVO@classoptionslist\@classoptionslist
62 \KVO@IfDefThen\@classoptionslist{%
63 \KVO@IfDefThen\XKV@documentclass{%
64 \ifx\XKV@documentclass\ltx@empty
65 \else
66 \KVO@IfDefThen\XKV@classoptionslist{%
67 \ifx\XKV@classoptionslist\ltx@empty
68 \else
69 \let\KVO@classoptionslist\XKV@classoptionslist
70 \fi
71 }%
72 \fi
73 }%
74 }%
75 }%
76 \NeedsTeXFormat{LaTeX2e}
77 \begingroup\catcode61\catcode48\catcode32=10\relax%
78 \catcode13=5 % ^^M
79 \endlinechar=13 %
80 \catcode123=1 % {
81 \catcode125=2 % }
82 \catcode64=11 % @
83 \def\x{\endgroup
84 \expandafter\edef\csname KVO@AtEnd\endcsname{%
85 \endlinechar=\the\endlinechar\relax
86 \catcode13=\the\catcode13\relax
87 \catcode32=\the\catcode32\relax
88 \catcode35=\the\catcode35\relax
89 \catcode61=\the\catcode61\relax
90 \catcode64=\the\catcode64\relax
91 \catcode123=\the\catcode123\relax
92 \catcode125=\the\catcode125\relax
93 }%
94 }%
95 \x\catcode61\catcode48\catcode32=10\relax%
96 \catcode13=5 % ^^M
97 \endlinechar=13 %
98 \catcode35=6 % #
99 \catcode64=11 % @
100 \catcode123=1 % {
101 \catcode125=2 % }
102 \def\TMP@EnsureCode#1#2{%
103 \edef\KVO@AtEnd{%
104 \KVO@AtEnd
105 \catcode#1=\the\catcode#1\relax
106 }%
107 \catcode#1=#2\relax
108 }
109 \TMP@EnsureCode{39}{12}% '
110 \TMP@EnsureCode{40}{12}% (
111 \TMP@EnsureCode{41}{12}% )
112 \TMP@EnsureCode{43}{12}% +
113 \TMP@EnsureCode{44}{12}% ,
114 \TMP@EnsureCode{45}{12}% -
115 \TMP@EnsureCode{46}{12}% .
116 \TMP@EnsureCode{47}{12}% /
117 \TMP@EnsureCode{58}{12}% :
118 \TMP@EnsureCode{60}{12}% <
119 \TMP@EnsureCode{62}{12}% >
120 \TMP@EnsureCode{91}{12}% [
121 \TMP@EnsureCode{93}{12}% ]
122 \TMP@EnsureCode{96}{12}% `
123 \TMP@EnsureCode{124}{12}% |
124 \edef\KVO@AtEnd{\KVO@AtEnd\noexpand\endinput}
125 \ProvidesPackage{kvoptions-patch}%
126 [2022-06-15 v3.15 LaTeX patch for keyval options (HO)]%
127 \begingroup\expandafter\expandafter\expandafter\endgroup
128 \expandafter\ifx\csname eTeXversion\endcsname\relax
129 \PackageWarningNoLine{kvoptions-patch}{%
130 Package loading is aborted, because e-TeX is missing%
131 }%
132 \expandafter\KVO@AtEnd
133 \fi%
134 \RequirePackage{etexcmds}[2007/09/09]
135 \ifetex@unexpanded
136 \else
137 \PackageError{kvoptions-patch}{%
138 Could not find eTeX's \string\unexpanded.\MessageBreak
139 Try adding \string\RequirePackage\string{etexcmds\string} %
140 before \string\documentclass%
141 }\@ehd
142 \expandafter\KVO@AtEnd
143 \fi%
144 \@ifpackageloaded{xkvltxp}{%
145 \PackageWarningNoLine{kvoptions}{%
146 Option `patch' cannot be used together with\MessageBreak
147 package `xkvltxp' that is already loaded.\MessageBreak
148 Therefore package loading is aborted%
149 }%
150 \KVO@AtEnd
151 }{}%
152 \def\@if@ptions#1#2#3{%
153 \begingroup
154 \KVO@normalize\KVO@temp{#3}%
155 \edef\x{\endgroup
156 \noexpand\@if@pti@ns{%
157 \detokenize\expandafter\expandafter\expandafter{%
158 \csname opt@#2.#1\endcsname
159 }%
160 }{%
161 \detokenize\expandafter{\KVO@temp}%
162 }%
163 }%
164 \x
165 }
166 \def\@pass@ptions#1#2#3{%
167 \KVO@normalize\KVO@temp{#2}%
168 \@ifundefined{opt@#3.#1}{%
169 \expandafter\gdef\csname opt@#3.#1%
170 \expandafter\endcsname\expandafter{%
171 \KVO@temp
172 }%
173 }{%
174 \expandafter\gdef\csname opt@#3.#1%
175 \expandafter\expandafter\expandafter\endcsname
176 \expandafter\expandafter\expandafter{%
177 \csname opt@#3.#1\expandafter\endcsname\expandafter,\KVO@temp
178 }%
179 }%
180 }
181 \def\ProcessOptions{%
182 \let\ds@\@empty
183 \@ifundefined{opt@\@currname.\@currext}{%
184 \let\@curroptions\@empty
185 }{%
186 \expandafter\expandafter\expandafter\def
187 \expandafter\expandafter\expandafter\@curroptions
188 \expandafter\expandafter\expandafter{%
189 \csname opt@\@currname.\@currext\endcsname
190 }%
191 }%
192 \@ifstar\KVO@xprocess@ptions\KVO@process@ptions
193 }
194 \def\KVO@process@ptions{%
195 \@for\CurrentOption:=\@declaredoptions\do{%
196 \ifx\CurrentOption\@empty
197 \else
198 \begingroup
199 \ifx\@currext\@clsextension
200 \toks@{}%
201 \else
202 \KVO@GetClassOptionsList
203 \toks@\expandafter{\KVO@classoptionslist,}%
204 \fi
205 \toks\tw@\expandafter{\@curroptions}%
206 \edef\x{\endgroup
207 \noexpand\in@{,\CurrentOption,}{,\the\toks@\the\toks\tw@,}%
208 }%
209 \x
210 \ifin@
211 \KVO@use@ption
212 \expandafter\let\csname ds@\CurrentOption\endcsname\@empty
213 \fi
214 \fi
215 }%
216 \KVO@process@pti@ns
217 }
218 \def\KVO@xprocess@ptions{%
219 \ifx\@currext\@clsextension
220 \else
221 \KVO@GetClassOptionsList
222 \@for\CurrentOption:=\KVO@classoptionslist\do{%
223 \ifx\CurrentOption\@empty
224 \else
225 \KVO@in@\CurrentOption\@declaredoptions
226 \ifin@
227 \KVO@use@ption
228 \expandafter\let\csname ds@\CurrentOption\endcsname\@empty
229 \fi
230 \fi
231 }%
232 \fi
233 \KVO@process@pti@ns
234 }
235 \def\KVO@in@#1#2{%
236 \in@false
237 \begingroup
238 \@for\x:=#2\do{%
239 \ifx\x#1\relax
240 \in@true
241 \fi
242 }%
243 \edef\x{\endgroup
244 \ifin@
245 \noexpand\in@true
246 \fi
247 }%
248 \x
249 }
250 \def\KVO@process@pti@ns{%
251 \@for\CurrentOption:=\@curroptions\do{%
252 \@ifundefined{ds@\KVO@SanitizedCurrentOption}{%
253 \KVO@use@ption
254 \default@ds
255 }%
256 \KVO@use@ption
257 }%
258 \@for\CurrentOption:=\@declaredoptions\do{%
259 \expandafter\let\csname ds@\CurrentOption\endcsname\relax
260 }%
261 \let\CurrentOption\@empty
262 \let\@fileswith@pti@ns\@@fileswith@pti@ns
263 \AtEndOfPackage{\let\@unprocessedoptions\relax}%
264 }
265 \def\KVO@use@ption{%
266 \begingroup
267 \edef\x{\endgroup
268 \noexpand\@removeelement{%
269 \detokenize\expandafter{\CurrentOption}%
270 }{%
271 \detokenize\expandafter{\@unusedoptionlist}%
272 }%
273 }%
274 \x\@unusedoptionlist
275 \csname ds@\KVO@SanitizedCurrentOption\endcsname
276 }
277 \def\OptionNotUsed{%
278 \ifx\@currext\@clsextension
279 \xdef\@unusedoptionlist{%
280 \ifx\@unusedoptionlist\@empty
281 \else
282 \detokenize\expandafter{\@unusedoptionlist,}%
283 \fi
284 \detokenize\expandafter{\CurrentOption}%
285 }%
286 \fi
287 }
288 \def\CurrentOption@SaveLevel{0}
289 \def\ExecuteOptions{%
290 \expandafter\KVO@ExecuteOptions
291 \csname CurrentOption@\CurrentOption@SaveLevel\endcsname
292 }
293 \def\KVO@ExecuteOptions#1#2{%
294 \let#1\CurrentOption
295 \edef\CurrentOption@SaveLevel{%
296 \the\numexpr\CurrentOption@SaveLevel+1%
297 }%
298 \@for\CurrentOption:=#2\do{%
299 \csname ds@\CurrentOption\endcsname
300 }%
301 \edef\CurrentOption@SaveLevel{%
302 \the\numexpr\CurrentOption@SaveLevel-1%
303 }%
304 \let\CurrentOption#1%
305 }
306 \def\KVO@fileswith@pti@ns#1[#2]#3[#4]{%
307 \ifx#1\@clsextension
308 \ifx\@classoptionslist\relax
309 \KVO@normalize\KVO@temp{#2}%
310 \expandafter\gdef\expandafter\@classoptionslist\expandafter{%
311 \KVO@temp
312 }%
313 \def\reserved@a{%
314 \KVO@onefilewithoptions{#3}[{#2}][{#4}]#1%
315 \@documentclasshook
316 }%
317 \else
318 \def\reserved@a{%
319 \KVO@onefilewithoptions{#3}[{#2}][{#4}]#1%
320 }%
321 \fi
322 \else
323 \begingroup
324 \let\KVO@temp\relax
325 \let\KVO@onefilewithoptions\relax
326 \let\@pkgextension\relax
327 \def\reserved@b##1,{%
328 \ifx\@nil##1\relax
329 \else
330 \ifx\relax##1\relax
331 \else
332 \KVO@onefilewithoptions{##1}[{\KVO@temp}][{#4}]%
333 \@pkgextension
334 \fi
335 \expandafter\reserved@b
336 \fi
337 }%
338 \edef\reserved@a{\zap@space#3 \@empty}%
339 \edef\reserved@a{\expandafter\reserved@b\reserved@a,\@nil,}%
340 \toks@{#2}%
341 \def\KVO@temp{\the\toks@}%
342 \edef\reserved@a{\endgroup \reserved@a}%
343 \fi
344 \reserved@a
345 }
346 \def\KVO@onefilewithoptions#1[#2][#3]#4{%
347 \@pushfilename
348 \xdef\@currname{#1}%
349 \global\let\@currext#4%
350 \expandafter\let\csname\@currname.\@currext-h@@k\endcsname\@empty
351 \let\CurrentOption\@empty
352 \@reset@ptions
353 \makeatletter
354 \def\reserved@a{%
355 \@ifl@aded\@currext{#1}{%
356 \@if@ptions\@currext{#1}{#2}{%
357 }{%
358 \begingroup
359 \@ifundefined{opt@#1.\@currext}{%
360 \def\x{}%
361 }{%
362 \edef\x{%
363 \expandafter\expandafter\expandafter\strip@prefix
364 \expandafter\meaning\csname opt@#1.\@currext\endcsname
365 }%
366 }%
367 \def\y{#2}%
368 \edef\y{\expandafter\strip@prefix\meaning\y}%
369 \@latex@error{Option clash for \@cls@pkg\space #1}{%
370 The package #1 has already been loaded %
371 with options:\MessageBreak
372 \space\space[\x]\MessageBreak
373 There has now been an attempt to load it %
374 with options\MessageBreak
375 \space\space[\y]\MessageBreak
376 Adding the global options:\MessageBreak
377 \space\space
378 \x,\y\MessageBreak
379 to your \noexpand\documentclass declaration may fix this.%
380 \MessageBreak
381 Try typing \space <return> \space to proceed.%
382 }%
383 \endgroup
384 }%
385 }{%
386 \@pass@ptions\@currext{#2}{#1}%
387 \global\expandafter
388 \let\csname ver@\@currname.\@currext\endcsname\@empty
389 \InputIfFileExists
390 {\@currname.\@currext}%
391 {}%
392 {\@missingfileerror\@currname\@currext}%
393 \let\@unprocessedoptions\@@unprocessedoptions
394 \csname\@currname.\@currext-h@@k\endcsname
395 \expandafter\let\csname\@currname.\@currext-h@@k\endcsname
396 \@undefined
397 \@unprocessedoptions
398 }%
399 \@ifl@ter\@currext{#1}{#3}{%
400 }{%
401 \@latex@warning@no@line{%
402 You have requested,\on@line, %
403 version\MessageBreak
404 #3' of \@cls@pkg\space #1,\MessageBreak
405 but only version\MessageBreak
406 `\csname ver@#1.\@currext\endcsname'\MessageBreak
407 is available%
408 }%
409 }%
410 \ifx\@currext\@clsextension\let\LoadClass\@twoloadclasserror\fi
411 \@popfilename
412 \@reset@ptions
413 }%
414 \reserved@a
415 }
416 \def\@unknownoptionerror{%
417 \@latex@error{%
418 Unknown option `\KVO@SanitizedCurrentOption' %
419 for \@cls@pkg\space`\@currname'%
420 }{%
421 The option `\KVO@SanitizedCurrentOption' was not declared in %
422 \@cls@pkg\space`\@currname', perhaps you\MessageBreak
423 misspelled its name. %
424 Try typing \space <return> %
425 \space to proceed.%
426 }%
427 }
428 \def\@@unprocessedoptions{%
429 \ifx\@currext\@pkgextension
430 \@ifundefined{opt@\@currname.\@currext}{%
431 \let\@curroptions\@empty
432 }{%
433 \expandafter\let\expandafter\@curroptions
434 \csname opt@\@currname.\@currext\endcsname
435 }%
436 \@for\CurrentOption:=\@curroptions\do{%
437 \ifx\CurrentOption\@empty\else\@unknownoptionerror\fi
438 }%
439 \fi
440 }
441 \def\KVO@SanitizedCurrentOption{%
442 \expandafter\strip@prefix\meaning\CurrentOption
443 }
444 \def\KVO@normalize#1#2{%
445 \let\KVO@result\@empty
446 \KVO@splitcomma#2,\@nil
447 \let#1\KVO@result
448 }
449 \def\KVO@splitcomma#1,#2\@nil{%
450 \KVO@ifempty{#1}{}{%
451 \KVO@checkkv#1=\@nil
452 }%
453 \KVO@ifempty{#2}{}{\KVO@splitcomma#2\@nil}%
454 }
455 \def\KVO@ifempty#1{%
456 \expandafter\ifx\expandafter\\\detokenize{#1}\\%
457 \expandafter\@firstoftwo
458 \else
459 \expandafter\@secondoftwo
460 \fi
461 }
462 \def\KVO@checkkv#1=#2\@nil{%
463 \KVO@ifempty{#2}{%
464 % option without value
465 \edef\KVO@x{\zap@space#1 \@empty}%
466 \ifx\KVO@x\@empty
467 % ignore empty option
468 \else
469 % append to list
470 \edef\KVO@result{%
471 \etex@unexpanded\expandafter{\KVO@result},\KVO@x
472 }%
473 \fi
474 }{%
475 % #1: "key", #2: "value="
476 % add key part
477 \edef\KVO@result{%
478 \etex@unexpanded\expandafter{\KVO@result},%
479 \zap@space#1 \@empty
480 }%
481 \futurelet\@let@token\KVO@checkfirsttok#2 \@nil| = \@nil|\KVO@nil
482 }%
483 }
484 \def\KVO@checkfirsttok{%
485 \ifx\@let@token\bgroup
486 % no space at start
487 \expandafter\KVO@removelastspace\expandafter=%
488 % "<value><spaceopt>= \@nil"
489 \else
490 \expandafter\KVO@checkfirstA
491 \fi
492 }
493 \def\KVO@checkfirstA#1 #2\@nil{%
494 \KVO@ifempty{#2}{%
495 \KVO@removelastspace=#1 \@nil
496 }{%
497 \KVO@ifempty{#1}{%
498 \KVO@removelastspace=#2\@nil
499 }{%
500 \KVO@removelastspace=#1 #2\@nil
501 }%
502 }%
503 }
504 \def\KVO@removelastspace#1 = \@nil|#2\KVO@nil{%
505 \KVO@ifempty{#2}{%
506 \edef\KVO@result{%
507 \etex@unexpanded\expandafter{\KVO@result}%
508 \etex@unexpanded\expandafter{\KVO@removegarbage#1\KVO@nil}%
509 }%
510 }{%
511 \edef\KVO@result{%
512 \etex@unexpanded\expandafter{\KVO@result}%
513 \etex@unexpanded{#1}%
514 }%
515 }%
516 }
517 \def\KVO@removegarbage#1= \@nil#2\KVO@nil{#1}%
518 \def\KVO@removeelement#1#2{%
519 \begingroup
520 \toks@={}%
521 \@for\x:=#2\do{%
522 \ifx\x\@empty
523 \else
524 \ifx\x#1\relax
525 \else
526 \edef\t{\the\toks@}%
527 \ifx\t\@empty
528 \else
529 \toks@\expandafter{\the\toks@,}%
530 \fi
531 \toks@\expandafter{\the\expandafter\toks@\x}%
532 \fi
533 \fi
534 }%
535 \edef\x{\endgroup
536 \def\noexpand#2{\the\toks@}%
537 }%
538 \x
539 }
540 \let\@@fileswith@pti@ns\KVO@fileswith@pti@ns
541 \ifx\@fileswith@pti@ns\@badrequireerror
542 \else
543 \let\@fileswith@pti@ns\KVO@fileswith@pti@ns
544 \fi
545 \let\KVO@Patch=Y
546 \KVO@AtEnd%
547 \endinput
548 %%
549 %% End of file `kvoptions-patch.sty'.