summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2015-06-29 00:14:57 +0000
committerKarl Berry <karl@freefriends.org>2015-06-29 00:14:57 +0000
commita11217252edfb77b9feb9901511e71ec21c90665 (patch)
tree3c686e4e2a7483a5b7a6d15508b3916e32f62f1a /Master/texmf-dist/tex
parent6215934e06b2e5d056857ea1147e2c6210d2dfdf (diff)
dozenal (28jun15)
git-svn-id: svn://tug.org/texlive/trunk@37698 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex')
-rw-r--r--Master/texmf-dist/tex/latex/dozenal/dozenal.sty217
1 files changed, 164 insertions, 53 deletions
diff --git a/Master/texmf-dist/tex/latex/dozenal/dozenal.sty b/Master/texmf-dist/tex/latex/dozenal/dozenal.sty
index c89806b8c64..b2becd88c90 100644
--- a/Master/texmf-dist/tex/latex/dozenal/dozenal.sty
+++ b/Master/texmf-dist/tex/latex/dozenal/dozenal.sty
@@ -25,9 +25,11 @@
%% This work consists of the files listed in dozenalfilelist.txt.
\NeedsTeXFormat{LaTeX2e}[1999/12/01]
-\ProvidesPackage{dozenal}[2015/01/29 v5.3 support for dozenal fonts]
+\ProvidesPackage{dozenal}[2015/01/29 v6.0 support for dozenal fonts]
\RequirePackage{fixltx2e}
+\RequirePackage{xstring}
\RequirePackage{ifpdf}
+\RequirePackage{mfirstuc}
\DeclareOption{nocounters}{%
\def\nocounters{}%
}%
@@ -76,8 +78,8 @@ dozchbx10 <12-> dozchbx12 }{}
\fi%
\newcommand\x{\TextOrMath{\protect\doz{{X}}}{\doz@X}}%
\newcommand\e{\TextOrMath{\protect\doz{{E}}}{\doz@E}}%
-\DeclareMathSymbol{\doz@X}{\mathord}{dozens}{88}
-\DeclareMathSymbol{\doz@E}{\mathord}{dozens}{69}
+\DeclareMathSymbol{\doz@X}{\mathord}{dozens}{88}%
+\DeclareMathSymbol{\doz@E}{\mathord}{dozens}{69}%
\newcommand\tally[1]{%
\doz{#1}%
}%
@@ -85,59 +87,49 @@ dozchbx10 <12-> dozchbx12 }{}
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\b@charcount
-\def\gobblechar{\let\char= }
-\def\assignthencheck{\afterassignment\checknil\gobblechar}
-\def\countunlessnil{%
-\ifx\char\nil \let\next=\relax%
-\else%
-\let\next=\auxcountchar%
-\advance\b@charcount by1%
-\fi%
-\ifx\char\backslash\advance\b@charcount by-1\fi%
-\next%
+\newcount\doz@countchar
+\def\doz@charcount#1{%
+\StrLen{#1}[\doz@filler]%
+\doz@countchar=\doz@filler%
}%
-\def\auxcountchar{%
-\afterassignment\countunlessnil\gobblechar%
+\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\countchar#1{\def\xx{#1}\b@charcount=0\expandafter\auxcountchar\xx\nil}
-\def\gobble#1{}%
-\newcount\@numdigs%
-\newcount\@decmult%
-\newcount\@loopindex\@loopindex=1%
-\newcount\@decnum\@decnum=0%
-\newcount\@digit\@digit=1%
\def\basex#1{%
-\countchar{#1}\@numdigs=\b@charcount%
-\@decmult=1\@loopindex=1%
-\loop\ifnum\@loopindex<\@numdigs%
-\multiply\@decmult by12%
-\advance\@loopindex by1%
-\repeat%
-\@loopindex=0%
-\def\isten{x}\def\iselv{e}\def\isquote{\backslash}%
-\edef\@doznum{\detokenize{#1}\relax}%
-\@decnum=0%
-\loop\ifnum\@loopindex<\@numdigs%
-\def\@firstchar{\expandafter\@car\@doznum\@nil}%
-\if\@firstchar\@backslashchar
-\edef\@doznum{\@removefirstdig{\@doznum}}%
-\else
-\if\@firstchar\isten\def\@firstchar{10}\fi
-\if\@firstchar\iselv\def\@firstchar{11}\fi
-\advance\@loopindex by1%
-\@digit=\@firstchar%
-\edef\@doznum{\@removefirstdig{\@doznum}}%
-\multiply\@digit by\@decmult%
-\advance\@decnum by\@digit%
-\divide\@decmult by12%
-\fi
-\repeat
-\the\@decnum%
-}
-\def\@removefirstdig#1{%
-\expandafter\expandafter\expandafter\gobble\expandafter\string#1%
-}
+\doz@charcount{#1}%
+\doz@loopi=0%
+\doz@basex{#1}%
+\doz@multiplier=1%
+\doz@total=0%
+}%
\@ifundefined{nocounters}{%
\@ifundefined{c@page}{}{%
\renewcommand\thepage{\basexii{\value{page}}{\x}{\e}}}
@@ -252,6 +244,125 @@ dozchbx10 <12-> dozchbx12 }{}
}
}
}{} % 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'.