1% abjad.sty %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2% defines the command \abjad {#1} 3% to produce the `abjad' rendering of the argument, 4% which must be (or expand within Tex's mouth to) 5% a legal number between 1 and 1999 6% This command works both inside and outside an Arabic environment. 7% 26.04.2003 8% no warranty whatsoever 9%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 10% (c) Klaus Lagally 11% Institut fuer Formale Methoden der Informatik 12% Universitaet Stuttgart 13%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 14 15\ifx \abjatcode \undefined \else \expandafter \endinput 16\fi % load only once 17 18\chardef \abjatcode = \catcode`\@ \catcode`\@ = 11 19 20\a@ident {abjad.sty} {3.11 abjad numerals } {26.04.2003} 21 22%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 23 24\def \abj@d #1{% convert to abjad notation if possible 25\ifnum #1>1999 #1 \else \ifnum #1=0 0 \else 26\ifnum #1>999 \xpa\@bjad \number #1\else 27\ifnum #1>099 \xpa\@bjad \xpa0\number#1\else 28\ifnum #1>009 \xpa\@bjad \xpa0\xpa0\number#1\else 29\xpa\@bjad \xpa0\xpa0\xpa0\number#1% 30\fi\fi\fi\fi\fi } 31 32\def \@bjad #1#2#3#4{% convert to abjad notation 33\ifx #10\else .g\fi 34\ifcase #2 \or q\or r\or ^s\or t\or _t \or _h\or _d\or .d\or .z\fi 35\ifcase #3 \or Y\or k\or l\or m\or n\or s\or `\or f\or .s\fi 36\ifcase #4 \or |A\or .b\or .h-\or d\or h\or w\or z\or .h\or .t\fi } 37 38%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 39 40\def \abjad #1{% inside a Roman environment 41\edef \the@bjad {\abj@d {#1}}% 42\novocalize \arabtrue \transfalse \RL {\stdcode {\the@bjad }}% 43\iftrans {\set@transfont \ \trans@text #1 \end }\fi } 44 45\def \a@c@abjad #1{% inside an Arabic environment 46\putwordb@x {\transfalse \showfalse \abjad {#1}}% 47\iftrans {\set@transfont \trans@text #1 \end }\fi 48\arab@tail } 49 50\allowarab \the@bjad 51 52% NOTE: \abj@d is fully expandable 53 54%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 55 56\def \Abjad #1{\xpa \@Abjad \csname c@#1\endcsname } 57 58\let \@Abjad \abj@d 59 60%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 61 62\catcode `\@ = \abjatcode 63 64\endinput 65%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 66 67 68 69