diff options
author | Karl Berry <karl@freefriends.org> | 2013-09-17 22:16:07 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2013-09-17 22:16:07 +0000 |
commit | 5d3eded8ad72ddcafd63144edcd885a7ba0b4b75 (patch) | |
tree | fef63988dc328afbe009cc54117d49f264351c2a /Master/texmf-dist/tex/lualatex/simurgh/simurgh-tartibi.sty | |
parent | ee2e061286e8dd9aaeec0f661c8ea41027660a89 (diff) |
simurgh (17sep13)
git-svn-id: svn://tug.org/texlive/trunk@31684 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/lualatex/simurgh/simurgh-tartibi.sty')
-rw-r--r-- | Master/texmf-dist/tex/lualatex/simurgh/simurgh-tartibi.sty | 97 |
1 files changed, 97 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/lualatex/simurgh/simurgh-tartibi.sty b/Master/texmf-dist/tex/lualatex/simurgh/simurgh-tartibi.sty new file mode 100644 index 00000000000..d2bc039f2e8 --- /dev/null +++ b/Master/texmf-dist/tex/lualatex/simurgh/simurgh-tartibi.sty @@ -0,0 +1,97 @@ +\NeedsTeXFormat{LaTeX2e} +\ProvidesPackage{simurgh-tartibi}[2013/12/01 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 |