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
|
% abjad.sty %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% defines the command \abjad {#1}
% to produce the `abjad' rendering of the argument,
% which must be (or expand within Tex's mouth to)
% a legal number between 1 and 1999
% This command works both inside and outside an Arabic environment.
% 17.07.1999
% no warranty whatsoever
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% (c) Klaus Lagally
% Institut fuer Informatik
% Universitaet Stuttgart
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\ifx \abjatcode \undefined \else \expandafter \endinput
\fi % load only once
\chardef \abjatcode = \catcode`\@ \catcode`\@ = 11
\a@ident {abjad.sty} {3.09 abjad numerals } {17.07.1999}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\def \abj@d #1{% convert to abjad notation if possible
\ifnum #1>1999 #1 \else \ifnum #1=0 0 \else
\ifnum #1>999 \xpa\@bjad \number #1\else
\ifnum #1>099 \xpa\@bjad \xpa0\number#1\else
\ifnum #1>009 \xpa\@bjad \xpa0\xpa0\number#1\else
\xpa\@bjad \xpa0\xpa0\xpa0\number#1%
\fi\fi\fi\fi\fi }
\def \@bjad #1#2#3#4{% convert to abjad notation
\ifx #10\else .g\fi
\ifcase #2 \or q\or r\or ^s\or t\or _t \or _h\or _d\or .d\or .z\fi
\ifcase #3 \or Y\or k\or l\or m\or n\or s\or `\or f\or .s\fi
\ifcase #4 \or |A\or .b\or .h-\or d\or h\or w\or z\or .h\or .t\fi }
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\def \abjad #1{% inside a Roman environment
\edef \@bj@d {\number #1}\edef \@bj@d {\abj@d {\@bj@d }}%
{\novocalize \arabtrue \transfalse \xpa \RL \xpa {\@bj@d }}%
\iftrans {\set@transfont \ \trans@text #1 \end }\fi }
\def \a@c@abjad #1{% inside an Arabic environment
\putwordb@x {\transfalse \showfalse \abjad {#1}}%
\iftrans {\set@transfont \trans@text #1 \end }\fi
\arab@tail }
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\catcode `\@ = \abjatcode
\endinput
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|