Debian Codegraph @

texmf-dist/tex/generic/alphalph/alphalph.sty

raw
1 %%
2 %% This is file `alphalph.sty',
3 %% generated with the docstrip utility.
4 %%
5 %% The original source files were:
6 %%
7 %% alphalph.dtx (with options: `package')
8 %%
9 %% This is a generated file.
10 %%
11 %% Project: alphalph
12 %% Version: 2019/12/09 v2.6
13 %%
14 %% Copyright (C)
15 %% 1999, 2006-2008, 2010, 2011 Heiko Oberdiek
16 %% 2016-2019 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/alphalph/issues
33 %%
34 %%
35 %% The Base Interpreter refers to any `TeX-Format',
36 %% because some files are installed in TDS:tex/generic//.
37 %%
38 %% This work consists of the main source file alphalph.dtx
39 %% and the derived files
40 %% alphalph.sty, alphalph.pdf, alphalph.ins, alphalph.drv,
41 %% alphalph-test1.tex, alphalph-test2.tex, alphalph-test3.tex.
42 %%
43 \begingroup\catcode61\catcode48\catcode32=10\relax%
44 \catcode13=5 % ^^M
45 \endlinechar=13 %
46 \catcode35=6 % #
47 \catcode39=12 % '
48 \catcode44=12 % ,
49 \catcode45=12 % -
50 \catcode46=12 % .
51 \catcode58=12 % :
52 \catcode64=11 % @
53 \catcode123=1 % {
54 \catcode125=2 % }
55 \expandafter\let\expandafter\x\csname [email protected]\endcsname
56 \ifx\x\relax % plain-TeX, first loading
57 \else
58 \def\empty{}%
59 \ifx\x\empty % LaTeX, first loading,
60 % variable is initialized, but \ProvidesPackage not yet seen
61 \else
62 \expandafter\ifx\csname PackageInfo\endcsname\relax
63 \def\x#1#2{%
64 \immediate\write-1{Package #1 Info: #2.}%
65 }%
66 \else
67 \def\x#1#2{\PackageInfo{#1}{#2, stopped}}%
68 \fi
69 \x{alphalph}{The package is already loaded}%
70 \aftergroup\endinput
71 \fi
72 \fi
73 \endgroup%
74 \begingroup\catcode61\catcode48\catcode32=10\relax%
75 \catcode13=5 % ^^M
76 \endlinechar=13 %
77 \catcode35=6 % #
78 \catcode39=12 % '
79 \catcode40=12 % (
80 \catcode41=12 % )
81 \catcode44=12 % ,
82 \catcode45=12 % -
83 \catcode46=12 % .
84 \catcode47=12 % /
85 \catcode58=12 % :
86 \catcode64=11 % @
87 \catcode91=12 % [
88 \catcode93=12 % ]
89 \catcode123=1 % {
90 \catcode125=2 % }
91 \expandafter\ifx\csname ProvidesPackage\endcsname\relax
92 \def\x#1#2#3[#4]{\endgroup
93 \immediate\write-1{Package: #3 #4}%
94 \xdef#1{#4}%
95 }%
96 \else
97 \def\x#1#2[#3]{\endgroup
98 #2[{#3}]%
99 \ifx#1\@undefined
100 \xdef#1{#3}%
101 \fi
102 \ifx#1\relax
103 \xdef#1{#3}%
104 \fi
105 }%
106 \fi
107 \expandafter\x\csname [email protected]\endcsname
108 \ProvidesPackage{alphalph}%
109 [2019/12/09 v2.6 Convert numbers to letters (HO)]%
110 \begingroup\catcode61\catcode48\catcode32=10\relax%
111 \catcode13=5 % ^^M
112 \endlinechar=13 %
113 \catcode123=1 % {
114 \catcode125=2 % }
115 \catcode64=11 % @
116 \def\x{\endgroup
117 \expandafter\edef\csname AlPh@AtEnd\endcsname{%
118 \endlinechar=\the\endlinechar\relax
119 \catcode13=\the\catcode13\relax
120 \catcode32=\the\catcode32\relax
121 \catcode35=\the\catcode35\relax
122 \catcode61=\the\catcode61\relax
123 \catcode64=\the\catcode64\relax
124 \catcode123=\the\catcode123\relax
125 \catcode125=\the\catcode125\relax
126 }%
127 }%
128 \x\catcode61\catcode48\catcode32=10\relax%
129 \catcode13=5 % ^^M
130 \endlinechar=13 %
131 \catcode35=6 % #
132 \catcode64=11 % @
133 \catcode123=1 % {
134 \catcode125=2 % }
135 \def\TMP@EnsureCode#1#2{%
136 \edef\AlPh@AtEnd{%
137 \AlPh@AtEnd
138 \catcode#1=\the\catcode#1\relax
139 }%
140 \catcode#1=#2\relax
141 }
142 \TMP@EnsureCode{33}{12}% !
143 \TMP@EnsureCode{39}{12}% '
144 \TMP@EnsureCode{40}{12}% (
145 \TMP@EnsureCode{41}{12}% )
146 \TMP@EnsureCode{43}{12}% +
147 \TMP@EnsureCode{44}{12}% ,
148 \TMP@EnsureCode{46}{12}% .
149 \TMP@EnsureCode{47}{12}% /
150 \TMP@EnsureCode{59}{12}% ;
151 \TMP@EnsureCode{60}{12}% <
152 \TMP@EnsureCode{62}{12}% >
153 \TMP@EnsureCode{91}{12}% [
154 \TMP@EnsureCode{93}{12}% ]
155 \TMP@EnsureCode{96}{12}% `
156 \TMP@EnsureCode{124}{12}% |
157 \edef\AlPh@AtEnd{\AlPh@AtEnd\noexpand\endinput}
158 \begingroup\expandafter\expandafter\expandafter\endgroup
159 \expandafter\ifx\csname RequirePackage\endcsname\relax
160 \input infwarerr.sty\relax
161 \input intcalc.sty\relax
162 \else
163 \RequirePackage{infwarerr}[2007/09/09]%
164 \RequirePackage{intcalc}[2007/09/09]%
165 \fi
166 \begingroup\expandafter\expandafter\expandafter\endgroup
167 \expandafter\ifx\csname numexpr\endcsname\relax
168 \catcode124=9 % '!': ignore
169 \catcode43=14 % '+': comment
170 \else
171 \catcode124=14 % '!': comment
172 \catcode43=9 % '+': ignore
173 \fi
174 \def\AlPh@Error#1{%
175 \begingroup
176 \escapechar=92 % backslash
177 \@PackageError{alphalph}{#1}\@ehc
178 \endgroup
179 }
180 \begingroup\expandafter\expandafter\expandafter\endgroup
181 \expandafter\ifx\csname @ifdefinable\endcsname\relax
182 \def\AlPh@IfDefinable#1#2{%
183 \ifcase\ifx#1\@undefined\else\ifx#1\relax\else1\fi\fi0 %
184 #2%
185 \else
186 \AlPh@Error{%
187 Command \string#1 already defined%
188 }%
189 \fi
190 }%
191 \else
192 \let\AlPh@IfDefinable\@ifdefinable
193 \fi
194 \long\def\@ReturnAfterElseFi#1\else#2\fi{\fi#1}
195 \long\def\@ReturnAfterFi#1\fi{\fi#1}
196 \expandafter\ifx\csname @gobblefour\endcsname\relax
197 \long\def\@gobblefour#1#2#3#4{}%
198 \fi
199 \begingroup\expandafter\expandafter\expandafter\endgroup
200 \expandafter\ifx\csname kernel@ifnextchar\endcsname\relax
201 \begingroup\expandafter\expandafter\expandafter\endgroup
202 \expandafter\ifx\csname @ifnextchar\endcsname\relax
203 \def\AlPh@IfOptArg#1#2{%
204 \def\AlPh@TempA{#1}%
205 \def\AlPh@TempB{#2}%
206 \futurelet\AlPh@Token\AlPh@IfOptArgNext
207 }%
208 \let\AlPh@BracketLeft=[%]
209 \def\AlPh@IfOptArgNext{%
210 \ifx\AlPh@Token\AlPh@BracketLeft
211 \expandafter\AlPh@TempA
212 \else
213 \expandafter\AlPh@TempB
214 \fi
215 }%
216 \else
217 \def\AlPh@IfOptArg{\@ifnextchar[}%]
218 \fi
219 \else
220 \def\AlPh@IfOptArg{\kernel@ifnextchar[}%]
221 \fi
222 \def\alphalph@Alph#1{%
223 \ifcase#1%
224 @%
225 \or A\or B\or C\or D\or E\or F\or G\or H\or I\or J\or K\or L\or M%
226 \or N\or O\or P\or Q\or R\or S\or T\or U\or V\or W\or X\or Y\or Z%
227 \else
228 \AlPh@ctrerr
229 @%
230 \fi
231 }
232 \def\alphalph@alph#1{%
233 \ifcase#1%
234 @%
235 \or a\or b\or c\or d\or e\or f\or g\or h\or i\or j\or k\or l\or m%
236 \or n\or o\or p\or q\or r\or s\or t\or u\or v\or w\or x\or y\or z%
237 \else
238 \AlPh@ctrerr
239 @%
240 \fi
241 }
242 \def\AlPh@ctrerr{}
243 \def\AlPh@GetNumberOfSymbols#1{%
244 \AlPh@TestNumber1!{#1}%
245 \ifAlPh@Unavailable
246 \def\AlPh@Number{0}%
247 \AlPh@Error{No symbols found}%
248 \else
249 \def\AlPh@Number{1}%
250 \AlPh@ExpSearch2!{#1}%
251 \fi
252 }
253 \let\ifAlPh@Unavailable\iffalse
254 \def\AlPh@Unavailabletrue{%
255 \global\let\ifAlPh@Unavailable\iftrue
256 }
257 \def\AlPh@Unavailablefalse{%
258 \global\let\ifAlPh@Unavailable\iffalse
259 }
260 \def\AlPh@TestNumber#1!#2{%
261 \AlPh@Unavailablefalse
262 \begingroup
263 \setbox0=\hbox{%
264 \begingroup % color
265 \let\@ctrerr\AlPh@Unavailabletrue
266 \let\AlPh@ctrerr\AlPh@Unavailabletrue
267 #2{#1}%
268 \endgroup
269 }%
270 \ifdim\wd0=0pt %
271 \AlPh@Unavailabletrue
272 \fi
273 \endgroup
274 }
275 \def\AlPh@ExpSearch#1!#2{%
276 \let\AlPh@Next\relax
277 \AlPh@TestNumber#1!{#2}%
278 \ifAlPh@Unavailable
279 \expandafter\AlPh@BinSearch\AlPh@Number!#1!{#2}%
280 \else
281 \def\AlPh@Number{#1}%
282 \ifnum#1>1073741823 %
283 \AlPh@TestNumber2147483647!{#2}%
284 \ifAlPh@Unavailable
285 \AlPh@BinSearch#1!2147483647!{#2}%
286 \else
287 \def\AlPh@Number{0}%
288 \AlPh@Error{%
289 Maximal symbol number not found%
290 }%
291 \fi
292 \else
293 \def\AlPh@Next{%
294 \expandafter\AlPh@ExpSearch\number\intcalcShl{#1}!{#2}%
295 }%
296 \fi
297 \fi
298 \AlPh@Next
299 }
300 \def\AlPh@BinSearch#1!#2!#3{%
301 \expandafter\AlPh@ProcessBinSearch
302 \number\intcalcShr{\intcalcAdd{#1}{#2}}!%
303 #1!#2!{#3}%
304 }
305 \def\AlPh@ProcessBinSearch#1!#2!#3!#4{%
306 \let\AlPh@Next\relax
307 \ifnum#1>#2 %
308 \ifnum#1<#3 %
309 \AlPh@TestNumber#1!{#4}%
310 \ifAlPh@Unavailable
311 \def\AlPh@Next{%
312 \AlPh@BinSearch#2!#1!{#4}%
313 }%
314 \else
315 \def\AlPh@Next{%
316 \AlPh@BinSearch#1!#3!{#4}%
317 }%
318 \fi
319 \else
320 \def\AlPh@Number{#2}%
321 \fi
322 \else
323 \def\AlPh@Number{#2}%
324 \fi
325 \AlPh@Next
326 }
327 \def\AlPh@CheckPositive#1!#2{%
328 \ifnum#1<1 %
329 \expandafter\@gobblefour
330 \fi
331 #2{#1}%
332 }
333 \def\AlPh@Method@alph#1#2#3{%
334 \expandafter\AlPh@CheckPositive
335 | \number#3!%
336 + \the\numexpr#3!%
337 \AlPh@ProcessAlph
338 {#1}{#2}%
339 }
340 \def\AlPh@ProcessAlph#1#2#3{%
341 \ifnum#1>#2 %
342 \@ReturnAfterElseFi{%
343 \expandafter\AlPh@StepAlph\number
344 \intcalcInc{%
345 \intcalcMod{\intcalcDec{#1}}{#2}%
346 }%
347 \expandafter!\number
348 \intcalcDiv{\intcalcDec{#1}}{#2}%
349 !{#2}{#3}%
350 }%
351 \else
352 \@ReturnAfterFi{%
353 #3{#1}%
354 }%
355 \fi
356 }
357 \def\AlPh@StepAlph#1!#2!#3#4{%
358 \AlPh@ProcessAlph{#2}{#3}{#4}%
359 #4{#1}%
360 }
361 \def\AlPh@Method@wrap#1#2#3{%
362 \expandafter\AlPh@CheckPositive
363 | \number#3!%
364 + \the\numexpr#3!%
365 \AlPh@ProcessWrap
366 {#1}{#2}%
367 }
368 \def\AlPh@ProcessWrap#1#2#3{%
369 \ifnum#1>#2 %
370 \@ReturnAfterElseFi{%
371 \expandafter\AlPh@StepWrap\number
372 \intcalcInc{\intcalcMod{\intcalcDec{#1}}{#2}}%
373 !{#3}%
374 }%
375 \else
376 \@ReturnAfterFi{%
377 #3{#1}%
378 }%
379 \fi
380 }
381 \def\AlPh@StepWrap#1!#2{%
382 #2{#1}%
383 }
384 \def\AlPh@Method@mult#1#2#3{%
385 \expandafter\AlPh@CheckPositive
386 | \number#3!%
387 + \the\numexpr#3!%
388 \AlPh@ProcessMult
389 {#1}{#2}%
390 }
391 \def\AlPh@ProcessMult#1#2#3{%
392 \ifnum#1>#2 %
393 \@ReturnAfterElseFi{%
394 \expandafter\AlPh@StepMult\romannumeral
395 \intcalcInc{\intcalcDiv{\intcalcDec{#1}}{#2}}%
396 000%
397 \expandafter!\number
398 \intcalcInc{\intcalcMod{\intcalcDec{#1}}{#2}}%
399 !{#3}%
400 }%
401 \else
402 \@ReturnAfterFi{%
403 #3{#1}%
404 }%
405 \fi
406 }
407 \def\AlPh@StepMult#1#2!#3!#4{%
408 \ifx\\#2\\%
409 \else
410 \@ReturnAfterFi{%
411 \AlPh@StepMult#2!#3!{#4}%
412 }%
413 \fi
414 #4{#3}%
415 }
416 \AlPh@IfDefinable\newalphalph{%
417 \def\newalphalph#1{%
418 \AlPh@IfOptArg{%
419 \AlPh@newalphalph{#1}%
420 }{%
421 \AlPh@newalphalph{#1}[alph]%
422 }%
423 }%
424 }
425 \def\AlPh@newalphalph#1[#2]#3#4{%
426 \begingroup\expandafter\expandafter\expandafter\endgroup
427 \expandafter\ifx\csname AlPh@Method@#2\endcsname\relax
428 \AlPh@Error{%
429 Unknown method %
430 | `#2'%
431 + `\detokenize{#2}'%
432 }%
433 \else
434 \ifx\\#4\\%
435 \AlPh@GetNumberOfSymbols{#3}%
436 \ifcase\AlPh@Number
437 \else
438 \begingroup
439 \escapechar=92 % backslash
440 \@PackageInfo{alphalph}{%
441 Number of symbols for \string#1 is \AlPh@Number
442 }%
443 \endgroup
444 \expandafter\AlPh@NewAlphAlph
445 \csname AlPh@Method@#2\expandafter\endcsname
446 \AlPh@Number!{#1}{#3}%
447 \fi
448 \else
449 \expandafter\AlPh@NewAlphAlph
450 \csname AlPh@Method@#2\expandafter\endcsname
451 | \number#4!%
452 + \the\numexpr#4!%
453 {#1}{#3}%
454 \fi
455 \fi
456 }%
457 \def\AlPh@NewAlphAlph#1#2!#3#4{%
458 \AlPh@IfDefinable#3{%
459 \ifnum#2>0 %
460 \def#3{#1{#2}{#4}}%
461 \else
462 \AlPh@Error{%
463 Definition of \string#3 failed,\MessageBreak
464 because number of symbols (#2) is not positive%
465 }%
466 \fi
467 }%
468 }
469 \newalphalph\AlphAlph\alphalph@Alph{26}
470 \newalphalph\alphalph\alphalph@alph{26}
471 \AlPh@AtEnd%
472 \endinput
473 %%
474 %% End of file `alphalph.sty'.