blob: d01da1afad8d9b964bdf6894a28f270a46290b35 (
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
|
%%
%% This is file `zahl2string.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% zahl2string.dtx (with options: `package')
%%
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{zahl2string}
[2004/11/25 v1.2.1 format a number as german words]
\newcommand{\numstring}[1]{%
\expandafter\@numstring\csname c@#1\endcsname%
}
\newcommand{\Numstring}[1]{%
\expandafter\@Numstring\csname c@#1\endcsname%
}
\newcommand{\ordstring}[1]{%
\expandafter\@ordstring\csname c@#1\endcsname%
}
\newcommand{\Ordstring}[1]{%
\expandafter\@Ordstring\csname c@#1\endcsname%
}
\newcommand{\@numstring}[1]{%
\ns@numstr{#1}\ns@neunzehns{null}{}%
}
\newcommand\@Numstring[1]{%
\expandafter\@@Numstring\expandafter{\number#1}%
}
\DeclareRobustCommand{\@@Numstring}[1]{%
\protected@edef\@tempa{\@numstring{#1}}%
\expandafter\MakeUppercase\@tempa%
}
\newcommand{\@ordstring}[1]{%
\ns@numstr{#1}\ns@neunzehnord{null\-te}{te}%
}
\newcommand{\@Ordstring}[1]{%
\expandafter\@@Ordstring\expandafter{\number#1}%
}
\DeclareRobustCommand{\@@Ordstring}[1]{%
\protected@edef\@tempa{\@ordstring{#1}}%
\expandafter\MakeUppercase\@tempa%
}
\let\numstr\@numstring%
\let\Numstr\@Numstring%
\let\ordstr\@ordstring%
\let\Ordstr\@Ordstring%
\DeclareOption{publicnumstr}{%
\PackageWarning{zahl2string}{Option `publicnumstr' is %
deprecated and will be removed in version 1.3}%
}
\def\ns@numoutofrange#1#2{%
\number#1#2%
}
\DeclareOption{showrangeerrors}{%
\def\ns@numoutofrange#1#2{%
\PackageError{zahl2string}{The number `#1' is too large %
to be formatted using zahl2string}{The largest possible %
number is 999,999,999.}
}%
}
\ProcessOptions\relax
\def\ns@numstr#1#2#3#4{%
\ifnum\number#1<\@ne%
#3%
\else\ifnum\number#1<1000000000 %
\expandafter\ns@numstring\expandafter{\number#1}#2%
\else%
\ns@numoutofrange{#1}{#4}%
\fi\fi%
}
\def\ns@numstring#1#2{%
\expandafter\ns@@numstring%
\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\ns@@numstring#1#2#3#4#5#6#7\or#8\@nil#9{%
\ifnum#1#2#3>\z@
\ns@million#1#2#3%
\ifnum#4#5#6>\z@\space\fi%
\fi%
\ifnum#4#5#6>\z@%
\ns@hundred#4#5#6{#1#2#3}{#4#5}\ns@neunzehn%
\ifnum#4#5#6>\@ne\-\fi%
tau\-send%
\ifnum#7>\z@\-\fi%
\fi%
\ns@hundred#7{#4#5#6}1#9%
}
\def\ns@million#1#2#3{%
\ifnum#1#2#3=\@ne%
\ns@hundred#1#2#301\ns@neunzehne%
\space%
Mil\-lion%
\else%
\ns@hundred#1#2#301\ns@neunzehns%
\space%
Mil\-lio\-nen%
\fi%
}
\def\ns@hundred#1#2#3#4#5#6{%
\ifnum#1>\z@%
\ifnum#4#1>\@ne\ns@neunzehn#1\-\fi%
hun\-dert%
\ifnum#2#3>\z@\-\fi%
\fi%
\ifnum#2#3<20 %
\ifnum#5#2#3>\@ne#6{#2#3}\fi%
\else%
\ifnum#3>\z@\ns@neunzehn#3\-und\-\fi%
\ns@neunzig#2%
#60%
\fi%
}
\def\ns@neunzehn#1{%
\ifcase#1\@empty\or ein\or zwei\or drei\or vier\or f\"unf\or sechs\or%
sie\-ben\or acht\or neun\or zehn\or elf\or zw\"olf\or drei\-zehn\or%
vier\-zehn\or f\"unf\-zehn\or sech\-zehn\or sieb\-zehn\or%
acht\-zehn\or neun\-zehn\fi%
}
\def\ns@neunzehns#1{%
\ifcase#1\@empty\or eins\else\ns@neunzehn{#1}\fi%
}
\def\ns@neunzehne#1{%
\ifcase#1\@empty\or ei\-ne\else\ns@neunzehn{#1}\fi%
}
\def\ns@neunzehnord#1{%
\ifcase#1\-ste\or er\-ste\or zwei\-te\or drit\-te\or vier\-te\or%
f\"unf\-te\or sech\-ste\or sieb\-te\or ach\-te\or neun\-te\or%
zehn\-te\or elf\-te\or zw\"olf\-te\or drei\-zehn\-te\or%
vier\-zehn\-te\or f\"unf\-zehn\-te\or sech\-zehn\-te\or%
sieb\-zehn\-te\or acht\-zehn\-te\or neun\-zehn\-te\fi%
}
\def\ns@neunzig#1{%
\ifcase#1\or\or zwan\-zig\or drei\ss ig\or vier\-zig\or%
f\"unf\-zig\or sech\-zig\or sieb\-zig\or acht\-zig\or%
neun\-zig\fi%
}
\endinput
%%
%% End of file `zahl2string.sty'.
|