Debian Codegraph @

texmf-dist/source/latex/magicnum/magicnum.dtx

raw
1 % \iffalse meta-comment
2 %
3 % File: magicnum.dtx
4 % Version: 2019/11/29 v1.7
5 % Info: Magic numbers
6 %
7 % Copyright (C)
8 % 2007, 2009-2011 Heiko Oberdiek
9 % 2016-2019 Oberdiek Package Support Group
10 % https://github.com/ho-tex/magicnum/issues
11 %
12 % This work may be distributed and/or modified under the
13 % conditions of the LaTeX Project Public License, either
14 % version 1.3c of this license or (at your option) any later
15 % version. This version of this license is in
16 % https://www.latex-project.org/lppl/lppl-1-3c.txt
17 % and the latest version of this license is in
18 % https://www.latex-project.org/lppl.txt
19 % and version 1.3 or later is part of all distributions of
20 % LaTeX version 2005/12/01 or later.
21 %
22 % This work has the LPPL maintenance status "maintained".
23 %
24 % The Current Maintainers of this work are
25 % Heiko Oberdiek and the Oberdiek Package Support Group
26 % https://github.com/ho-tex/magicnum/issues
27 %
28 % The Base Interpreter refers to any `TeX-Format',
29 % because some files are installed in TDS:tex/generic//.
30 %
31 % This work consists of the main source file magicnum.dtx
32 % and the derived files
33 % magicnum.sty, magicnum.pdf, magicnum.ins, magicnum.drv, magicnum.txt,
34 % magicnum.lua.
35 %
36 % Distribution:
37 % CTAN:macros/latex/contrib/magicnum/magicnum.dtx
38 % CTAN:macros/latex/contrib/magicnum/magicnum.pdf
39 %
40 % Unpacking:
41 % (a) If magicnum.ins is present:
42 % tex magicnum.ins
43 % (b) Without magicnum.ins:
44 % tex magicnum.dtx
45 % (c) If you insist on using LaTeX
46 % latex \let\install=y\input{magicnum.dtx}
47 % (quote the arguments according to the demands of your shell)
48 %
49 % Documentation:
50 % (a) If magicnum.drv is present:
51 % latex magicnum.drv
52 % (b) Without magicnum.drv:
53 % latex magicnum.dtx; ...
54 % The class ltxdoc loads the configuration file ltxdoc.cfg
55 % if available. Here you can specify further options, e.g.
56 % use A4 as paper format:
57 % \PassOptionsToClass{a4paper}{article}
58 %
59 % Programm calls to get the documentation (example):
60 % pdflatex magicnum.dtx
61 % makeindex -s gind.ist magicnum.idx
62 % pdflatex magicnum.dtx
63 % makeindex -s gind.ist magicnum.idx
64 % pdflatex magicnum.dtx
65 %
66 % Installation:
67 % TDS:tex/generic/magicnum/magicnum.sty
68 % TDS:scripts/magicnum/magicnum.lua
69 % TDS:doc/latex/magicnum/magicnum.pdf
70 % TDS:doc/latex/magicnum/magicnum.txt
71 % TDS:source/latex/magicnum/magicnum.dtx
72 %
73 %<*ignore>
74 \begingroup
75 \catcode123=1 %
76 \catcode125=2 %
77 \def\x{LaTeX2e}%
78 \expandafter\endgroup
79 \ifcase 0\ifx\install y1\fi\expandafter
80 \ifx\csname processbatchFile\endcsname\relax\else1\fi
81 \ifx\fmtname\x\else 1\fi\relax
82 \else\csname fi\endcsname
83 %</ignore>
84 %<*install>
85 \input docstrip.tex
86 \Msg{************************************************************************}
87 \Msg{* Installation}
88 \Msg{* Package: magicnum 2019/11/29 v1.7 Magic numbers (HO)}
89 \Msg{************************************************************************}
90
91 \keepsilent
92 \askforoverwritefalse
93
94 \let\MetaPrefix\relax
95 \preamble
96
97 This is a generated file.
98
99 Project: magicnum
100 Version: 2019/11/29 v1.7
101
102 Copyright (C)
103 2007, 2009-2011 Heiko Oberdiek
104 2016-2019 Oberdiek Package Support Group
105
106 This work may be distributed and/or modified under the
107 conditions of the LaTeX Project Public License, either
108 version 1.3c of this license or (at your option) any later
109 version. This version of this license is in
110 https://www.latex-project.org/lppl/lppl-1-3c.txt
111 and the latest version of this license is in
112 https://www.latex-project.org/lppl.txt
113 and version 1.3 or later is part of all distributions of
114 LaTeX version 2005/12/01 or later.
115
116 This work has the LPPL maintenance status "maintained".
117
118 The Current Maintainers of this work are
119 Heiko Oberdiek and the Oberdiek Package Support Group
120 https://github.com/ho-tex/magicnum/issues
121
122
123 The Base Interpreter refers to any `TeX-Format',
124 because some files are installed in TDS:tex/generic//.
125
126 This work consists of the main source file magicnum.dtx
127 and the derived files
128 magicnum.sty, magicnum.pdf, magicnum.txt, magicnum.lua.
129
130 \endpreamble
131 \let\MetaPrefix\DoubleperCent
132
133 \generate{%
134 \file{magicnum.ins}{\from{magicnum.dtx}{install}}%
135 \file{magicnum.drv}{\from{magicnum.dtx}{driver}}%
136 \usedir{tex/generic/magicnum}%
137 \file{magicnum.sty}{\from{magicnum.dtx}{package}}%
138 % \usedir{doc/latex/magicnum/test}%
139 % \file{magicnum-test1.tex}{\from{magicnum.dtx}{test1}}%
140 % \file{magicnum-test2.tex}{\from{magicnum.dtx}{testplain,testdata}}%
141 % \file{magicnum-test3.tex}{\from{magicnum.dtx}{testlatex,testdata}}%
142 % \file{magicnum-test4.tex}{\from{magicnum.dtx}{test4}}%
143 \nopreamble
144 \nopostamble
145 \usedir{doc/latex/magicnum}%
146 \file{magicnum.txt}{\from{magicnum.dtx}{data}}%
147 % \usedir{source/latex/magicnum/catalogue}%
148 % \file{magicnum.xml}{\from{magicnum.dtx}{catalogue}}%
149 }
150 \def\MetaPrefix{-- }
151 \def\defaultpostamble{%
152 \MetaPrefix^^J%
153 \MetaPrefix\space End of File `\outFileName'.%
154 }
155 \def\currentpostamble{\defaultpostamble}%
156 \generate{%
157 \usedir{scripts/magicnum}%
158 \file{magicnum.lua}{\from{magicnum.dtx}{lua}}%
159 }
160
161 \catcode32=13\relax% active space
162 \let =\space%
163 \Msg{************************************************************************}
164 \Msg{*}
165 \Msg{* To finish the installation you have to move the following}
166 \Msg{* file into a directory searched by TeX:}
167 \Msg{*}
168 \Msg{* magicnum.sty}
169 \Msg{*}
170 \Msg{* And install the following script file:}
171 \Msg{*}
172 \Msg{* magicnum.lua}
173 \Msg{*}
174 \Msg{* To produce the documentation run the file `magicnum.drv'}
175 \Msg{* through LaTeX.}
176 \Msg{*}
177 \Msg{* Happy TeXing!}
178 \Msg{*}
179 \Msg{************************************************************************}
180
181 \endbatchfile
182 %</install>
183 %<*ignore>
184 \fi
185 %</ignore>
186 %<*driver>
187 \NeedsTeXFormat{LaTeX2e}
188 \ProvidesFile{magicnum.drv}%
189 [2019/11/29 v1.7 Magic numbers (HO)]%
190 \documentclass{ltxdoc}
191 \usepackage{holtxdoc}[2011/11/22]
192 \usepackage{array}
193 \begin{document}
194 \DocInput{magicnum.dtx}%
195 \end{document}
196 %</driver>
197 % \fi
198 %
199 %
200 % \CharacterTable
201 % {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
202 % 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
203 % Digits \0\1\2\3\4\5\6\7\8\9
204 % Exclamation \! Double quote \" Hash (number) \#
205 % Dollar \$ Percent \% Ampersand \&
206 % Acute accent \' Left paren \( Right paren \)
207 % Asterisk \* Plus \+ Comma \,
208 % Minus \- Point \. Solidus \/
209 % Colon \: Semicolon \; Less than \<
210 % Equals \= Greater than \> Question mark \?
211 % Commercial at \@ Left bracket \[ Backslash \\
212 % Right bracket \] Circumflex \^ Underscore \_
213 % Grave accent \` Left brace \{ Vertical bar \|
214 % Right brace \} Tilde \~}
215 %
216 % \GetFileInfo{magicnum.drv}
217 %
218 % \title{The \xpackage{magicnum} package}
219 % \date{2019/11/29 v1.7}
220 % \author{Heiko Oberdiek\thanks
221 % {Please report any issues at \url{https://github.com/ho-tex/magicnum/issues}}}
222 %
223 % \maketitle
224 %
225 % \begin{abstract}
226 % This packages allows to access magic numbers by a hierarchical
227 % name system.
228 % \end{abstract}
229 %
230 % \tableofcontents
231 %
232 % \hypersetup{bookmarksopenlevel=2}
233 % \section{Documentation}
234 %
235 % \subsection{Introduction}
236 %
237 % Especially since \eTeX\ there are many integer values
238 % with special meanings, such as catcodes, group types, \dots
239 % Package \xpackage{etex}, enabled by options, defines
240 % macros in the user namespace for these values.
241 %
242 % This package goes another approach for storing the names and values.
243 % \begin{itemize}
244 % \item If \LuaTeX\ is available, they
245 % are stored in Lua tables.
246 % \item Without \LuaTeX\ they are remembered using internal
247 % macros.
248 % \end{itemize}
249 %
250 % \subsection{User interface}
251 %
252 % The integer values and names are organized in a hierarchical
253 % scheme of categories with the property names as leaves.
254 % Example: \eTeX's \cs{currentgrouplevel} reports |2| for a
255 % group caused by \cs{hbox}. This package has choosen to organize
256 % the group types in a main category |etex| and its subcategory
257 % |grouptype|:
258 % \begin{quote}
259 % |etex.grouptype.hbox| = |2|
260 % \end{quote}
261 % The property name |hbox| in category |etex.grouptype| has value |2|.
262 % Dots are used to separate components.
263 %
264 % If you want to have the value, the access key is constructed by
265 % the category with all its components and the property name.
266 % For the opposite the value is used instead of the property name.
267 %
268 % Values are always integers (including negative numbers).
269 %
270 % \subsubsection{\cs{magicnum}}
271 %
272 % \begin{declcs}{magicnum} \M{access key}
273 % \end{declcs}
274 % Macro \cs{magicnum} expects an access key as argument and
275 % expands to the requested data. The macro is always expandable.
276 % In case of errors the expansion result is empty.
277 %
278 % The same macro is also used for getting a property name.
279 % In this case the property name part in the access key is
280 % replaced by the value.
281 %
282 % The catcodes
283 % of the resulting numbers and strings follow \TeX's tradition of
284 % \cs{string}, \cs{meaning}, \dots: The space has catcode 10
285 % (|tex.catcode.space|) and the other characters have catcode
286 % 12 (|tex.catcode.other|).
287 %
288 % Examples:
289 % \begin{quote}
290 % |\magicnum{etex.grouptype.hbox}| $\Rightarrow$ |2|\\
291 % |\magicnum{tex.catcode.14}| $\Rightarrow$ |comment|\\
292 % |\magicnum{tex.catcode.undefined}| $\Rightarrow$ $\emptyset$
293 % \end{quote}
294 %
295 % \subsubsection{Properties}
296 %
297 % \begin{itemize}
298 % \item The components of a category are either subcategories or
299 % key value pairs, but not both.
300 % \item The full specified property names are unique and thus
301 % has one integer value exactly.
302 % \item Also the values inside a category are unique.
303 % This condition is a prerequisite for the reverse mapping
304 % of \cs{magicnum}.
305 % \item All names start with a letter. Only letters or digits
306 % may follow.
307 % \end{itemize}
308 %
309 % \subsection{Data}
310 %
311 % \subsubsection{\texorpdfstring{Category }{}\texttt{tex.catcode}}
312 %
313 % \begin{quote}
314 % \begin{tabular}{@{}>{\ttfamily}l>{\ttfamily}l@{}}
315 % tex.catcode.escape & 0\\
316 % tex.catcode.begingroup & 1\\
317 % tex.catcode.endgroup & 2\\
318 % tex.catcode.math & 3\\
319 % tex.catcode.align & 4\\
320 % tex.catcode.eol & 5\\
321 % tex.catcode.parameter & 6\\
322 % tex.catcode.superscript & 7\\
323 % tex.catcode.subscript & 8\\
324 % tex.catcode.ignore & 9\\
325 % tex.catcode.space & 10\\
326 % tex.catcode.letter & 11\\
327 % tex.catcode.other & 12\\
328 % tex.catcode.active & 13\\
329 % tex.catcode.comment & 14\\
330 % tex.catcode.invalid & 15\\
331 % \end{tabular}
332 % \end{quote}
333 %
334 % \subsubsection{\texorpdfstring{Category }{}\texttt{etex.grouptype}}
335 %
336 % \begin{quote}
337 % \begin{tabular}{@{}>{\ttfamily}l>{\ttfamily}l@{}}
338 % etex.grouptype.bottomlevel & 0\\
339 % etex.grouptype.simple & 1\\
340 % etex.grouptype.hbox & 2\\
341 % etex.grouptype.adjustedhbox & 3\\
342 % etex.grouptype.vbox & 4\\
343 % etex.grouptype.align & 5\\
344 % etex.grouptype.noalign & 6\\
345 % etex.grouptype.output & 8\\
346 % etex.grouptype.math & 9\\
347 % etex.grouptype.disc & 10\\
348 % etex.grouptype.insert & 11\\
349 % etex.grouptype.vcenter & 12\\
350 % etex.grouptype.mathchoice & 13\\
351 % etex.grouptype.semisimple & 14\\
352 % etex.grouptype.mathshift & 15\\
353 % etex.grouptype.mathleft & 16\\
354 % \end{tabular}
355 % \end{quote}
356 %
357 % \subsubsection{\texorpdfstring{Category }{}\texttt{etex.iftype}}
358 %
359 % \begin{quote}
360 % \begin{tabular}{@{}>{\ttfamily}l>{\ttfamily}l@{}}
361 % etex.iftype.none & 0\\
362 % etex.iftype.char & 1\\
363 % etex.iftype.cat & 2\\
364 % etex.iftype.num & 3\\
365 % etex.iftype.dim & 4\\
366 % etex.iftype.odd & 5\\
367 % etex.iftype.vmode & 6\\
368 % etex.iftype.hmode & 7\\
369 % etex.iftype.mmode & 8\\
370 % etex.iftype.inner & 9\\
371 % etex.iftype.void & 10\\
372 % etex.iftype.hbox & 11\\
373 % etex.iftype.vbox & 12\\
374 % etex.iftype.x & 13\\
375 % etex.iftype.eof & 14\\
376 % etex.iftype.true & 15\\
377 % etex.iftype.false & 16\\
378 % etex.iftype.case & 17\\
379 % etex.iftype.defined & 18\\
380 % etex.iftype.csname & 19\\
381 % etex.iftype.fontchar & 20\\
382 % \end{tabular}
383 % \end{quote}
384 %
385 % \subsubsection{\texorpdfstring{Category }{}\texttt{etex.nodetype}}
386 %
387 % \begin{quote}
388 % \begin{tabular}{@{}>{\ttfamily}l>{\ttfamily}l@{}}
389 % etex.nodetype.none & -1\\
390 % etex.nodetype.char & 0\\
391 % etex.nodetype.hlist & 1\\
392 % etex.nodetype.vlist & 2\\
393 % etex.nodetype.rule & 3\\
394 % etex.nodetype.ins & 4\\
395 % etex.nodetype.mark & 5\\
396 % etex.nodetype.adjust & 6\\
397 % etex.nodetype.ligature & 7\\
398 % etex.nodetype.disc & 8\\
399 % etex.nodetype.whatsit & 9\\
400 % etex.nodetype.math & 10\\
401 % etex.nodetype.glue & 11\\
402 % etex.nodetype.kern & 12\\
403 % etex.nodetype.penalty & 13\\
404 % etex.nodetype.unset & 14\\
405 % etex.nodetype.maths & 15\\
406 % \end{tabular}
407 % \end{quote}
408 %
409 % \subsubsection{\texorpdfstring{Category }{}\texttt{etex.interactionmode}}
410 %
411 % \begin{quote}
412 % \begin{tabular}{@{}>{\ttfamily}l>{\ttfamily}l@{}}
413 % etex.interactionmode.batch & 0\\
414 % etex.interactionmode.nonstop & 1\\
415 % etex.interactionmode.scroll & 2\\
416 % etex.interactionmode.errorstop & 3\\
417 % \end{tabular}
418 % \end{quote}
419 %
420 % \subsubsection{\texorpdfstring{Category }{}\texttt{luatex.pdfliteral.mode}}
421 %
422 % \begin{quote}
423 % \begin{tabular}{@{}>{\ttfamily}l>{\ttfamily}l@{}}
424 % luatex.pdfliteral.mode.setorigin & 0\\
425 % luatex.pdfliteral.mode.page & 1\\
426 % luatex.pdfliteral.mode.direct & 2\\
427 % \end{tabular}
428 % \end{quote}
429 %
430 %
431 % \hypersetup{bookmarksopenlevel=1}
432 %
433 % \StopEventually{
434 % }
435 %
436 % \section{Implementation}
437 %
438 % \begin{macrocode}
439 %<*package>
440 % \end{macrocode}
441 %
442 % \subsection{Reload check and package identification}
443 % Reload check, especially if the package is not used with \LaTeX.
444 % \begin{macrocode}
445 \begingroup\catcode61\catcode48\catcode32=10\relax%
446 \catcode13=5 % ^^M
447 \endlinechar=13 %
448 \catcode35=6 % #
449 \catcode39=12 % '
450 \catcode44=12 % ,
451 \catcode45=12 % -
452 \catcode46=12 % .
453 \catcode58=12 % :
454 \catcode64=11 % @
455 \catcode123=1 % {
456 \catcode125=2 % }
457 \expandafter\let\expandafter\x\csname [email protected]\endcsname
458 \ifx\x\relax % plain-TeX, first loading
459 \else
460 \def\empty{}%
461 \ifx\x\empty % LaTeX, first loading,
462 % variable is initialized, but \ProvidesPackage not yet seen
463 \else
464 \expandafter\ifx\csname PackageInfo\endcsname\relax
465 \def\x#1#2{%
466 \immediate\write-1{Package #1 Info: #2.}%
467 }%
468 \else
469 \def\x#1#2{\PackageInfo{#1}{#2, stopped}}%
470 \fi
471 \x{magicnum}{The package is already loaded}%
472 \aftergroup\endinput
473 \fi
474 \fi
475 \endgroup%
476 % \end{macrocode}
477 % Package identification:
478 % \begin{macrocode}
479 \begingroup\catcode61\catcode48\catcode32=10\relax%
480 \catcode13=5 % ^^M
481 \endlinechar=13 %
482 \catcode35=6 % #
483 \catcode39=12 % '
484 \catcode40=12 % (
485 \catcode41=12 % )
486 \catcode44=12 % ,
487 \catcode45=12 % -
488 \catcode46=12 % .
489 \catcode47=12 % /
490 \catcode58=12 % :
491 \catcode64=11 % @
492 \catcode91=12 % [
493 \catcode93=12 % ]
494 \catcode123=1 % {
495 \catcode125=2 % }
496 \expandafter\ifx\csname ProvidesPackage\endcsname\relax
497 \def\x#1#2#3[#4]{\endgroup
498 \immediate\write-1{Package: #3 #4}%
499 \xdef#1{#4}%
500 }%
501 \else
502 \def\x#1#2[#3]{\endgroup
503 #2[{#3}]%
504 \ifx#1\@undefined
505 \xdef#1{#3}%
506 \fi
507 \ifx#1\relax
508 \xdef#1{#3}%
509 \fi
510 }%
511 \fi
512 \expandafter\x\csname [email protected]\endcsname
513 \ProvidesPackage{magicnum}%
514 [2019/11/29 v1.7 Magic numbers (HO)]%
515 % \end{macrocode}
516 %
517 % \subsection{Catcodes}
518 %
519 % \begin{macrocode}
520 \begingroup\catcode61\catcode48\catcode32=10\relax%
521 \catcode13=5 % ^^M
522 \endlinechar=13 %
523 \catcode123=1 % {
524 \catcode125=2 % }
525 \catcode64=11 % @
526 \def\x{\endgroup
527 \expandafter\edef\csname magicnum@AtEnd\endcsname{%
528 \endlinechar=\the\endlinechar\relax
529 \catcode13=\the\catcode13\relax
530 \catcode32=\the\catcode32\relax
531 \catcode35=\the\catcode35\relax
532 \catcode61=\the\catcode61\relax
533 \catcode64=\the\catcode64\relax
534 \catcode123=\the\catcode123\relax
535 \catcode125=\the\catcode125\relax
536 }%
537 }%
538 \x\catcode61\catcode48\catcode32=10\relax%
539 \catcode13=5 % ^^M
540 \endlinechar=13 %
541 \catcode35=6 % #
542 \catcode64=11 % @
543 \catcode123=1 % {
544 \catcode125=2 % }
545 \def\TMP@EnsureCode#1#2{%
546 \edef\magicnum@AtEnd{%
547 \magicnum@AtEnd
548 \catcode#1=\the\catcode#1\relax
549 }%
550 \catcode#1=#2\relax
551 }
552 \TMP@EnsureCode{34}{12}% "
553 \TMP@EnsureCode{39}{12}% '
554 \TMP@EnsureCode{40}{12}% (
555 \TMP@EnsureCode{41}{12}% )
556 \TMP@EnsureCode{42}{12}% *
557 \TMP@EnsureCode{44}{12}% ,
558 \TMP@EnsureCode{45}{12}% -
559 \TMP@EnsureCode{46}{12}% .
560 \TMP@EnsureCode{47}{12}% /
561 \TMP@EnsureCode{58}{12}% :
562 \TMP@EnsureCode{60}{12}% <
563 \TMP@EnsureCode{62}{12}% >
564 \TMP@EnsureCode{91}{12}% [
565 \TMP@EnsureCode{93}{12}% ]
566 \edef\magicnum@AtEnd{\magicnum@AtEnd\noexpand\endinput}
567 % \end{macrocode}
568 %
569 % \subsection{Check for previous definition}
570 %
571 % \begin{macrocode}
572 \begingroup\expandafter\expandafter\expandafter\endgroup
573 \expandafter\ifx\csname newcommand\endcsname\relax
574 \expandafter\ifx\csname magicnum\endcsname\relax
575 \else
576 \input infwarerr.sty\relax
577 \@PackageError{magicnum}{%
578 \string\magicnum\space is already defined%
579 }\@ehc
580 \fi
581 \else
582 \newcommand*{\magicnum}{}%
583 \fi
584 % \end{macrocode}
585 %
586 % \subsection{Without \LuaTeX}
587 %
588 % \begin{macrocode}
589 \begingroup\expandafter\expandafter\expandafter\endgroup
590 \expandafter\ifx\csname directlua\endcsname\relax
591 % \end{macrocode}
592 %
593 % \begin{macro}{\magicnum}
594 % \begin{macrocode}
595 \begingroup\expandafter\expandafter\expandafter\endgroup
596 \expandafter\ifx\csname ifcsname\endcsname\relax
597 \def\magicnum#1{%
598 \expandafter\ifx\csname MG@#1\endcsname\relax
599 \else
600 \csname MG@#1\endcsname
601 \fi
602 }%
603 \else
604 \begingroup
605 \edef\x{\endgroup
606 \def\noexpand\magicnum##1{%
607 \expandafter\noexpand\csname
608 ifcsname\endcsname MG@##1\noexpand\endcsname
609 \noexpand\csname MG@##1%
610 \noexpand\expandafter\noexpand\endcsname
611 \expandafter\noexpand\csname fi\endcsname
612 }%
613 }%
614 \x
615 \fi
616 % \end{macrocode}
617 % \end{macro}
618 %
619 % \begin{macrocode}
620 \else
621 % \end{macrocode}
622 %
623 % \subsection{With \LuaTeX}
624 %
625 % \begin{macrocode}
626 \begingroup\expandafter\expandafter\expandafter\endgroup
627 \expandafter\ifx\csname RequirePackage\endcsname\relax
628 \input tex.sty\relax
629 \input infwarerr.sty\relax
630 \else
631 \RequirePackage{iftex}[2019/11/07]%
632 \RequirePackage{infwarerr}[2010/04/08]%
633 \fi
634 % \end{macrocode}
635 %
636 % \begin{macro}{\magicnum@directlua}
637 % \begin{macrocode}
638 \ifnum\luatexversion<36 %
639 \def\magicnum@directlua{\directlua0 }%
640 \else
641 \let\magicnum@directlua\directlua
642 \fi
643 % \end{macrocode}
644 % \end{macro}
645 % \begin{macrocode}
646 \magicnum@directlua{%
647 require("magicnum")%
648 }%
649 \begingroup
650 \def\x{2019/11/29 v1.7}%
651 \def\StripPrefix#1>{}%
652 \edef\x{\expandafter\StripPrefix\meaning\x}%
653 \edef\y{%
654 \magicnum@directlua{%
655 if oberdiek.magicnum.getversion then %
656 oberdiek.magicnum.getversion()%
657 end%
658 }%
659 }%
660 \ifx\x\y
661 \else
662 \@PackageError{magicnum}{%
663 Wrong version of lua module.\MessageBreak
664 Package version: \x\MessageBreak
665 Lua module: \y
666 }\@ehc
667 \fi
668 \endgroup
669 % \end{macrocode}
670 % \begin{macro}{\luaescapestring}
671 % \begin{macrocode}
672 \begingroup
673 \expandafter\ifx\csname luaescapestring\endcsname\relax
674 \directlua{%
675 if tex.enableprimitives then %
676 tex.enableprimitives('magicnum@', {'luaescapestring'})%
677 end%
678 }%
679 \global\let\luaescapestring\magicnum@luaescapestring
680 \fi
681 \expandafter\ifx\csname luaescapestring\endcsname\relax
682 \escapechar=92 %
683 \@PackageError{magicnum}{%
684 Missing \string\luaescapestring
685 }\@ehc
686 \fi
687 \endgroup
688 % \end{macrocode}
689 % \end{macro}
690 % \begin{macro}{\magicnum}
691 % \begin{macrocode}
692 \def\magicnum#1{%
693 \magicnum@directlua{%
694 oberdiek.magicnum.get("\luaescapestring{#1}")%
695 }%
696 }%
697 % \end{macrocode}
698 % \end{macro}
699 %
700 % \begin{macrocode}
701 \expandafter\magicnum@AtEnd
702 \fi%
703 %</package>
704 % \end{macrocode}
705 %
706 % \subsection{Data}
707 %
708 % \subsubsection{Plain data}
709 %
710 % \begin{macrocode}
711 %<*data>
712 tex.catcode
713 escape = 0
714 begingroup = 1
715 endgroup = 2
716 math = 3
717 align = 4
718 eol = 5
719 parameter = 6
720 superscript = 7
721 subscript = 8
722 ignore = 9
723 space = 10
724 letter = 11
725 other = 12
726 active = 13
727 comment = 14
728 invalid = 15
729 etex.grouptype
730 bottomlevel = 0
731 simple = 1
732 hbox = 2
733 adjustedhbox = 3
734 vbox = 4
735 align = 5
736 noalign = 6
737 output = 8
738 math = 9
739 disc = 10
740 insert = 11
741 vcenter = 12
742 mathchoice = 13
743 semisimple = 14
744 mathshift = 15
745 mathleft = 16
746 etex.iftype
747 none = 0
748 char = 1
749 cat = 2
750 num = 3
751 dim = 4
752 odd = 5
753 vmode = 6
754 hmode = 7
755 mmode = 8
756 inner = 9
757 void = 10
758 hbox = 11
759 vbox = 12
760 x = 13
761 eof = 14
762 true = 15
763 false = 16
764 case = 17
765 defined = 18
766 csname = 19
767 fontchar = 20
768 etex.nodetype
769 none = -1
770 char = 0
771 hlist = 1
772 vlist = 2
773 rule = 3
774 ins = 4
775 mark = 5
776 adjust = 6
777 ligature = 7
778 disc = 8
779 whatsit = 9
780 math = 10
781 glue = 11
782 kern = 12
783 penalty = 13
784 unset = 14
785 maths = 15
786 etex.interactionmode
787 batch = 0
788 nonstop = 1
789 scroll = 2
790 errorstop = 3
791 luatex.pdfliteral.mode
792 setorigin = 0
793 page = 1
794 direct = 2
795 %</data>
796 % \end{macrocode}
797 %
798 % \subsubsection{Data for \TeX}
799 %
800 % \begin{macrocode}
801 %<*package>
802 % \end{macrocode}
803 % \begin{macro}{\magicnum@add}
804 % \begin{macrocode}
805 \begingroup\expandafter\expandafter\expandafter\endgroup
806 \expandafter\ifx\csname detokenize\endcsname\relax
807 \def\magicnum@add#1#2#3{%
808 \expandafter\magicnum@@add
809 \csname MG@#1.#2\expandafter\endcsname
810 \csname MG@#1.#3\endcsname
811 {#3}{#2}%
812 }%
813 \def\magicnum@@add#1#2#3#4{%
814 \def#1{#3}%
815 \def#2{#4}%
816 \edef#1{%
817 \expandafter\strip@prefix\meaning#1%
818 }%
819 \edef#2{%
820 \expandafter\strip@prefix\meaning#2%
821 }%
822 }%
823 \expandafter\ifx\csname strip@prefix\endcsname\relax
824 \def\strip@prefix#1->{}%
825 \fi
826 \else
827 \def\magicnum@add#1#2#3{%
828 \expandafter\edef\csname MG@#1.#2\endcsname{%
829 \detokenize{#3}%
830 }%
831 \expandafter\edef\csname MG@#1.#3\endcsname{%
832 \detokenize{#2}%
833 }%
834 }%
835 \fi
836 % \end{macrocode}
837 % \end{macro}
838 % \begin{macrocode}
839 \magicnum@add{tex.catcode}{escape}{0}
840 \magicnum@add{tex.catcode}{begingroup}{1}
841 \magicnum@add{tex.catcode}{endgroup}{2}
842 \magicnum@add{tex.catcode}{math}{3}
843 \magicnum@add{tex.catcode}{align}{4}
844 \magicnum@add{tex.catcode}{eol}{5}
845 \magicnum@add{tex.catcode}{parameter}{6}
846 \magicnum@add{tex.catcode}{superscript}{7}
847 \magicnum@add{tex.catcode}{subscript}{8}
848 \magicnum@add{tex.catcode}{ignore}{9}
849 \magicnum@add{tex.catcode}{space}{10}
850 \magicnum@add{tex.catcode}{letter}{11}
851 \magicnum@add{tex.catcode}{other}{12}
852 \magicnum@add{tex.catcode}{active}{13}
853 \magicnum@add{tex.catcode}{comment}{14}
854 \magicnum@add{tex.catcode}{invalid}{15}
855 \magicnum@add{etex.grouptype}{bottomlevel}{0}
856 \magicnum@add{etex.grouptype}{simple}{1}
857 \magicnum@add{etex.grouptype}{hbox}{2}
858 \magicnum@add{etex.grouptype}{adjustedhbox}{3}
859 \magicnum@add{etex.grouptype}{vbox}{4}
860 \magicnum@add{etex.grouptype}{align}{5}
861 \magicnum@add{etex.grouptype}{noalign}{6}
862 \magicnum@add{etex.grouptype}{output}{8}
863 \magicnum@add{etex.grouptype}{math}{9}
864 \magicnum@add{etex.grouptype}{disc}{10}
865 \magicnum@add{etex.grouptype}{insert}{11}
866 \magicnum@add{etex.grouptype}{vcenter}{12}
867 \magicnum@add{etex.grouptype}{mathchoice}{13}
868 \magicnum@add{etex.grouptype}{semisimple}{14}
869 \magicnum@add{etex.grouptype}{mathshift}{15}
870 \magicnum@add{etex.grouptype}{mathleft}{16}
871 \magicnum@add{etex.iftype}{none}{0}
872 \magicnum@add{etex.iftype}{char}{1}
873 \magicnum@add{etex.iftype}{cat}{2}
874 \magicnum@add{etex.iftype}{num}{3}
875 \magicnum@add{etex.iftype}{dim}{4}
876 \magicnum@add{etex.iftype}{odd}{5}
877 \magicnum@add{etex.iftype}{vmode}{6}
878 \magicnum@add{etex.iftype}{hmode}{7}
879 \magicnum@add{etex.iftype}{mmode}{8}
880 \magicnum@add{etex.iftype}{inner}{9}
881 \magicnum@add{etex.iftype}{void}{10}
882 \magicnum@add{etex.iftype}{hbox}{11}
883 \magicnum@add{etex.iftype}{vbox}{12}
884 \magicnum@add{etex.iftype}{x}{13}
885 \magicnum@add{etex.iftype}{eof}{14}
886 \magicnum@add{etex.iftype}{true}{15}
887 \magicnum@add{etex.iftype}{false}{16}
888 \magicnum@add{etex.iftype}{case}{17}
889 \magicnum@add{etex.iftype}{defined}{18}
890 \magicnum@add{etex.iftype}{csname}{19}
891 \magicnum@add{etex.iftype}{fontchar}{20}
892 \magicnum@add{etex.nodetype}{none}{-1}
893 \magicnum@add{etex.nodetype}{char}{0}
894 \magicnum@add{etex.nodetype}{hlist}{1}
895 \magicnum@add{etex.nodetype}{vlist}{2}
896 \magicnum@add{etex.nodetype}{rule}{3}
897 \magicnum@add{etex.nodetype}{ins}{4}
898 \magicnum@add{etex.nodetype}{mark}{5}
899 \magicnum@add{etex.nodetype}{adjust}{6}
900 \magicnum@add{etex.nodetype}{ligature}{7}
901 \magicnum@add{etex.nodetype}{disc}{8}
902 \magicnum@add{etex.nodetype}{whatsit}{9}
903 \magicnum@add{etex.nodetype}{math}{10}
904 \magicnum@add{etex.nodetype}{glue}{11}
905 \magicnum@add{etex.nodetype}{kern}{12}
906 \magicnum@add{etex.nodetype}{penalty}{13}
907 \magicnum@add{etex.nodetype}{unset}{14}
908 \magicnum@add{etex.nodetype}{maths}{15}
909 \magicnum@add{etex.interactionmode}{batch}{0}
910 \magicnum@add{etex.interactionmode}{nonstop}{1}
911 \magicnum@add{etex.interactionmode}{scroll}{2}
912 \magicnum@add{etex.interactionmode}{errorstop}{3}
913 \magicnum@add{luatex.pdfliteral.mode}{setorigin}{0}
914 \magicnum@add{luatex.pdfliteral.mode}{page}{1}
915 \magicnum@add{luatex.pdfliteral.mode}{direct}{2}
916 % \end{macrocode}
917 % \begin{macrocode}
918 \magicnum@AtEnd%
919 %</package>
920 % \end{macrocode}
921 %
922 % \subsubsection{Lua module}
923 %
924 % \begin{macrocode}
925 %<*lua>
926 % \end{macrocode}
927 % \begin{macrocode}
928 oberdiek = oberdiek or {}
929 local magicnum = oberdiek.magicnum or {}
930 oberdiek.magicnum = magicnum
931 % \end{macrocode}
932 % \begin{macrocode}
933 function magicnum.getversion()
934 tex.write("2019/11/29 v1.7")
935 end
936 % \end{macrocode}
937 % \begin{macrocode}
938 local data = {
939 ["tex.catcode"] = {
940 [0] = "escape",
941 [1] = "begingroup",
942 [2] = "endgroup",
943 [3] = "math",
944 [4] = "align",
945 [5] = "eol",
946 [6] = "parameter",
947 [7] = "superscript",
948 [8] = "subscript",
949 [9] = "ignore",
950 [10] = "space",
951 [11] = "letter",
952 [12] = "other",
953 [13] = "active",
954 [14] = "comment",
955 [15] = "invalid",
956 ["active"] = 13,
957 ["align"] = 4,
958 ["begingroup"] = 1,
959 ["comment"] = 14,
960 ["endgroup"] = 2,
961 ["eol"] = 5,
962 ["escape"] = 0,
963 ["ignore"] = 9,
964 ["invalid"] = 15,
965 ["letter"] = 11,
966 ["math"] = 3,
967 ["other"] = 12,
968 ["parameter"] = 6,
969 ["space"] = 10,
970 ["subscript"] = 8,
971 ["superscript"] = 7
972 },
973 ["etex.grouptype"] = {
974 [0] = "bottomlevel",
975 [1] = "simple",
976 [2] = "hbox",
977 [3] = "adjustedhbox",
978 [4] = "vbox",
979 [5] = "align",
980 [6] = "noalign",
981 [8] = "output",
982 [9] = "math",
983 [10] = "disc",
984 [11] = "insert",
985 [12] = "vcenter",
986 [13] = "mathchoice",
987 [14] = "semisimple",
988 [15] = "mathshift",
989 [16] = "mathleft",
990 ["adjustedhbox"] = 3,
991 ["align"] = 5,
992 ["bottomlevel"] = 0,
993 ["disc"] = 10,
994 ["hbox"] = 2,
995 ["insert"] = 11,
996 ["math"] = 9,
997 ["mathchoice"] = 13,
998 ["mathleft"] = 16,
999 ["mathshift"] = 15,
1000 ["noalign"] = 6,
1001 ["output"] = 8,
1002 ["semisimple"] = 14,
1003 ["simple"] = 1,
1004 ["vbox"] = 4,
1005 ["vcenter"] = 12
1006 },
1007 ["etex.iftype"] = {
1008 [0] = "none",
1009 [1] = "char",
1010 [2] = "cat",
1011 [3] = "num",
1012 [4] = "dim",
1013 [5] = "odd",
1014 [6] = "vmode",
1015 [7] = "hmode",
1016 [8] = "mmode",
1017 [9] = "inner",
1018 [10] = "void",
1019 [11] = "hbox",
1020 [12] = "vbox",
1021 [13] = "x",
1022 [14] = "eof",
1023 [15] = "true",
1024 [16] = "false",
1025 [17] = "case",
1026 [18] = "defined",
1027 [19] = "csname",
1028 [20] = "fontchar",
1029 ["case"] = 17,
1030 ["cat"] = 2,
1031 ["char"] = 1,
1032 ["csname"] = 19,
1033 ["defined"] = 18,
1034 ["dim"] = 4,
1035 ["eof"] = 14,
1036 ["false"] = 16,
1037 ["fontchar"] = 20,
1038 ["hbox"] = 11,
1039 ["hmode"] = 7,
1040 ["inner"] = 9,
1041 ["mmode"] = 8,
1042 ["none"] = 0,
1043 ["num"] = 3,
1044 ["odd"] = 5,
1045 ["true"] = 15,
1046 ["vbox"] = 12,
1047 ["vmode"] = 6,
1048 ["void"] = 10,
1049 ["x"] = 13
1050 },
1051 ["etex.nodetype"] = {
1052 [-1] = "none",
1053 [0] = "char",
1054 [1] = "hlist",
1055 [2] = "vlist",
1056 [3] = "rule",
1057 [4] = "ins",
1058 [5] = "mark",
1059 [6] = "adjust",
1060 [7] = "ligature",
1061 [8] = "disc",
1062 [9] = "whatsit",
1063 [10] = "math",
1064 [11] = "glue",
1065 [12] = "kern",
1066 [13] = "penalty",
1067 [14] = "unset",
1068 [15] = "maths",
1069 ["adjust"] = 6,
1070 ["char"] = 0,
1071 ["disc"] = 8,
1072 ["glue"] = 11,
1073 ["hlist"] = 1,
1074 ["ins"] = 4,
1075 ["kern"] = 12,
1076 ["ligature"] = 7,
1077 ["mark"] = 5,
1078 ["math"] = 10,
1079 ["maths"] = 15,
1080 ["none"] = -1,
1081 ["penalty"] = 13,
1082 ["rule"] = 3,
1083 ["unset"] = 14,
1084 ["vlist"] = 2,
1085 ["whatsit"] = 9
1086 },
1087 ["etex.interactionmode"] = {
1088 [0] = "batch",
1089 [1] = "nonstop",
1090 [2] = "scroll",
1091 [3] = "errorstop",
1092 ["batch"] = 0,
1093 ["errorstop"] = 3,
1094 ["nonstop"] = 1,
1095 ["scroll"] = 2
1096 },
1097 ["luatex.pdfliteral.mode"] = {
1098 [0] = "setorigin",
1099 [1] = "page",
1100 [2] = "direct",
1101 ["direct"] = 2,
1102 ["page"] = 1,
1103 ["setorigin"] = 0
1104 }
1105 }
1106 % \end{macrocode}
1107 % \begin{macrocode}
1108 function magicnum.get(name)
1109 local startpos, endpos, category, entry =
1110 string.find(name, "^(%a[%a%d%.]*)%.(-?[%a%d]+)$")
1111 if not entry then
1112 return
1113 end
1114 local node = data[category]
1115 if not node then
1116 return
1117 end
1118 local num = tonumber(entry)
1119 local value
1120 if num then
1121 value = node[num]
1122 if not value then
1123 return
1124 end
1125 else
1126 value = node[entry]
1127 if not value then
1128 return
1129 end
1130 value = "" .. value
1131 end
1132 tex.write(value)
1133 end
1134 % \end{macrocode}
1135 %
1136 % \begin{macrocode}
1137 %</lua>
1138 % \end{macrocode}
1139 %
1140 % \section{Test}
1141 %
1142 % \subsection{Catcode checks for loading}
1143 %
1144 % \begin{macrocode}
1145 %<*test1>
1146 % \end{macrocode}
1147 % \begin{macrocode}
1148 \catcode`\{=1 %
1149 \catcode`\}=2 %
1150 \catcode`\#=6 %
1151 \catcode`\@=11 %
1152 \expandafter\ifx\csname count@\endcsname\relax
1153 \countdef\count@=255 %
1154 \fi
1155 \expandafter\ifx\csname @gobble\endcsname\relax
1156 \long\def\@gobble#1{}%
1157 \fi
1158 \expandafter\ifx\csname @firstofone\endcsname\relax
1159 \long\def\@firstofone#1{#1}%
1160 \fi
1161 \expandafter\ifx\csname loop\endcsname\relax
1162 \expandafter\@firstofone
1163 \else
1164 \expandafter\@gobble
1165 \fi
1166 {%
1167 \def\loop#1\repeat{%
1168 \def\body{#1}%
1169 \iterate
1170 }%
1171 \def\iterate{%
1172 \body
1173 \let\next\iterate
1174 \else
1175 \let\next\relax
1176 \fi
1177 \next
1178 }%
1179 \let\repeat=\fi
1180 }%
1181 \def\RestoreCatcodes{}
1182 \count@=0 %
1183 \loop
1184 \edef\RestoreCatcodes{%
1185 \RestoreCatcodes
1186 \catcode\the\count@=\the\catcode\count@\relax
1187 }%
1188 \ifnum\count@<255 %
1189 \advance\count@ 1 %
1190 \repeat
1191
1192 \def\RangeCatcodeInvalid#1#2{%
1193 \count@=#1\relax
1194 \loop
1195 \catcode\count@=15 %
1196 \ifnum\count@<#2\relax
1197 \advance\count@ 1 %
1198 \repeat
1199 }
1200 \def\RangeCatcodeCheck#1#2#3{%
1201 \count@=#1\relax
1202 \loop
1203 \ifnum#3=\catcode\count@
1204 \else
1205 \errmessage{%
1206 Character \the\count@\space
1207 with wrong catcode \the\catcode\count@\space
1208 instead of \number#3%
1209 }%
1210 \fi
1211 \ifnum\count@<#2\relax
1212 \advance\count@ 1 %
1213 \repeat
1214 }
1215 \def\space{ }
1216 \expandafter\ifx\csname LoadCommand\endcsname\relax
1217 \def\LoadCommand{\input magicnum.sty\relax}%
1218 \fi
1219 \def\Test{%
1220 \RangeCatcodeInvalid{0}{47}%
1221 \RangeCatcodeInvalid{58}{64}%
1222 \RangeCatcodeInvalid{91}{96}%
1223 \RangeCatcodeInvalid{123}{255}%
1224 \catcode`\@=12 %
1225 \catcode`\\=0 %
1226 \catcode`\%=14 %
1227 \LoadCommand
1228 \RangeCatcodeCheck{0}{36}{15}%
1229 \RangeCatcodeCheck{37}{37}{14}%
1230 \RangeCatcodeCheck{38}{47}{15}%
1231 \RangeCatcodeCheck{48}{57}{12}%
1232 \RangeCatcodeCheck{58}{63}{15}%
1233 \RangeCatcodeCheck{64}{64}{12}%
1234 \RangeCatcodeCheck{65}{90}{11}%
1235 \RangeCatcodeCheck{91}{91}{15}%
1236 \RangeCatcodeCheck{92}{92}{0}%
1237 \RangeCatcodeCheck{93}{96}{15}%
1238 \RangeCatcodeCheck{97}{122}{11}%
1239 \RangeCatcodeCheck{123}{255}{15}%
1240 \RestoreCatcodes
1241 }
1242 \Test
1243 \csname @@end\endcsname
1244 \end
1245 % \end{macrocode}
1246 % \begin{macrocode}
1247 %</test1>
1248 % \end{macrocode}
1249 %
1250 % \subsection{Test data}
1251 %
1252 % \begin{macrocode}
1253 %<*testplain>
1254 \input magicnum.sty\relax
1255 \def\Test#1#2{%
1256 \edef\result{\magicnum{#1}}%
1257 \edef\expect{#2}%
1258 \edef\expect{\expandafter\stripprefix\meaning\expect}%
1259 \ifx\result\expect
1260 \else
1261 \errmessage{%
1262 Failed: [#1] % hash-ok
1263 returns [\result] instead of [\expect]%
1264 }%
1265 \fi
1266 }
1267 \def\stripprefix#1->{}
1268 %</testplain>
1269 % \end{macrocode}
1270 % \begin{macrocode}
1271 %<*testlatex>
1272 \NeedsTeXFormat{LaTeX2e}
1273 \documentclass{minimal}
1274 \usepackage{magicnum}[2016/05/16]
1275 \usepackage{qstest}
1276 \IncludeTests{*}
1277 \LogTests{log}{*}{*}
1278 \newcommand*{\Test}[2]{%
1279 \Expect*{\magicnum{#1}}{#2}%
1280 }
1281 \begin{qstest}{magicnum}{magicnum}
1282 %</testlatex>
1283 % \end{macrocode}
1284 % \begin{macrocode}
1285 %<*testdata>
1286 \Test{tex.catcode.escape}{0}
1287 \Test{tex.catcode.invalid}{15}
1288 \Test{tex.catcode.unknown}{}
1289 \Test{tex.catcode.0}{escape}
1290 \Test{tex.catcode.15}{invalid}
1291 \Test{etex.iftype.true}{15}
1292 \Test{etex.iftype.false}{16}
1293 \Test{etex.iftype.15}{true}
1294 \Test{etex.iftype.16}{false}
1295 \Test{etex.nodetype.none}{-1}
1296 \Test{etex.nodetype.-1}{none}
1297 \Test{luatex.pdfliteral.mode.direct}{2}
1298 \Test{luatex.pdfliteral.mode.1}{page}
1299 \Test{}{}
1300 \Test{unknown}{}
1301 \Test{unknown.foo.bar}{}
1302 \Test{unknown.foo.4}{}
1303 %</testdata>
1304 % \end{macrocode}
1305 % \begin{macrocode}
1306 %<*testplain>
1307 \csname @@end\endcsname
1308 \end
1309 %</testplain>
1310 %<*testlatex>
1311 \end{qstest}
1312 \csname @@end\endcsname
1313 %</testlatex>
1314 % \end{macrocode}
1315 %
1316 % \subsection{Small test for \hologo{iniTeX}}
1317 %
1318 % \begin{macrocode}
1319 %<*test4>
1320 \catcode`\{=1
1321 \catcode`\}=2
1322 \catcode`\#=6
1323 \input magicnum.sty\relax
1324 \edef\x{\magicnum{tex.catcode.15}}
1325 \edef\y{invalid}
1326 \def\Strip#1>{}
1327 \edef\y{\expandafter\Strip\meaning\y}
1328 \ifx\x\y
1329 \immediate\write16{Ok}%
1330 \else
1331 \errmessage{\x<>\y}%
1332 \fi
1333 \csname @@end\endcsname\end
1334 %</test4>
1335 % \end{macrocode}
1336 %
1337 % \section{Installation}
1338 %
1339 % \subsection{Download}
1340 %
1341 % \paragraph{Package.} This package is available on
1342 % CTAN\footnote{\CTANpkg{magicnum}}:
1343 % \begin{description}
1344 % \item[\CTAN{macros/latex/contrib/magicnum/magicnum.dtx}] The source file.
1345 % \item[\CTAN{macros/latex/contrib/magicnum/magicnum.pdf}] Documentation.
1346 % \end{description}
1347 %
1348 %
1349 % \paragraph{Bundle.} All the packages of the bundle `magicnum'
1350 % are also available in a TDS compliant ZIP archive. There
1351 % the packages are already unpacked and the documentation files
1352 % are generated. The files and directories obey the TDS standard.
1353 % \begin{description}
1354 % \item[\CTANinstall{install/macros/latex/contrib/magicnum.tds.zip}]
1355 % \end{description}
1356 % \emph{TDS} refers to the standard ``A Directory Structure
1357 % for \TeX\ Files'' (\CTANpkg{tds}). Directories
1358 % with \xfile{texmf} in their name are usually organized this way.
1359 %
1360 % \subsection{Bundle installation}
1361 %
1362 % \paragraph{Unpacking.} Unpack the \xfile{magicnum.tds.zip} in the
1363 % TDS tree (also known as \xfile{texmf} tree) of your choice.
1364 % Example (linux):
1365 % \begin{quote}
1366 % |unzip magicnum.tds.zip -d ~/texmf|
1367 % \end{quote}
1368 %
1369 % \paragraph{Script installation.}
1370 % Check the directory \xfile{TDS:scripts/magicnum/} for
1371 % scripts that need further installation steps.
1372 %
1373 % \subsection{Package installation}
1374 %
1375 % \paragraph{Unpacking.} The \xfile{.dtx} file is a self-extracting
1376 % \docstrip\ archive. The files are extracted by running the
1377 % \xfile{.dtx} through \plainTeX:
1378 % \begin{quote}
1379 % \verb|tex magicnum.dtx|
1380 % \end{quote}
1381 %
1382 % \paragraph{TDS.} Now the different files must be moved into
1383 % the different directories in your installation TDS tree
1384 % (also known as \xfile{texmf} tree):
1385 % \begin{quote}
1386 % \def\t{^^A
1387 % \begin{tabular}{@{}>{\ttfamily}l@{ $\rightarrow$ }>{\ttfamily}l@{}}
1388 % magicnum.sty & tex/generic/magicnum/magicnum.sty\\
1389 % magicnum.lua & scripts/magicnum/magicnum.lua\\
1390 % magicnum.magicnum.lua & scripts/magicnum/magicnum.magicnum.lua\\
1391 % magicnum.pdf & doc/latex/magicnum/magicnum.pdf\\
1392 % magicnum.txt & doc/latex/magicnum/magicnum.txt\\
1393 % magicnum.dtx & source/latex/magicnum/magicnum.dtx\\
1394 % \end{tabular}^^A
1395 % }^^A
1396 % \sbox0{\t}^^A
1397 % \ifdim\wd0>\linewidth
1398 % \begingroup
1399 % \advance\linewidth by\leftmargin
1400 % \advance\linewidth by\rightmargin
1401 % \edef\x{\endgroup
1402 % \def\noexpand\lw{\the\linewidth}^^A
1403 % }\x
1404 % \def\lwbox{^^A
1405 % \leavevmode
1406 % \hbox to \linewidth{^^A
1407 % \kern-\leftmargin\relax
1408 % \hss
1409 % \usebox0
1410 % \hss
1411 % \kern-\rightmargin\relax
1412 % }^^A
1413 % }^^A
1414 % \ifdim\wd0>\lw
1415 % \sbox0{\small\t}^^A
1416 % \ifdim\wd0>\linewidth
1417 % \ifdim\wd0>\lw
1418 % \sbox0{\footnotesize\t}^^A
1419 % \ifdim\wd0>\linewidth
1420 % \ifdim\wd0>\lw
1421 % \sbox0{\scriptsize\t}^^A
1422 % \ifdim\wd0>\linewidth
1423 % \ifdim\wd0>\lw
1424 % \sbox0{\tiny\t}^^A
1425 % \ifdim\wd0>\linewidth
1426 % \lwbox
1427 % \else
1428 % \usebox0
1429 % \fi
1430 % \else
1431 % \lwbox
1432 % \fi
1433 % \else
1434 % \usebox0
1435 % \fi
1436 % \else
1437 % \lwbox
1438 % \fi
1439 % \else
1440 % \usebox0
1441 % \fi
1442 % \else
1443 % \lwbox
1444 % \fi
1445 % \else
1446 % \usebox0
1447 % \fi
1448 % \else
1449 % \lwbox
1450 % \fi
1451 % \else
1452 % \usebox0
1453 % \fi
1454 % \end{quote}
1455 % If you have a \xfile{docstrip.cfg} that configures and enables \docstrip's
1456 % TDS installing feature, then some files can already be in the right
1457 % place, see the documentation of \docstrip.
1458 %
1459 % \subsection{Refresh file name databases}
1460 %
1461 % If your \TeX~distribution
1462 % (\TeX\,Live, \mikTeX, \dots) relies on file name databases, you must refresh
1463 % these. For example, \TeX\,Live\ users run \verb|texhash| or
1464 % \verb|mktexlsr|.
1465 %
1466 % \subsection{Some details for the interested}
1467 %
1468 % \paragraph{Unpacking with \LaTeX.}
1469 % The \xfile{.dtx} chooses its action depending on the format:
1470 % \begin{description}
1471 % \item[\plainTeX:] Run \docstrip\ and extract the files.
1472 % \item[\LaTeX:] Generate the documentation.
1473 % \end{description}
1474 % If you insist on using \LaTeX\ for \docstrip\ (really,
1475 % \docstrip\ does not need \LaTeX), then inform the autodetect routine
1476 % about your intention:
1477 % \begin{quote}
1478 % \verb|latex \let\install=y\input{magicnum.dtx}|
1479 % \end{quote}
1480 % Do not forget to quote the argument according to the demands
1481 % of your shell.
1482 %
1483 % \paragraph{Generating the documentation.}
1484 % You can use both the \xfile{.dtx} or the \xfile{.drv} to generate
1485 % the documentation. The process can be configured by the
1486 % configuration file \xfile{ltxdoc.cfg}. For instance, put this
1487 % line into this file, if you want to have A4 as paper format:
1488 % \begin{quote}
1489 % \verb|\PassOptionsToClass{a4paper}{article}|
1490 % \end{quote}
1491 % An example follows how to generate the
1492 % documentation with pdf\LaTeX:
1493 % \begin{quote}
1494 %\begin{verbatim}
1495 %pdflatex magicnum.dtx
1496 %makeindex -s gind.ist magicnum.idx
1497 %pdflatex magicnum.dtx
1498 %makeindex -s gind.ist magicnum.idx
1499 %pdflatex magicnum.dtx
1500 %\end{verbatim}
1501 % \end{quote}
1502 %
1503 % \begin{History}
1504 % \begin{Version}{2007/12/12 v1.0}
1505 % \item
1506 % First public version.
1507 % \end{Version}
1508 % \begin{Version}{2009/04/10 v1.1}
1509 % \item
1510 % Adaptation to \LuaTeX\ 0.40.
1511 % \end{Version}
1512 % \begin{Version}{2010/03/09 v1.2}
1513 % \item
1514 % Adaptation to package \xpackage{luatex} 0.4.
1515 % \end{Version}
1516 % \begin{Version}{2011/03/24 v1.3}
1517 % \item
1518 % Catcode fixes.
1519 % \end{Version}
1520 % \begin{Version}{2011/04/10 v1.4}
1521 % \item
1522 % Compatibility for \hologo{iniTeX}.
1523 % \item
1524 % Dependency from package \xpackage{luatex} removed.
1525 % \item
1526 % Version check for lua module.
1527 % \end{Version}
1528 % \begin{Version}{2016/05/16 v1.5}
1529 % \item
1530 % Documentation updates.
1531 % \end{Version}
1532 % \begin{Version}{2019/07/25 v1.6}
1533 % \item
1534 % remove uses of module function, see PR70
1535 % \end{Version}
1536
1537 % \begin{Version}{2019/11/29 v1.7}
1538 % \item
1539 % Documentation updates.
1540 % \item
1541 % Use \xpackage{iftex} directly.
1542 % \end{Version}
1543 % \end{History}
1544 %
1545 % \PrintIndex
1546 %
1547 % \Finale
1548 \endinput