diff options
author | Norbert Preining <norbert@preining.info> | 2019-09-02 13:46:59 +0900 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2019-09-02 13:46:59 +0900 |
commit | e0c6872cf40896c7be36b11dcc744620f10adf1d (patch) | |
tree | 60335e10d2f4354b0674ec22d7b53f0f8abee672 /macros/luatex/latex/simurgh/tex/simurgh-tartibi.sty |
Initial commit
Diffstat (limited to 'macros/luatex/latex/simurgh/tex/simurgh-tartibi.sty')
-rw-r--r-- | macros/luatex/latex/simurgh/tex/simurgh-tartibi.sty | 97 |
1 files changed, 97 insertions, 0 deletions
diff --git a/macros/luatex/latex/simurgh/tex/simurgh-tartibi.sty b/macros/luatex/latex/simurgh/tex/simurgh-tartibi.sty new file mode 100644 index 0000000000..729dc7cd2d --- /dev/null +++ b/macros/luatex/latex/simurgh/tex/simurgh-tartibi.sty @@ -0,0 +1,97 @@ +\NeedsTeXFormat{LaTeX2e} +\ProvidesPackage{simurgh-tartibi}[2013/09/18 v0.01a tartibi counter] +\newcommand{\tartibi}[1]{% +\expandafter\@tartibi\csname c@#1\endcsname% +} +\newcommand{\@tartibi}[1]{% +\simurgh@numberstring@tartibi{#1}\simurgh@tartibi{صفرم}{م}% +} +\let\tartibinumeral\@tartibi% +\def\simurgh@numberstring@tartibi#1#2#3#4{% +\ifnum\number#1<\@ne% +#3% +\else\ifnum\number#1<1000000000 % +\expandafter\simurgh@adadi@tartibi\expandafter{\number#1}#2% +\else% +\simurgh@numberoutofrange{#1}{#4}% +\fi\fi% +} +\def\simurgh@adadi@tartibi#1#2{% +\expandafter\simurgh@@adadi@tartibi% +\ifcase% +\ifnum#1<10 1% +\else\ifnum#1<100 2% +\else\ifnum#1<\@m 3% +\else\ifnum#1<\@M 4% +\else\ifnum#1<100000 5% +\else\ifnum#1<1000000 6% +\else\ifnum#1<10000000 7% +\else\ifnum#1<100000000 8% +\else9% +\fi\fi\fi\fi\fi\fi\fi\fi % +\or00000000#1% case 1: Add 8 leading zeros +\or0000000#1% case 2: Add 7 leading zeros +\or000000#1% case 3: Add 6 leading zeros +\or00000#1% case 4: Add 5 leading zeros +\or0000#1% case 5: Add 4 leading zeros +\or000#1% case 6: Add 3 leading zeros +\or00#1% case 7: Add 2 leading zeros +\or0#1% case 8: Add 1 leading zero +\or#1% case 9: Add no leading zeros +\or% +\@nil#2% +\fi% +} +\def\simurgh@@adadi@tartibi#1#2#3#4#5#6#7\or#8\@nil#9{% +\ifnum#1#2#3>\z@ +\simurgh@milyoongan@tartibi#1#2#3% +\ifnum#7>\z@\ifnum#4#5#6>\z@\ و \else\ و \fi\else\ifnum#4#5#6>\z@\ و \fi\fi% +\fi% +\ifnum#4#5#6>\z@% +\simurgh@sadgan#4#5#6{#1#2#3}{#4#5}\simurgh@yekani% +\ifnum#4#5#6>\@ne \fi% +هزار% +\ifnum#7>\z@\ و \fi% +\fi% +\simurgh@sadgan@tartibi#7{#4#5#6}1#9% +} +\def\simurgh@milyoongan@tartibi#1#2#3{% +\ifnum#1#2#3=\@ne% +\simurgh@sadgan@tartibi#1#2#301\simurgh@yekaniii% +% +میلیون% +\else% +\simurgh@sadgan#1#2#301\simurgh@yekanii% +% +میلیون% +\fi% +} +\def\simurgh@sadgan@tartibi#1#2#3#4#5#6{% +\ifnum#1>\z@% +\ifnum#4#1>\@ne\simurgh@yekaniv#1\fi% +صد% +\ifnum#2#3>\z@\ و \fi% +\fi% +\ifnum#2#3<20% +\ifnum#5#2#3>\@ne\ifnum#1#2#3#4#5=10001 اول\else#6{#2#3}\fi\fi% +\else% +\simurgh@dahgan#2% +\ifnum#3>\z@\ و \simurgh@yekanv#3\fi% +#60% +\fi% +} +\def\simurgh@tartibi#1{% +\ifcase#1م\or یکم\or دوم\or سوم\or چهارم% +\or پنجم\or ششم\or هفتم\or هشتم\or نهم% +\or دهم\or یازدهم\or دوازدهم\or سیزدهم% +\or چهاردهم\or پانزدهم\or شانزدهم% +\or هفدهم\or هجدهم\or نوزدهم\fi% +} +\def\simurgh@yekanv#1{% +\ifcase#1\@empty\or یک\or دو\or سو\or چهار\or پنج\or شش% +\or هفت\or هشت\or نه\or ده\or یازده\or دوازده\or سیزده% +\or چهارده\or پانزده\or شانزده\or هفده% +\or هجده\or نوزده\fi% +} + +\endinput
\ No newline at end of file |