% This is an interactive script. Run it through \LaTeX % and enter appropriate responses. (This won't work with % LaTeX2HTML \documentclass[a4paper]{article} \usepackage[utf8]{inputenc} \usepackage[T1]{fontenc} \usepackage[french,english,spanish,portuges,ngerman,italian]{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)} \typeout{[7] German} \typeout{[8] Italian} \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}} {\ifthenelse{\equal{\response}{7}}{\langid=7}{% \ifthenelse{\equal{\response}{8}}{\langid=8}{% \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). \or \selectlanguage{ngerman} Current language: German. \or \selectlanguage{italian} Current language: Italian. \fi \def\startval{-1} \loop \typein[\startval]{Start value? (Integer from 0 to 99999) [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>99999\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 \newcount\numformat \numformat=-1 \loop \typeout{Which format?^^J} \typeout{[1] ordinalstring} \typeout{[2] Ordinalstring} \typeout{[3] ORDINALstring} \typeout{[4] numberstring} \typeout{[5] Numberstring} \typeout{[6] NUMBERstring} \typein[\response]{Default: 1} \ifthenelse{\equal{\response}{}}{\def\response{1}}{}%default val \ifthenelse{\equal{\response}{1}}{\numformat=1}{ \ifthenelse{\equal{\response}{2}}{\numformat=2}{ \ifthenelse{\equal{\response}{3}}{\numformat=3}{ \ifthenelse{\equal{\response}{4}}{\numformat=4}{ \ifthenelse{\equal{\response}{5}}{\numformat=5}{ \ifthenelse{\equal{\response}{6}}{\numformat=6}{\numformat=-1 \typeout{Invalid response '\response', please select a number from 1 to 4}}}}}}} \ifnum\numformat=-1 \repeat \ifcase\numformat \or\def\stringtype{ordinalstring} \or\def\stringtype{Ordinalstring} \or\def\stringtype{ORDINALstring} \or\def\stringtype{numberstring} \or\def\stringtype{Numberstring} \or\def\stringtype{NUMBERstring} \fi \ifnum\langid>3\relax \ifnum\langid<7\relax \myctr=-1\relax \loop \typeout{Ordinal type?^^J} \typeout{[1] eme} \typeout{[2] e} \typein[\response]{Default: 1} \ifthenelse{\equal{\response}{}}% {% \def\response{1}% default \myctr=1\relax }% {% \ifthenelse{\equal{\response}{1}}% {% \fmtcountsetoptions{abbrv=false}\myctr=1\relax }% {% \ifthenelse{\equal{\response}{2}}% {% \fmtcountsetoptions{abbrv}\myctr=2\relax }% {% \myctr=-1\relax }% }% }% \ifnum\myctr=-1 \repeat \fi \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 \ifthenelse{\langid=7 \and \numformat>3}{}{% \loop \ifnum\langid=7 \typein[\response]{Gender? (m, f or n) [Default: m]} \ifthenelse{\equal{\response}{m}}{\myctr=1}{ \ifthenelse{\equal{\response}{f}}{\myctr=2}{ \ifthenelse{\equal{\response}{n}}{\myctr=3}{ \ifthenelse{\equal{\response}{}}{\myctr=1}{% \myctr=-1 \typeout{Invalid response '\response'}}}}} \else \typein[\response]{Gender? (m or f) [Default: m]} \ifthenelse{\equal{\response}{m}}{\myctr=1}{ \ifthenelse{\equal{\response}{f}}{\myctr=2}{% \ifthenelse{\equal{\response}{}}{\myctr=1}{% \myctr=-1 \typeout{Invalid response '\response'}}}} \fi \ifnum\myctr=-1 \repeat } \fi \ifcase\myctr \or \def\gender{m} \or \def\gender{f} \or \def\gender{n} \fi \ifnum\langid=7 \ifnum\startval>99 \myctr=-1 \loop \typeout{einhundert/eintausend or hundert/tausend?^^J} \typeout{[1] einhundert/eintausend} \typeout{[2] hundert/tausend} \typein[\response]{Default: 1} \ifthenelse{\equal{\response}{}}{\def\response{1}}{}%default \ifthenelse{\equal{\response}{1}}{% \renewcommand{\einhundert}{einhundert} \renewcommand{\eintausend}{eintausend} \myctr=1}{% \ifthenelse{\equal{\response}{2}}{% \renewcommand{\einhundert}{hundert} \renewcommand{\eintausend}{tausend} \myctr=2}{% \myctr=-1}} \ifnum\myctr=-1 \repeat \fi \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}