summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/latex/fmtcount/fc-lang.tex
blob: 89ead352612cf646d12fa7578acf031011eba72c (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
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
%%
%% This is file `fc-lang.tex',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% fmtcount.dtx  (with options: `fc-lang.tex,package')
%% Copyright (C) 2006 Nicola Talbot, all rights reserved.
%% If you modify this file, you must change its name first.
%% You are NOT ALLOWED to distribute this file alone. You are NOT
%% ALLOWED to take money for the distribution or use of either this
%% file or a changed version, except for a nominal charge for copying
%% etc.
%% \CharacterTable
%%  {Upper-case    \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
%%   Lower-case    \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
%%   Digits        \0\1\2\3\4\5\6\7\8\9
%%   Exclamation   \!     Double quote  \"     Hash (number) \#
%%   Dollar        \$     Percent       \%     Ampersand     \&
%%   Acute accent  \'     Left paren    \(     Right paren   \)
%%   Asterisk      \*     Plus          \+     Comma         \,
%%   Minus         \-     Point         \.     Solidus       \/
%%   Colon         \:     Semicolon     \;     Less than     \<
%%   Equals        \=     Greater than  \>     Question mark \?
%%   Commercial at \@     Left bracket  \[     Backslash     \\
%%   Right bracket \]     Circumflex    \^     Underscore    \_
%%   Grave accent  \`     Left brace    \{     Vertical bar  \|
%%   Right brace   \}     Tilde         \~}
 % This is an interactive script. Run it through \LaTeX
 % and enter appropriate responses.

\documentclass[a4paper]{article}

\usepackage[french,english,spanish,portuges]{babel}
\usepackage{fmtcount}

\newcounter{startval}
\newcounter{endval}
\newcounter{stepsize}
\newcounter{N}
\newcount\myctr
\newcount\langid

\begin{document}

\section{Displaying the value of a counter}

\typeout{This is an interactive script, testing the fmtcount package.}

\langid=-1

\loop
\typeout{Which language?^^J}
\typeout{[1] English}
\typeout{[2] Portuguese}
\typeout{[3] Spanish}
\typeout{[4] French}
\typeout{[5] French (Swiss)}
\typeout{[6] French (Belgium)}

\typein[\response]{}

\ifthenelse{\equal{\response}{1}}{\langid=1}{
\ifthenelse{\equal{\response}{2}}{\langid=2}{
\ifthenelse{\equal{\response}{3}}{\langid=3}{
\ifthenelse{\equal{\response}{4}}{\langid=4\fmtcountsetoptions{french}}{
\ifthenelse{\equal{\response}{5}}{\langid=5\fmtcountsetoptions{french=swiss}}{
\ifthenelse{\equal{\response}{6}}{\langid=6\fmtcountsetoptions{french=belgian}}
{\langid=-1
\typeout{Invalid response '\response', please select a number from 1 to 6}}}}}}}
\ifnum\langid=-1
\repeat

\ifcase\langid
\or \selectlanguage{english}
Current language: English.
\or \selectlanguage{portuges}
Current language: Portuguese.
\or \selectlanguage{spanish}
Current language: Spanish.
\or \selectlanguage{french}
Current language: French.
\or \selectlanguage{french}
Current language: French (Swiss).
\or \selectlanguage{french}
Current language: French (Belgium).
\fi

\def\startval{-1}

\loop
\typein[\startval]{Start value? (Integer from 0 to 99000)
[Default 1]}
\ifthenelse{\equal{\startval}{}}{\def\startval{1}}{}
\ifnum\startval<0\def\startval{-1}\fi
\ifnum\startval>99999\def\startval{-1}\fi
\ifnum\startval=-1
\repeat

\def\endval{-1}

\loop
\typein[\endval]{End value? (Integer from 0 to 99999)
[Default 1000]}
\ifthenelse{\equal{\endval}{}}{\def\endval{1000}}{}
\ifnum\endval<0\def\endval{-1}\fi
\ifnum\endval>99000\def\endval{-1}\fi
\ifnum\endval=-1
\repeat

\def\stepsize{0}

\loop
\typein[\stepsize]{Step size? (Non zero integer)
[Default 1]}
\ifthenelse{\equal{\stepsize}{}}{\def\stepsize{1}}{}
\ifnum\stepsize=0
\repeat

\typeout{From {\startval} to {\endval} step {\stepsize}}

\ifnum\startval<\endval
\ifnum\stepsize<0
\PackageError{fc-lang}{Infinite loop not permitted!}{}
\def\endval{\startval}
\fi
\fi

\ifnum\startval>\endval
\ifnum\stepsize>0
\PackageError{fc-lang}{Infinite loop not permitted!}{}
\def\endval{\startval}
\fi
\fi

\myctr=-1
\loop
\typeout{Which format?^^J}
\typeout{[1] ordinalstring}
\typeout{[2] Ordinalstring}
\typeout{[3] numberstring}
\typeout{[4] Numberstring}

\typein[\response]{Default: 1}

\ifthenelse{\equal{\response}{}}{\def\response{1}}{}%default val
\ifthenelse{\equal{\response}{1}}{\myctr=1}{
\ifthenelse{\equal{\response}{2}}{\myctr=2}{
\ifthenelse{\equal{\response}{3}}{\myctr=3}{
\ifthenelse{\equal{\response}{4}}{\myctr=4}{\myctr=-1
\typeout{Invalid response '\response', please select a number from 1 to 4}}}}}
\ifnum\myctr=-1
\repeat

\ifcase\myctr
\or\def\stringtype{ordinalstring}
\or\def\stringtype{Ordinalstring}
\or\def\stringtype{numberstring}
\or\def\stringtype{Numberstring}
\fi

\ifnum\langid>3
\myctr=-1
\loop
\typeout{Ordinal type?^^J}
\typeout{[1] eme}
\typeout{[2] e}
\typein[\response]{Default: 1}
\ifthenelse{\equal{\response}{}}{\def\response{1}}{}%default
\ifthenelse{\equal{\response}{1}}{%
\fmtcountsetoptions{abbrv=false}\myctr=1}{%
\ifthenelse{\equal{\response}{2}}{%
\fmtcountsetoptions{abbrv}\myctr=2}{%
\myctr=-1}}
\ifnum\myctr=-1
\repeat
\fi

\myctr=-1
\loop
\typeout{Ordinal format?^^J}
\typeout{[1] raised}
\typeout{[2] level}
\typein[\response]{Default: 1}
\ifthenelse{\equal{\response}{1}\or\equal{\response}{}}{%
\fmtcountsetoptions{fmtord=raise}\myctr=1}{%
\ifthenelse{\equal{\response}{2}}{%
\fmtcountsetoptions{fmtord=level}\myctr=2}{%
\myctr=-1}}
\ifnum\myctr=-1
\repeat

\ifnum\langid=1
\myctr=1
\else
\loop
\typein[\response]{Gender? (m or f) [Default: m]}
\ifthenelse{\equal{\response}{m}\or\equal{\response}{}}{\myctr=1}{
\ifthenelse{\equal{\response}{f}}{\myctr=2}{\myctr=-1
\typeout{Invalid response '\response'}}}
\ifnum\myctr=-1
\repeat
\fi

\ifcase\myctr
\or \def\gender{m}
\or \def\gender{f}
\fi

\setcounter{startval}{\startval}
\setcounter{endval}{\endval}
\setcounter{stepsize}{\stepsize}

\stepcounter{endval}
\begin{ttfamily}
\noindent
\makebox[0.25in][c]{N}
\makebox[0.5in][c]{ordinal}\quad
\stringtype
\par
\myctr=\value{startval}
\loop
\noindent
\setcounter{N}{\myctr}
\makebox[0.25in][r]{\arabic{N}}
\makebox[0.5in][r]{\ordinal{N}[\gender]}\quad
\csname\stringtype\endcsname{N}[\gender].
\par
\advance\myctr by \value{stepsize}\relax
\ifnum\myctr<\value{endval}
\repeat

\end{ttfamily}

\end{document}
\endinput
%%
%% End of file `fc-lang.tex'.