summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/dozenal/dozenal.sty
blob: 8938d214017db0eb26dd803f80100ea331ad8761 (plain)
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
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
%%
%% This is file `dozenal.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% dozenal.dtx  (with options: `package')
%% This is a generated file.
%% 
%% This document is copyright 2015 by Donald P. Goodman, and is
%% released publicly under the LaTeX Project Public License.  The
%% distribution and modification of this work is constrained by the
%% conditions of that license.  See
%% http://www.latex-project.org/lppl.txt
%% for the text of the license.  This document is released
%% under version 1.3 of that license, and this work may be distributed
%% or modified under the terms of that license or, at your option, any
%% later version.
%% 
%% This work has the LPPL maintenance status 'maintained'.
%% 
%% The Current Maintainer of this work is Donald P. Goodman
%% (dgoodmaniii@gmail.com).
%% 
%% This work consists of the files listed in dozenalfilelist.txt.

\NeedsTeXFormat{LaTeX2e}[1999/12/01]
\ProvidesPackage{dozenal}[2018/05/11 v7.2 support for dozenal fonts]
\RequirePackage{fixltx2e}
\RequirePackage{xstring}
\RequirePackage{ifpdf}
\RequirePackage{ifluatex}
\ifluatex
\protected\def\pdfmapfile {\pdfextension mapfile }
\fi
\RequirePackage{mfirstuc}
\DeclareOption{nocounters}{%
\def\nocounters{}%
}%
\newif\iftypeone\typeonefalse
\DeclareOption{typeone}{\typeonetrue}
\ProcessOptions\relax
\iftypeone%
\ifpdf
\pdfmapfile{=dozenal.map}
\fi
\DeclareFontFamily{T1}{dozch}{}
\DeclareFontShape{T1}{dozch}{m}{n}{<-6> dozchars6
<7> dozchars7 <8> dozchars8 <9> dozchars9 <10-11>
dozchars10 <12-16> dozchars12 <17-> dozchars17  }{}
\DeclareFontShape{T1}{dozch}{b}{n}{<-> dozchb10 }{}
\DeclareFontShape{T1}{dozch}{bx}{n}{<-6> dozchbx6
<7> dozchbx7 <8> dozchbx8 <9> dozchbx9 <10-11>
dozchbx10 <12-> dozchbx12 }{}
\DeclareFontShape{T1}{dozch}{m}{sl}{<-8> dozchsl8
<9> dozchsl9 <10-11> dozchsl10 <12-> dozchsl12 }{}
\DeclareFontShape{T1}{dozch}{bx}{sl}{<-> dozchbxsl10 }{}
\DeclareFontShape{T1}{dozch}{m}{it}{<-7> dozchit7
<8> dozchit8 <9> dozchit9 <10-11> dozchit10
<12-> dozchit12 }{}
\DeclareFontShape{T1}{dozch}{bx}{it}{<-> dozchbxi10 }{}
\def\doz#1{{\fontfamily{dozch}\fontencoding{T1}\selectfont #1}}%
\DeclareSymbolFont{dozens}{T1}{dozch}{m}{n}
\else%
\DeclareFontFamily{OT1}{dozch}{}
\DeclareFontShape{OT1}{dozch}{m}{n}{<-6> dozchars6
<7> dozchars7 <8> dozchars8 <9> dozchars9 <10-11>
dozchars10 <12-16> dozchars12 <17-> dozchars17  }{}
\DeclareFontShape{OT1}{dozch}{b}{n}{<-> dozchb10 }{}
\DeclareFontShape{OT1}{dozch}{bx}{n}{<-6> dozchbx6
<7> dozchbx7 <8> dozchbx8 <9> dozchbx9 <10-11>
dozchbx10 <12-> dozchbx12 }{}
\DeclareFontShape{OT1}{dozch}{m}{sl}{<-8> dozchsl8
<9> dozchsl9 <10-11> dozchsl10 <12-> dozchsl12 }{}
\DeclareFontShape{OT1}{dozch}{bx}{sl}{<-> dozchbxsl10 }{}
\DeclareFontShape{OT1}{dozch}{m}{it}{<-7> dozchit7
<8> dozchit8 <9> dozchit9 <10-11> dozchit10
<12-> dozchit12 }{}
\DeclareFontShape{OT1}{dozch}{bx}{it}{<-> dozchbxi10 }{}
\def\doz#1{{\fontfamily{dozch}\fontencoding{OT1}\selectfont #1}}%
\DeclareSymbolFont{dozens}{OT1}{dozch}{m}{n}
\fi%
\newcommand\x{\unexpanded{\TextOrMath{\protect\doz{{X}}}{\doz@X}}}%
\newcommand\e{\unexpanded{\TextOrMath{\protect\doz{{E}}}{\doz@E}}}%
\DeclareMathSymbol{\doz@X}{\mathord}{dozens}{88}%
\DeclareMathSymbol{\doz@E}{\mathord}{dozens}{69}%
\newcommand\tally[1]{%
\doz{#1}%
}%
\def\basexii#1#2#3{\ifcase\numexpr(#1)\relax
0\or1\or2\or3\or4\or5\or6\or7\or8\or9\or#2\or#3\else
\expandafter\basexii\expandafter{\number\numexpr((#1)-6)/12}{#2}{#3}\expandafter\basexii\expandafter{\number\numexpr(#1)-((#1)-6)/12*12}{#2}{#3}\fi}
\newcommand\dozens[1]{\basexii{#1}{\x}{\e}}
\newcount\doz@countchar
\def\doz@charcount#1{%
\StrLen{#1}[\doz@filler]%
\doz@countchar=\doz@filler%
}%
\newcount\doz@lfiller\doz@lfiller=-1%
\newcount\doz@total\doz@total=0%
\newcount\doz@loopi\doz@loopi=0%
\newcount\doz@multiplier\doz@multiplier=1%
\def\ninthofmany#1#2#3#4#5#6#7#8#9{#9\gobbletorelax}
\def\gobbletorelax#1\relax{}
\def\doz@CharAt#1#2{%
\expandafter\ninthofmany\romannumeral\numexpr(9000-\number#1000)#2\relax}
\def\doz@ten{X}%
\def\doz@elv{E}%
\def\doz@basex#1{%
\doz@total=0%
\doz@loopi=\doz@countchar%
\doz@multiplier=1%
\def\doz@wholenum{#1}%
\loop\ifnum\doz@loopi>0%
\def\doz@currchar{\doz@CharAt{\number\doz@loopi}{\doz@wholenum}}%
\if\doz@currchar\doz@ten%
\doz@lfiller=10%
\else\if\doz@currchar\doz@elv%
\doz@lfiller=11%
\else%
\doz@lfiller=\doz@currchar%
\fi\fi%
\multiply\doz@lfiller by\doz@multiplier%
\multiply\doz@multiplier by12%
\advance\doz@total by\doz@lfiller%
\advance\doz@loopi by-1%
\repeat%
\the\doz@total%
}%
\def\basex#1{%
\doz@charcount{#1}%
\doz@loopi=0%
\doz@basex{#1}%
\doz@multiplier=1%
\doz@total=0%
}%
\newcount\doz@modulus%
\def\doz@modulo#1#2{%
\doz@modulus=#1%
\divide\doz@modulus by#2%
\multiply\doz@modulus by#2%
\multiply\doz@modulus by-1%
\advance\doz@modulus by#1\relax%
}%
\newcount\doz@quotient%
\def\doz@quot#1#2{%
\doz@quotient=#1%
\divide\doz@quotient by#2%
}%
\newcount\doz@romct%
\newif\ifdoz@domancaps%
\def\doz@doman#1{%
\doz@romct=#1%
\doz@quot{\doz@romct}{1728}%
\loop\ifnum\doz@quotient>0%
\ifdoz@domancaps M\else m\fi%
\advance\doz@quotient by-1%
\advance\doz@romct by-1728%
\repeat
\ifnum\doz@romct>1440
\ifnum\doz@romct<1584
\ifdoz@domancaps CCM\else ccm\fi%
\advance\doz@romct by-1440
\else%\ifnum\doz@romct>1583
\ifdoz@domancaps CM\else cm\fi%
\advance\doz@romct by-1584
\fi
\fi
\ifnum\doz@romct>575%
\ifnum\doz@romct<719
\ifdoz@domancaps CCD\else ccd\fi%
\advance\doz@romct by-576
\else
\ifnum\doz@romct<864%
\ifdoz@domancaps CD\else cd\fi%
\advance\doz@romct by-720%
\fi
\fi
\else
\ifnum\doz@romct>719
\ifdoz@domancaps D\else d\fi%
\advance\doz@romct by-719%
\fi
\fi
\doz@quot{\doz@romct}{144}%
\loop\ifnum\doz@quotient>0%
\ifdoz@domancaps C\else c\fi%
\advance\doz@quotient by-1%
\advance\doz@romct by-144%
\repeat
\ifnum\doz@romct>119
\ifnum\doz@romct<132
\ifdoz@domancaps XXC\else xxc\fi%
\advance\doz@romct by-120
\else
\ifdoz@domancaps XC\else xc\fi%
\advance\doz@romct by-132
\fi
\fi
\ifnum\doz@romct>71
\ifdoz@domancaps L\else l\fi%
\advance\doz@romct by-72
\fi
\ifnum\doz@romct>47%
\ifnum\doz@romct>59%
\ifdoz@domancaps XL\else xl\fi%
\advance\doz@romct by-60%
\else
\ifdoz@domancaps XXL\else xxl\fi%
\advance\doz@romct by-48%
\fi
\fi
\doz@quot{\doz@romct}{12}%
\loop\ifnum\doz@quotient>0%
\ifdoz@domancaps X\else x\fi%
\advance\doz@quotient by-1%
\advance\doz@romct by-12%
\repeat
\doz@modulo{\doz@romct}{12}%
\ifnum\doz@modulus=10
\ifdoz@domancaps IIX\else iix\fi%
\advance\doz@romct by-10
\fi
\ifnum\doz@modulus=11
\ifdoz@domancaps IX\else ix\fi%
\advance\doz@romct by-11
\fi
\ifnum\doz@romct>5
\ifdoz@domancaps V\else v\fi%
\advance\doz@romct by-6
\fi
\ifnum\doz@romct>3%
\ifnum\doz@romct=4%
\ifdoz@domancaps IIV\else iiv\fi%
\advance\doz@romct by-4%
\else
\ifnum\doz@romct=5%
\ifdoz@domancaps IV\else iv\fi%
\advance\doz@romct by-5%
\fi
\ifnum\doz@romct=6%
\ifdoz@domancaps V\else v\fi%
\advance\doz@romct by-6
\fi
\fi
\fi
\doz@quot{\doz@romct}{1}%
\loop\ifnum\doz@quotient>0%
\ifdoz@domancaps I\else i\fi%
\advance\doz@quotient by-1%
\advance\doz@romct by-1%
\repeat
}
\protected\def\doman#1{%
\doz@domancapsfalse%
\doz@doman{#1}%
}%
\protected\def\Doman#1{%
\doz@domancapstrue%
\doz@doman{#1}%
}%
\@ifundefined{nocounters}{%
\@ifundefined{c@page}{}{%
\renewcommand\thepage{\basexii{\value{page}}{\x}{\e}}}
\@ifundefined{c@footnote}{}{%
\renewcommand\thefootnote{%
\basexii{\value{footnote}}{\x}{\e}}}
\@ifundefined{c@part}{}{%
\renewcommand\thepart{%
\basexii{\value{part}}{\x}{\e}}}
\@ifundefined{c@subparagraph}{}{%
\renewcommand\thesubparagraph{%
\basexii{\value{subparagraph}}{\x}{\e}}}
\@ifundefined{c@paragraph}{}{%
\renewcommand\theparagraph{%
\basexii{\value{paragraph}}{\x}{\e}}}
\@ifundefined{c@equation}{}{%
\renewcommand\theequation{%
\basexii{\value{equation}}{\x}{\e}}}
\@ifundefined{c@figure}{}{%
\renewcommand\thefigure{%
\basexii{\value{figure}}{\x}{\e}}}
\@ifundefined{c@table}{}{%
\renewcommand\thetable{%
\basexii{\value{table}}{\x}{\e}}}
\@ifundefined{c@table}{}{%
\renewcommand\thempfootnote{%
\basexii{\value{mpfootnote}}{\x}{\e}}}
\@ifundefined{c@enumi}{}{%
\renewcommand\theenumi{%
\basexii{\value{enumi}}{\x}{\e}}}
\@ifundefined{c@enumii}{}{%
\renewcommand\theenumii{%
\basexii{\value{enumii}}{\x}{\e}}}
\@ifundefined{c@enumiii}{}{%
\renewcommand\theenumiii{%
\basexii{\value{enumiii}}{\x}{\e}}}
\@ifundefined{c@enumiv}{}{%
\renewcommand\theenumiv{%
\basexii{\value{enumiv}}{\x}{\e}}}
\@ifundefined{c@chapter}{%
\renewcommand\thesection{%
\basexii{\value{section}}{\x}{\e}}
\renewcommand\thesubsection{%
\thesection.\basexii{\value{subsection}}{\x}{\e}}
\renewcommand\thesubsubsection{%
\thesubsection.\basexii{\value{subsubsection}}{\x}{\e}}
}{
\renewcommand\thechapter{%
\basexii{\value{chapter}}{\x}{\e}}
\renewcommand\thesection{%
\thechapter.\basexii{\value{section}}{\x}{\e}}
\renewcommand\thesubsection{%
\thesection.\basexii{\value{subsection}}{\x}{\e}}
\renewcommand\thesubsubsection{%
\thesubsection.\basexii{\value{subsubsection}}{\x}{\e}}
}
\@ifundefined{mainmatter}{}{%
\g@addto@macro\mainmatter{%
\@ifundefined{c@page}{}{%
\renewcommand\thepage{\basexii{\value{page}}{\x}{\e}}}
\@ifundefined{c@footnote}{}{%
\renewcommand\thefootnote{\basexii{\value{footnote}}{\x}{\e}}}
\@ifundefined{c@part}{}{%
\renewcommand\thepart{\basexii{\value{part}}{\x}{\e}}}
\@ifundefined{c@subparagraph}{}{%
\renewcommand\thesubparagraph{%
\basexii{\value{subparagraph}}{\x}{\e}}}
\@ifundefined{c@paragraph}{}{%
\renewcommand\theparagraph{%
\basexii{\value{paragraph}}{\x}{\e}}}
\@ifundefined{c@equation}{}{%
\renewcommand\theequation{%
\basexii{\value{equation}}{\x}{\e}}}
\@ifundefined{c@figure}{}{%
\renewcommand\thefigure{%
\basexii{\value{figure}}{\x}{\e}}}
\@ifundefined{c@table}{}{%
\renewcommand\thetable{%
\basexii{\value{table}}{\x}{\e}}}
\@ifundefined{c@table}{}{%
\renewcommand\thempfootnote{%
\basexii{\value{mpfootnote}}{\x}{\e}}}
\@ifundefined{c@enumi}{}{%
\renewcommand\theenumi{%
\basexii{\value{enumi}}{\x}{\e}}}
\@ifundefined{c@enumii}{}{%
\renewcommand\theenumii{%
\basexii{\value{enumii}}{\x}{\e}}}
\@ifundefined{c@enumiii}{}{%
\renewcommand\theenumiii{%
\basexii{\value{enumiii}}{\x}{\e}}}
\@ifundefined{c@enumiv}{}{%
\renewcommand\theenumiv{%
\basexii{\value{enumiv}}{\x}{\e}}}
\@ifundefined{c@chapter}{
\renewcommand\thesection{%
\basexii{\value{section}}{\x}{\e}}
\renewcommand\thesubsection{%
\thesection.\basexii{\value{subsection}}{\x}{\e}}
\renewcommand\thesubsubsection{%
\thesubsection.\basexii{\value{subsubsection}}{\x}{\e}}
}{
\renewcommand\thechapter{%
\basexii{\value{chapter}}{\x}{\e}}
\renewcommand\thesection{%
\thechapter.\basexii{\value{section}}{\x}{\e}}
\renewcommand\thesubsection{%
\thesection.\basexii{\value{subsection}}{\x}{\e}}
\renewcommand\thesubsubsection{%
\thesubsection.\basexii{\value{subsubsection}}{\x}{\e}}
} % end if it's defined
}
}
}{} % end redefinition of counters block
\def\dozrankoneword{unqua}
\def\dozranktwoword{biqua}
\def\dozrankthreeword{triqua}
\def\dozrankfourword{quadqua}
\def\dozrankfiveword{pentqua}
\def\dozranksixword{hexqua}
\def\dozranksevenword{septqua}
\def\dozrankeightword{octqua}
\def\dozranknineword{ennqua}
\def\dozranktenword{decqua}
\def\dozrankelvword{elvqua}
\newif\ifDOZcaps\DOZcapsfalse
\newif\ifDozcaps\Dozcapsfalse
\def\doz@expandloop#1{\doz@xloop#1\relax}
\def\doz@xloop#1{%
\ifx\relax#1\else%
\doz@numword#1%
\expandafter\doz@xloop\fi%
}
\def\printdozrankword{}
\def\doz@rankword{%
\ifnum\doz@countchar=12
\def\printdozrankword{\dozrankelvword}%
\fi
\ifnum\doz@countchar=11
\def\printdozrankword{\dozranktenword}%
\fi
\ifnum\doz@countchar=10
\def\printdozrankword{\dozranknineword}%
\fi
\ifnum\doz@countchar=9
\def\printdozrankword{\dozrankeightword}%
\fi
\ifnum\doz@countchar=8
\def\printdozrankword{\dozranksevenword}%
\fi
\ifnum\doz@countchar=7
\def\printdozrankword{\dozranksixword}%
\fi
\ifnum\doz@countchar=6
\def\printdozrankword{\dozrankfiveword}%
\fi
\ifnum\doz@countchar=5
\def\printdozrankword{\dozrankfourword}%
\fi
\ifnum\doz@countchar=4
\def\printdozrankword{\dozrankthreeword}%
\fi
\ifnum\doz@countchar=3
\def\printdozrankword{\dozranktwoword}%
\fi
\ifnum\doz@countchar=2
\def\printdozrankword{\dozrankoneword}%
\fi
\ifnum\doz@countchar=1
\def\printdozrankword{\relax}%
\fi
\advance\doz@countchar by-1
\ifDOZcaps
\edef\printdozrankword{\uppercase{\printdozrankword}}%
\fi
\ifDozcaps
\edef\printdozrankword{\capitalisewords{\printdozrankword}}%
\fi
\ifnum\doz@countchar>0
\ \printdozrankword\ %
\else
\printdozrankword%
\fi
}%
\def\doz@numword#1{%
\IfStrEq{#1}{0}{\def\doz@numberword{zero}}{}%
\IfStrEq{#1}{1}{\def\doz@numberword{one}}{}%
\IfStrEq{#1}{2}{\def\doz@numberword{two}}{}%
\IfStrEq{#1}{3}{\def\doz@numberword{three}}{}%
\IfStrEq{#1}{4}{\def\doz@numberword{four}}{}%
\IfStrEq{#1}{5}{\def\doz@numberword{five}}{}%
\IfStrEq{#1}{6}{\def\doz@numberword{six}}{}%
\IfStrEq{#1}{7}{\def\doz@numberword{seven}}{}%
\IfStrEq{#1}{8}{\def\doz@numberword{eight}}{}%
\IfStrEq{#1}{9}{\def\doz@numberword{nine}}{}%
\IfStrEq{#1}{X}{\def\doz@numberword{ten}}{}%
\IfStrEq{#1}{E}{\def\doz@numberword{eleven}}{}%
\ifDOZcaps
\edef\doz@numberword{\uppercase{\doz@numberword}}%
\fi
\ifDozcaps
\edef\doz@numberword{\makefirstuc{\doz@numberword}}%
\fi
\doz@numberword%
\doz@rankword%
}%
\def\doznumtoword#1{%
\edef\thenumber{\basexii{\value{#1}}{X}{E}}%
\expandafter\doz@charcount\expandafter{\thenumber}%
\expandafter\doz@expandloop\expandafter{\thenumber}%
\doz@countchar=0%
}%
\def\DOZnumtoword#1{%
\DOZcapstrue%
\doznumtoword{#1}%
\DOZcapsfalse%
}%
\def\Doznumtoword#1{%
\Dozcapstrue%
\doznumtoword{#1}%
\Dozcapsfalse%
}%
\AtBeginDocument{%
    \mathchardef\humphrey\mathcode`\;%
    \mathcode`\;="8000 %
}
{\catcode`;=\active
    \gdef;{\futurelet\@let@token\sm@rtsemi}
}
\def\sm@rtsemi{%
    \ifx\@let@token\@sptoken \else
    \ifx\@let@token\space \else
    \mathord\fi\fi \humphrey}
\endinput
%%
%% End of file `dozenal.sty'.