summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/lualatex/simurgh/simurgh-abjad.sty
blob: 0c55e5426063be4117714c9024aea7aa8de56a52 (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
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{simurgh-abjad}[2013/12/01 v0.01a abjad counter]
\if@simurgh@csundef{abjadnumeral}{%
\def\abjadnumeral#1{%
\ifnum#1>1999 \simurgh@warning{Illegal value (#1) for abjad numeral} {#1}
\else
  \ifnum#1<\z@\space\simurgh@warning{Illegal value (#1) for abjad numeral}%
  \else
    \ifnum#1<10\expandafter\abj@num@i\number#1%
    \else
      \ifnum#1<100\expandafter\abj@num@ii\number#1%
      \else
        \ifnum#1<\@m\expandafter\abj@num@iii\number#1%
        \else
          \ifnum#1<\@M\expandafter\abj@num@iv\number#1%since #1<2000, we must have 1000
          \fi
        \fi
      \fi
    \fi
  \fi
\fi
}
\def\abjad@zero{}
\def\abj@num@i#1{%
  \ifcase#1\or آ\or ب\or ج\or د%
           \or ه‍\or و\or ز\or ح\or ط\fi
  \ifnum#1=\z@\abjad@zero\fi}
\def\abj@num@ii#1{%
  \ifcase#1\or ی\or ک\or ل\or م\or ن%
           \or س\or ع\or ف\or ص\fi
  \ifnum#1=\z@\fi\abj@num@i}
\def\abj@num@iii#1{%
  \ifcase#1\or ق\or ر\or ش\or ت\or ث%
            \or خ\or ذ\or ض\or ظ\fi
  \ifnum#1=\z@\fi\abj@num@ii}
\def\abj@num@iv#1{%
  \ifcase#1\or غ\fi
  \ifnum#1=\z@\fi\abj@num@iii}
}{}
   \let\@latinalph\@alph%
   \let\@latinAlph\@Alph%
\def\ParsiAlphs{%
   \let\@alph\abjadnumeral%
   \let\@Alph\abjadnumeral%
}
\def\LatinAlphs{%
   \let\@alph\@latinalph%
   \let\@Alph\@latinAlph%
}
\ParsiAlphs
\endinput