blob: 3158d7c7a35abe098ff1fa23201c6d8ec47703d2 (
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
|
\ProvidesFile{babel-hebrewalph.def}
[2010/03/02 %
Babel definitions for Hebrew numerals^^J
Adapted from hebrew.ldf (2005/03/30 v2.3h)]
\newif\if@gim@apost % whether we print apostrophes (gereshayim)
\newif\if@gim@final % whether we use final or initial letters
\newrobustcmd*{\hebrewnumeral}[1] % no apostrophe, no final letters
{{\@gim@finalfalse\@gim@apostfalse\@hebrew@numeral{#1}}}
\newrobustcmd*{\Hebrewnumeral}[1] % apostrophe, no final letters
{{\@gim@finalfalse\@gim@aposttrue\@hebrew@numeral{#1}}}
\newrobustcmd*{\Hebrewnumeralfinal}[1] % apostrophe, final letters
{{\@gim@finaltrue\@gim@aposttrue\@hebrew@numeral{#1}}}
\newcommand*{\@hebrew@numeral}[1]{%
\ifnum#1<\z@\space\xpg@warning{Illegal value (#1) for Hebrew numeral}%
\else
\@tempcnta=#1\@tempcntb=#1\relax
\divide\@tempcntb by 1000
\ifnum\@tempcntb=0\gim@nomil\@tempcnta\relax
\else{\@gim@apostfalse\@gim@finalfalse\@hebrew@numeral\@tempcntb}׳%
\multiply\@tempcntb by 1000\relax
\advance\@tempcnta by -\@tempcntb\relax
\gim@nomil\@tempcnta\relax
\fi
\fi
}
\def\hebrew@alph@zero{}
\newcommand*{\gim@nomil}[1]{\@tempcnta=#1\@gim@prevfalse
\@tempcntb=\@tempcnta\divide\@tempcntb by 100\relax % hundreds digit
\ifcase\@tempcntb % print nothing if no hundreds
\or\gim@print{100}{ק}%
\or\gim@print{200}{ר}%
\or\gim@print{300}{ש}%
\or\gim@print{400}{ת}%
\or ת\@gim@prevtrue\gim@print{500}{ק}%
\or ת\@gim@prevtrue\gim@print{600}{ר}%
\or ת\@gim@prevtrue\gim@print{700}{ש}%
\or ת\@gim@prevtrue\gim@print{800}{ת}%
\or ת\@gim@prevtrue ת\gim@print{900}{ק}%
\fi
\@tempcntb=\@tempcnta\divide\@tempcntb by 10\relax % tens digit
\ifcase\@tempcntb % print nothing if no tens
\or % number between 10 and 19
\ifnum\@tempcnta = 16 \gim@print {9}{ט}% tet-zayin
\else\ifnum\@tempcnta = 15 \gim@print {9}{ט}% tet-vav
\else \gim@print{10}{י}%
\fi % \@tempcnta = 15
\fi % \@tempcnta = 16
\or\gim@print{20}{\if@gim@final ך\else כ\fi}%
\or\gim@print{30}{ל}%
\or\gim@print{40}{\if@gim@final ם\else מ\fi}%
\or\gim@print{50}{\if@gim@final ן\else נ\fi}%
\or\gim@print{60}{ס}%
\or\gim@print{70}{ע}%
\or\gim@print{80}{\if@gim@final ף\else פ\fi}%
\or\gim@print{90}{\if@gim@final ץ\else צ\fi}%
\fi
\ifcase\@tempcnta
\hebrew@alph@zero% empty but can be defined if desired
\or\gim@print{1}{א}%
\or\gim@print{2}{ב}%
\or\gim@print{3}{ג}%
\or\gim@print{4}{ד}%
\or\gim@print{5}{ה}%
\or\gim@print{6}{ו}%
\or\gim@print{7}{ז}%
\or\gim@print{8}{ח}%
\or\gim@print{9}{ט}%
\fi
}
\newif\if@gim@prev % flag if a previous letter has been typeset
\newcommand*{\gim@print}[2]{% #2 is a letter, #1 is its value.
\advance\@tempcnta by -#1\relax% deduct the value from the remainder
\ifnum\@tempcnta=0% if this is the last letter
\if@gim@prev\if@gim@apost ״\fi#2%
\else#2\if@gim@apost ׳\fi\fi%
\else{\@gim@finalfalse#2}\@gim@prevtrue\fi}
\def\Alphfinal#1{\expandafter\@Alphfinal\csname c@#1\endcsname}%
\providecommand*{\@Alphfinal}[1]{\protect\Hebrewnumeralfinal{\number#1}}
\endinput
|