| 1 |
\ProvidesFile{babel-hebrewalph.def} |
| 2 |
[2023/06/01 % |
| 3 |
Expandable definitions for Hebrew numerals] |
| 4 |
|
| 5 |
\newcommand*\hebrewnumeral[1]{% |
| 6 |
\expandafter\@hebrew@numeral\expandafter{\the\numexpr#1}% |
| 7 |
} |
| 8 |
\newcommand*\Hebrewnumeral[1]{% |
| 9 |
\expandafter\@Hebrew@numeral\expandafter{\the\numexpr#1}% |
| 10 |
} |
| 11 |
\newcommand*\Hebrewnumeralfinal[1]{% |
| 12 |
\expandafter\@Hebrew@numeralfinal\expandafter{\the\numexpr#1}% |
| 13 |
} |
| 14 |
|
| 15 |
\newcommand*\hebrew@div@trancate[2]{% |
| 16 |
\ifnum\numexpr #1 - #2*\numexpr #1/#2\relax<0 |
| 17 |
\the\numexpr #1/#2 -1\relax\else\the\numexpr #1/#2\relax\fi |
| 18 |
} |
| 19 |
|
| 20 |
\newcommand*\@hebrew@@numeral[2]{% |
| 21 |
\ifnum#1<\z@\space\xpg@warning{Illegal value (#1) for Hebrew numeral}% |
| 22 |
\else |
| 23 |
\ifnum #1<1000 |
| 24 |
\gim@nomil{#1}{#2}% |
| 25 |
\else |
| 26 |
\hebrewnumeral{\hebrew@div@trancate{#1}{1000}}׳% |
| 27 |
\expandafter\gim@nomil\expandafter{\the\numexpr #1 - 1000*\hebrew@div@trancate{#1}{1000}}{#2}% |
| 28 |
\fi |
| 29 |
\fi |
| 30 |
} |
| 31 |
|
| 32 |
\newcommand*\@hebrew@numeral[1]{\@hebrew@@numeral{#1}{0}} |
| 33 |
\newcommand*\@Hebrew@numeral[1]{\@hebrew@@numeral{#1}{1}} |
| 34 |
\newcommand*\@Hebrew@numeralfinal[1]{\@hebrew@@numeral{#1}{2}} |
| 35 |
|
| 36 |
\newcommand*\hebrew@alph@zero{} |
| 37 |
\newcommand*\gim@nomil[2]{% |
| 38 |
\ifcase\hebrew@div@trancate{#1}{100} % print nothing if no hundreds |
| 39 |
\or ק\ifnum #2>0\ifnum #1=100 ׳\fi\fi |
| 40 |
\or ר\ifnum #2>0\ifnum #1=200 ׳\fi\fi |
| 41 |
\or ש\ifnum #2>0\ifnum #1=300 ׳\fi\fi |
| 42 |
\or ת\ifnum #2>0\ifnum #1=400 ׳\fi\fi |
| 43 |
\or ת\ifnum #2>0\ifnum #1=500 ״\fi\fi ק% |
| 44 |
\or ת\ifnum #2>0\ifnum #1=600 ״\fi\fi ר% |
| 45 |
\or ת\ifnum #2>0\ifnum #1=700 ״\fi\fi ש% |
| 46 |
\or ת\ifnum #2>0\ifnum #1=800 ״\fi\fi ת% |
| 47 |
\or תת\ifnum #2>0\ifnum #1=900 ״\fi\fi ק% |
| 48 |
\fi |
| 49 |
\ifnum \the\numexpr #1 - 100*\hebrew@div@trancate{#1}{100} = 16 |
| 50 |
\ifnum #2>0 ט״ז\else טז\fi% tet-zayin |
| 51 |
\else\ifnum \the\numexpr #1 - 100*\hebrew@div@trancate{#1}{100} = 15 |
| 52 |
\ifnum #2>0 ט״ו\else טו\fi% tet-vav |
| 53 |
\else |
| 54 |
\ifcase\expandafter\hebrew@div@trancate\expandafter{\the\numexpr #1 - 100*\hebrew@div@trancate{#1}{100}}{10} % print nothing if no tens |
| 55 |
\or \ifnum \the\numexpr #1 - 10*\hebrew@div@trancate{#1}{10}>0 י\else\ifnum #2>0\ifnum #1=10 י׳\else ״י\fi\else י\fi\fi |
| 56 |
\or \ifnum \the\numexpr #1 - 10*\hebrew@div@trancate{#1}{10}>0 כ\else\ifnum #2>0\ifnum #1>20 ״\fi\fi\if #22ך\else כ\fi\ifnum #2>0\ifnum #1=20 ׳\fi\fi\fi |
| 57 |
\or \ifnum \the\numexpr #1 - 10*\hebrew@div@trancate{#1}{10}>0 ל\else\ifnum #2>0\ifnum #1=30 ל׳\else ״ל\fi\else ל\fi\fi |
| 58 |
\or \ifnum \the\numexpr #1 - 10*\hebrew@div@trancate{#1}{10}>0 מ\else\ifnum #2>0\ifnum #1>40 ״\fi\fi\if #22ם\else מ\fi\ifnum #2>0\ifnum #1=40 ׳\fi\fi\fi |
| 59 |
\or \ifnum \the\numexpr #1 - 10*\hebrew@div@trancate{#1}{10}>0 נ\else\ifnum #2>0\ifnum #1>50 ״\fi\fi\if #22ן\else נ\fi\ifnum #2>0\ifnum #1=50 ׳\fi\fi\fi |
| 60 |
\or \ifnum \the\numexpr #1 - 10*\hebrew@div@trancate{#1}{10}>0 ס\else\ifnum #2>0\ifnum #1=60 ס׳\else ״ס\fi\else ס\fi\fi |
| 61 |
\or \ifnum \the\numexpr #1 - 10*\hebrew@div@trancate{#1}{10}>0 ע\else\ifnum #2>0\ifnum #1=70 ע׳\else ״ע\fi\else ע\fi\fi |
| 62 |
\or \ifnum \the\numexpr #1 - 10*\hebrew@div@trancate{#1}{10}>0 פ\else\ifnum #2>0\ifnum #1>80 ״\fi\fi\if #22ף\else פ\fi\ifnum #2>0\ifnum #1=80 ׳\fi\fi\fi |
| 63 |
\or \ifnum \the\numexpr #1 - 10*\hebrew@div@trancate{#1}{10}>0 צ\else\ifnum #2>0\ifnum #1>90 ״\fi\fi\if #22ץ\else צ\fi\ifnum #2>0\ifnum #1=90 ׳\fi\fi\fi |
| 64 |
\fi |
| 65 |
\ifcase\the\numexpr #1 - 10*\hebrew@div@trancate{#1}{10} |
| 66 |
\hebrew@alph@zero % empty but can be defined if desired |
| 67 |
\or \ifnum #2>0\ifnum #1=1 א׳\else ״א\fi\else א\fi |
| 68 |
\or \ifnum #2>0\ifnum #1=2 ב׳\else ״ב\fi\else ב\fi |
| 69 |
\or \ifnum #2>0\ifnum #1=3 ג׳\else ״ג\fi\else ג\fi |
| 70 |
\or \ifnum #2>0\ifnum #1=4 ד׳\else ״ד\fi\else ד\fi |
| 71 |
\or \ifnum #2>0\ifnum #1=5 ה׳\else ״ה\fi\else ה\fi |
| 72 |
\or \ifnum #2>0\ifnum #1=6 ו׳\else ״ו\fi\else ו\fi |
| 73 |
\or \ifnum #2>0\ifnum #1=7 ז׳\else ״ז\fi\else ז\fi |
| 74 |
\or \ifnum #2>0\ifnum #1=8 ח׳\else ״ח\fi\else ח\fi |
| 75 |
\or \ifnum #2>0\ifnum #1=9 ט׳\else ״ט\fi\else ט\fi |
| 76 |
\fi\fi\fi |
| 77 |
} |
| 78 |
|
| 79 |
\newcommand*\Alphfinal[1]{\expandafter\@Alphfinal\csname c@#1\endcsname} |
| 80 |
\newcommand*\@Alphfinal[1]{\Hebrewnumeralfinal{#1}} |
| 81 |
|
| 82 |
\endinput |