diff options
author | Karl Berry <karl@freefriends.org> | 2011-09-19 23:52:10 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2011-09-19 23:52:10 +0000 |
commit | 8cd3c1d1e18fc80346a815f6bd321e86e18fc47a (patch) | |
tree | 0e26d88bb4eec8b42ab8cbbbe7da0f23d783c0dd /Master/texmf-dist/tex/xelatex | |
parent | 7e068a7557c636b0997d467d5f33f843ecd9b833 (diff) |
xepersian (19sep11)
git-svn-id: svn://tug.org/texlive/trunk@24031 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/xelatex')
-rw-r--r-- | Master/texmf-dist/tex/xelatex/xepersian/xepersian.sty | 206 |
1 files changed, 200 insertions, 6 deletions
diff --git a/Master/texmf-dist/tex/xelatex/xepersian/xepersian.sty b/Master/texmf-dist/tex/xelatex/xepersian/xepersian.sty index bcff2e7d19f..d8d9ba65701 100644 --- a/Master/texmf-dist/tex/xelatex/xepersian/xepersian.sty +++ b/Master/texmf-dist/tex/xelatex/xepersian/xepersian.sty @@ -13,8 +13,8 @@ %% %% \NeedsTeXFormat{LaTeX2e} -\def\xepersianversion{v1.2.0} -\def\xepersiandate{2011/09/16} +\def\xepersianversion{v1.2.1} +\def\xepersiandate{2011/10/01} \ProvidesPackage{xepersian}[\xepersiandate\space \xepersianversion\space Persian typesetting in XeLaTeX] \RequirePackage{fontspec} @@ -294,10 +294,204 @@ Location on CTAN: /macros/xetex/latex/xepersian} ج\or چ\or ح\or خ\or د\or ذ\or ر\or ز\or ژ\or س\or ش\or ص\or ض\or ط\or ظ\or ع\or غ\or ف\or ق\or ک\or گ\or ل\or م\or ن\or و\or ه\or ی\else\@ctrerr\fi} \def\harfi#1{\expandafter\@harfi\csname c@#1\endcsname} -\def\@adadi#1{\ifcase#1 \or یک\or دو\or سه\or چهار\or پنج\or شش\or هفت\or هشت\or نه\or ده\or یازده\or دوازده\or سیزده\or چهارده\or پانزده\or شانزده\or هفده\or هجده\or نوزده\or بیست\else\@ctrerr\fi} -\def\adadi#1{\expandafter\@adadi\csname c@#1\endcsname} -\def\@tartibi#1{\ifcase#1 \or اول \or دوم \or سوم \or چهارم \or پنجم \or ششم \or هفتم \or هشتم \or نهم \or دهم \or یازدهم \or دوازدهم \or سیزدهم \or چهاردهم \or پانزدهم \or شانزدهم \or هفدهم \or هجدهم \or نوزدهم \or بیستم\else\@ctrerr\fi} -\def\tartibi#1{\expandafter\@tartibi\csname c@#1\endcsname} +\let\harfinumeral\@harfi +\newcommand{\adadi}[1]{% +\expandafter\@adadi\csname c@#1\endcsname% +} +\newcommand{\@adadi}[1]{% +\xepersian@numberstring{#1}\xepersian@yekanii{صفر}{}% +} +\let\adadinumeral\@adadi% +\def\xepersian@numberoutofrange#1#2{% +\number#1#2% +} +\def\xepersian@numberstring#1#2#3#4{% +\ifnum\number#1<\@ne% +#3% +\else\ifnum\number#1<1000000000 % +\expandafter\xepersian@adadi\expandafter{\number#1}#2% +\else% +\xepersian@numberoutofrange{#1}{#4}% +\fi\fi% +} +\def\xepersian@adadi#1#2{% +\expandafter\xepersian@@adadi% +\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\xepersian@@adadi#1#2#3#4#5#6#7\or#8\@nil#9{% +\ifnum#1#2#3>\z@ +\xepersian@milyoongan#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@% +\xepersian@sadgan#4#5#6{#1#2#3}{#4#5}\xepersian@yekani% +\ifnum#4#5#6>\@ne\fi% +هزار% +\ifnum#7>\z@\ و \fi% +\fi% +\xepersian@sadgan#7{#4#5#6}1#9% +} +\def\xepersian@milyoongan#1#2#3{% +\ifnum#1#2#3=\@ne% +\xepersian@sadgan#1#2#301\xepersian@yekaniii% +% +میلیون% +\else% +\xepersian@sadgan#1#2#301\xepersian@yekanii% +% +میلیون% +\fi% +} +\def\xepersian@sadgan#1#2#3#4#5#6{% +\ifnum#1>\z@% +\ifnum#4#1>\@ne\xepersian@yekaniv#1\fi% +صد% +\ifnum#2#3>\z@\ و \fi% +\fi% +\ifnum#2#3<20% +\ifnum#5#2#3>\@ne#6{#2#3}\fi% +\else% +\xepersian@dahgan#2% +\ifnum#3>\z@\ و \xepersian@yekani#3\fi% +#60% +\fi% +} +\def\xepersian@yekani#1{% +\ifcase#1\@empty\or یک\or دو\or سه\or چهار\or پنج\or شش% +\or هفت\or هشت\or نه\or ده\or یازده\or دوازده\or سیزده% +\or چهارده\or پانزده\or شانزده\or هفده% +\or هجده\or نوزده\fi% +} +\def\xepersian@yekanii#1{% +\ifcase#1\@empty\or یک\else\xepersian@yekani{#1}\fi% +} +\def\xepersian@yekaniii#1{% +\ifcase#1\@empty\or یک\else\xepersian@yekani{#1}\fi% +} +\def\xepersian@yekaniv#1{% +\ifcase#1\@empty\or\or دوی\or سی\or چهار\or پان\or شش% +\or هفت\or هشت\or نه\fi% +} +\def\xepersian@dahgan#1{% +\ifcase#1\or\or بیست\or سی\or چهل% +\or پنجاه\or شصت\or هفتاد\or هشتاد% +\or نود\fi% +} +\newcommand{\tartibi}[1]{% +\expandafter\@tartibi\csname c@#1\endcsname% +} +\newcommand{\@tartibi}[1]{% +\xepersian@numberstring@tartibi{#1}\xepersian@tartibi{صفرم}{م}% +} +\let\tartibinumeral\@tartibi% +\def\xepersian@numberstring@tartibi#1#2#3#4{% +\ifnum\number#1<\@ne% +#3% +\else\ifnum\number#1<1000000000 % +\expandafter\xepersian@adadi@tartibi\expandafter{\number#1}#2% +\else% +\xepersian@numberoutofrange{#1}{#4}% +\fi\fi% +} +\def\xepersian@adadi@tartibi#1#2{% +\expandafter\xepersian@@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\xepersian@@adadi@tartibi#1#2#3#4#5#6#7\or#8\@nil#9{% +\ifnum#1#2#3>\z@ +\xepersian@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@% +\xepersian@sadgan#4#5#6{#1#2#3}{#4#5}\xepersian@yekani% +\ifnum#4#5#6>\@ne \fi% +هزار% +\ifnum#7>\z@\ و \fi% +\fi% +\xepersian@sadgan@tartibi#7{#4#5#6}1#9% +} +\def\xepersian@milyoongan@tartibi#1#2#3{% +\ifnum#1#2#3=\@ne% +\xepersian@sadgan@tartibi#1#2#301\xepersian@yekaniii% +% +میلیون% +\else% +\xepersian@sadgan#1#2#301\xepersian@yekanii% +% +میلیون% +\fi% +} +\def\xepersian@sadgan@tartibi#1#2#3#4#5#6{% +\ifnum#1>\z@% +\ifnum#4#1>\@ne\xepersian@yekaniv#1\fi% +صد% +\ifnum#2#3>\z@\ و \fi% +\fi% +\ifnum#2#3<20% +\ifnum#5#2#3>\@ne#6{#2#3}\fi% +\else% +\xepersian@dahgan#2% +\ifnum#3>\z@\ و \xepersian@yekanv#3\fi% +#60% +\fi% +} +\def\xepersian@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\xepersian@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% +} \providecommand*{\xpg@warning}[1]{% \PackageWarning{XePersian}% {#1}} |