diff options
author | Karl Berry <karl@freefriends.org> | 2009-10-03 18:49:59 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2009-10-03 18:49:59 +0000 |
commit | b5d732b5920ac3f1cf3a2d53344c03d540559b4a (patch) | |
tree | 613f30a0dac4e461b24915c6f9c56dce749298b6 /Master/texmf-dist/source/latex/fmtcount/fmtcount.dtx | |
parent | 9fb4054c488dbb42bf7d597e7a72bc916136b5af (diff) |
interim fmtcount update
git-svn-id: svn://tug.org/texlive/trunk@15620 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/fmtcount/fmtcount.dtx')
-rw-r--r-- | Master/texmf-dist/source/latex/fmtcount/fmtcount.dtx | 3588 |
1 files changed, 2382 insertions, 1206 deletions
diff --git a/Master/texmf-dist/source/latex/fmtcount/fmtcount.dtx b/Master/texmf-dist/source/latex/fmtcount/fmtcount.dtx index 2bb59106fea..0fbf2f94beb 100644 --- a/Master/texmf-dist/source/latex/fmtcount/fmtcount.dtx +++ b/Master/texmf-dist/source/latex/fmtcount/fmtcount.dtx @@ -1,17 +1,19 @@ %\iffalse % fmtcount.dtx generated using makedtx version 0.94b (c) Nicola Talbot % Command line args: +% -macrocode ".*\.tex" % -macrocode "fmtcount.perl" % -setambles "fmtcount.perl=>\nopreamble\nopostamble" % -comment "fmtcount.perl" -% -src "(.+)\.(def)=>\1.\2" % -src "(.+)\.(sty)=>\1.\2" +% -src "(.+)\.(def)=>\1.\2" % -src "(fmtcount\.perl)=>\1" -% -doc "manual.tex" +% -src "(fc-.+\.tex\Z)=>\1" +% -doc "fmtcount-manual.tex" % -author "Nicola Talbot" % -dir "source" % fmtcount -% Created on 2007/8/20 12:28 +% Created on 2009/10/2 18:35 %\fi %\iffalse %<*package> @@ -34,7 +36,7 @@ %\fi % \iffalse % Doc-Source file to use with LaTeX2e -% Copyright (C) 2007 Nicola Talbot, all rights reserved. +% Copyright (C) 2009 Nicola Talbot, all rights reserved. % \fi % \iffalse %<*driver> @@ -66,19 +68,20 @@ \fcolorbox{black}{defbackground}{\usebox\defsbox}% \vskip10pt } -\OnlyDescription \newcommand{\sty}[1]{\textsf{#1}}\newcommand{\cls}[1]{\textsf{#1}} +\CheckSum{9371} +\OnlyDescription + \begin{document} \DocInput{fmtcount.dtx} \end{document} %</driver> %\fi %\RecordChanges -%\CheckSum{7745} % -% \title{fmtcount.sty v1.3: Displaying the Values of +% \title{fmtcount.sty v1.31: Displaying the Values of %\LaTeX\ Counters} % \author{Nicola L.C. Talbot\\[10pt] % School of Computing Sciences\\ @@ -86,7 +89,7 @@ % Norwich. NR4 7TJ.\\ % United Kingdom.\\ % \url{http://theoval.cmp.uea.ac.uk/~nlct/}} -% \date{20 Aug 2007} +% \date{2nd October 2009} % \maketitle % \tableofcontents % \section{Introduction} @@ -95,7 +98,8 @@ %provides equivalent commands for actual numbers rather than %counter names. Limited multilingual support is available. %Currently, there is only support for English, French (including -%Belgian and Swiss variations), Spanish, Portuguese and German. +%Belgian and Swiss variations), Spanish, Portuguese, German and +%Italian. % %\section{Installation} % @@ -489,8 +493,8 @@ %The following options can be passed to this package: % %\begin{tabular}{ll} -% raise & make ordinal st,nd,rd,th appear as superscript\\ -% level & make ordinal st,nd,rd,th appear level with rest of +% \texttt{raise} & make ordinal st,nd,rd,th appear as superscript\\ +% \texttt{level} & make ordinal st,nd,rd,th appear level with rest of %text %\end{tabular} % @@ -509,7 +513,9 @@ %limited multilingual support. The following languages are %implemented: English, Spanish, Portuguese, French, French (Swiss) %and French (Belgian). German support was added in version -%1.1\footnote{Thanks to K. H. Fricke for supplying the information}. +%1.1.\footnote{Thanks to K. H. Fricke for supplying the information.} +%Italian support was added in version 1.31.\footnote{Thanks to +%Edoardo Pasca for supplying the information.} % %The package checks to see if the command \cs{l@}\meta{language} is %defined\footnote{this will be true if you have loaded \sty{babel}}, @@ -594,7 +600,8 @@ %I would like to thank my mother for the French and Portuguese %support and my Spanish dictionary for the Spanish support. %Thank you to K. H. Fricke for providing me with the German -%translations. +%translations and to Edoardo Pasca for providing me with the +%Italian translations. % %\section{Troubleshooting} % @@ -607,10 +614,1220 @@ %\section{The Code} %\iffalse % \begin{macrocode} +%<*fmtcount.sty> +% \end{macrocode} +%\fi +%\subsection{fmtcount.sty} +% This section deals with the code for |fmtcount.sty| +% \begin{macrocode} +\NeedsTeXFormat{LaTeX2e} +\ProvidesPackage{fmtcount}[2009/10/02 v1.31] +\RequirePackage{ifthen} +\RequirePackage{keyval} +% \end{macrocode} +% \changes{1.3}{2007/7/19}{no +%longer using xspace package} +%\changes{1.31}{2009/10/02}{amsgen now loaded (\cs{new@ifnextchar} +% needed)} +% Need to use \cs{new@ifnextchar} instead of \cs{@ifnextchar} in +% commands that have a final optional argument (such as \cs{gls}) +% so require \sty{amsgen}. +% \begin{macrocode} +\RequirePackage{amsgen} +% \end{macrocode} +% These commands need to be defined before the +% configuration file is loaded. +% +% Define the macro to format the |st|, |nd|, |rd| or |th| of an +% ordinal. +%\begin{macro}{\fmtord} +% \begin{macrocode} +\providecommand*{\fmtord}[1]{\textsuperscript{#1}} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\padzeroes} +%\begin{definition} +%\cs{padzeroes}\oarg{n} +%\end{definition} +% Specifies how many digits should be displayed for commands such as +% \cs{decimal} and \cs{binary}. +% \begin{macrocode} +\newcount\c@padzeroesN +\c@padzeroesN=1\relax +\providecommand*{\padzeroes}[1][17]{\c@padzeroesN=#1} +% \end{macrocode} +%\end{macro} +% Load appropriate language definition files: +%\changes{v1.1}{14 June 2007}{added check for UKenglish, +% british and USenglish babel settings} +% \begin{macrocode} +\@ifundefined{l@english}{}{\input{fc-english.def}} +\@ifundefined{l@UKenglish}{}{\input{fc-UKenglish.def}} +\@ifundefined{l@british}{}{\input{fc-british.def}} +\@ifundefined{l@USenglish}{}{\input{fc-USenglish.def}} +\@ifundefined{l@spanish}{}{\input{fc-spanish.def}} +\@ifundefined{l@portuges}{}{\input{fc-portuges.def}} +\@ifundefined{l@french}{}{\input{fc-french.def}} +\@ifundefined{l@german}{% +\@ifundefined{l@ngerman}{}{\input{fc-german.def}}}{% +\input{fc-german.def}} +\@ifundefined{l@italian}{}{\input{fc-italian.def}} +% \end{macrocode} +%\begin{macro}{\fmtcount@french} +% Define keys for use with |\fmtcountsetoptions|. +% Key to switch French dialects (Does babel store +%this kind of information?) +% \begin{macrocode} +\def\fmtcount@french{france} +\define@key{fmtcount}{french}[france]{% +\@ifundefined{datefrench}{% +\PackageError{fmtcount}{Language `french' not defined}{You need +to load babel before loading fmtcount}}{ +\ifthenelse{\equal{#1}{france} + \or\equal{#1}{swiss} + \or\equal{#1}{belgian}}{% + \def\fmtcount@french{#1}}{% +\PackageError{fmtcount}{Invalid value `#1' to french key} +{Option `french' can only take the values `france', +`belgian' or `swiss'}} +}} +% \end{macrocode} +%\end{macro} +% Key to determine how to display the ordinal +% \begin{macrocode} +\define@key{fmtcount}{fmtord}{% +\ifthenelse{\equal{#1}{level} + \or\equal{#1}{raise} + \or\equal{#1}{user}}{ + \def\fmtcount@fmtord{#1}}{% +\PackageError{fmtcount}{Invalid value `#1' to fmtord key} +{Option `fmtord' can only take the values `level', `raise' +or `user'}}} +% \end{macrocode} +%\begin{macro}{\iffmtord@abbrv} +% Key to determine whether the ordinal should be abbreviated +% (language dependent, currently only affects French ordinals.) +% \begin{macrocode} +\newif\iffmtord@abbrv +\fmtord@abbrvfalse +\define@key{fmtcount}{abbrv}[true]{% +\ifthenelse{\equal{#1}{true}\or\equal{#1}{false}}{ + \csname fmtord@abbrv#1\endcsname}{% +\PackageError{fmtcount}{Invalid value `#1' to fmtord key} +{Option `fmtord' can only take the values `true' or +`false'}}} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\fmtcountsetoptions} +% Define command to set options. +% \begin{macrocode} +\newcommand*{\fmtcountsetoptions}[1]{% +\def\fmtcount@fmtord{}% +\setkeys{fmtcount}{#1}% +\@ifundefined{datefrench}{}{% +\edef\@ordinalstringMfrench{\noexpand +\csname @ordinalstringMfrench\fmtcount@french\noexpand\endcsname}% +\edef\@ordinalstringFfrench{\noexpand +\csname @ordinalstringFfrench\fmtcount@french\noexpand\endcsname}% +\edef\@OrdinalstringMfrench{\noexpand +\csname @OrdinalstringMfrench\fmtcount@french\noexpand\endcsname}% +\edef\@OrdinalstringFfrench{\noexpand +\csname @OrdinalstringFfrench\fmtcount@french\noexpand\endcsname}% +\edef\@numberstringMfrench{\noexpand +\csname @numberstringMfrench\fmtcount@french\noexpand\endcsname}% +\edef\@numberstringFfrench{\noexpand +\csname @numberstringFfrench\fmtcount@french\noexpand\endcsname}% +\edef\@NumberstringMfrench{\noexpand +\csname @NumberstringMfrench\fmtcount@french\noexpand\endcsname}% +\edef\@NumberstringFfrench{\noexpand +\csname @NumberstringFfrench\fmtcount@french\noexpand\endcsname}% +}% +% +\ifthenelse{\equal{\fmtcount@fmtord}{level}}{% +\renewcommand{\fmtord}[1]{##1}}{% +\ifthenelse{\equal{\fmtcount@fmtord}{raise}}{% +\renewcommand{\fmtord}[1]{\textsuperscript{##1}}}{% +}} +} +% \end{macrocode} +%\end{macro} +% Load confguration file if it exists. This needs to be done +% before the package options, to allow the user to override +% the settings in the configuration file. +% \begin{macrocode} +\InputIfFileExists{fmtcount.cfg}{% +\typeout{Using configuration file fmtcount.cfg}}{% +\typeout{No configuration file fmtcount.cfg found.}} +% \end{macrocode} +%Declare options +% \begin{macrocode} +\DeclareOption{level}{\def\fmtcount@fmtord{level}% +\def\fmtord#1{#1}} +\DeclareOption{raise}{\def\fmtcount@fmtord{raise}% +\def\fmtord#1{\textsuperscript{#1}}} +% \end{macrocode} +% Process package options +% \begin{macrocode} +\ProcessOptions +% \end{macrocode} +%\begin{macro}{\@modulo} +%\begin{definition} +%\cs{@modulo}\marg{count reg}\marg{n} +%\end{definition} +% Sets the count register to be its value modulo \meta{n}. +% This is used for the +% date, time, ordinal and numberstring commands. (The fmtcount +% package was originally part of the datetime package.) +% \begin{macrocode} +\newcount\@DT@modctr +\def\@modulo#1#2{% +\@DT@modctr=#1\relax +\divide \@DT@modctr by #2\relax +\multiply \@DT@modctr by #2\relax +\advance #1 by -\@DT@modctr} +% \end{macrocode} +%\end{macro} +% The following registers are needed by |\@ordinal| etc +% \begin{macrocode} +\newcount\@ordinalctr +\newcount\@orgargctr +\newcount\@strctr +\newcount\@tmpstrctr +% \end{macrocode} +%Define commands that display numbers in different bases. +% Define counters and conditionals needed. +% \begin{macrocode} +\newif\if@DT@padzeroes +\newcount\@DT@loopN +\newcount\@DT@X +% \end{macrocode} +%\begin{macro}{\binarynum} +% Converts a decimal number to binary, and display. +% \begin{macrocode} +\newcommand*{\@binary}[1]{% +\@DT@padzeroestrue +\@DT@loopN=17\relax +\@strctr=\@DT@loopN +\whiledo{\@strctr<\c@padzeroesN}{0\advance\@strctr by 1}% +\@strctr=65536\relax +\@DT@X=#1\relax +\loop +\@DT@modctr=\@DT@X +\divide\@DT@modctr by \@strctr +\ifthenelse{\boolean{@DT@padzeroes} \and \(\@DT@modctr=0\) \and \(\@DT@loopN>\c@padzeroesN\)}{}{\the\@DT@modctr}% +\ifnum\@DT@modctr=0\else\@DT@padzeroesfalse\fi +\multiply\@DT@modctr by \@strctr +\advance\@DT@X by -\@DT@modctr +\divide\@strctr by 2\relax +\advance\@DT@loopN by -1\relax +\ifnum\@strctr>1 +\repeat +\the\@DT@X} + +\let\binarynum=\@binary +% \end{macrocode} +%\end{macro} +%\begin{macro}{\octalnum} +% Converts a decimal number to octal, and displays. +% \begin{macrocode} +\newcommand*{\@octal}[1]{% +\ifnum#1>32768 +\PackageError{fmtcount}{Value of counter too large for \protect\@octal}{Maximum value 32768} +\else +\@DT@padzeroestrue +\@DT@loopN=6\relax +\@strctr=\@DT@loopN +\whiledo{\@strctr<\c@padzeroesN}{0\advance\@strctr by 1}% +\@strctr=32768\relax +\@DT@X=#1\relax +\loop +\@DT@modctr=\@DT@X +\divide\@DT@modctr by \@strctr +\ifthenelse{\boolean{@DT@padzeroes} \and \(\@DT@modctr=0\) \and \(\@DT@loopN>\c@padzeroesN\)}{}{\the\@DT@modctr}% +\ifnum\@DT@modctr=0\else\@DT@padzeroesfalse\fi +\multiply\@DT@modctr by \@strctr +\advance\@DT@X by -\@DT@modctr +\divide\@strctr by 8\relax +\advance\@DT@loopN by -1\relax +\ifnum\@strctr>1 +\repeat +\the\@DT@X +\fi} +\let\octalnum=\@octal +% \end{macrocode} +%\end{macro} +%\begin{macro}{\hexadecimalnum} +% Converts a decimal number to a lowercase hexadecimal number, +% and displays it. +% \begin{macrocode} +\newcommand*{\@@hexadecimal}[1]{\ifcase#10\or1\or2\or3\or4\or5\or +6\or7\or8\or9\or a\or b\or c\or d\or e\or f\fi} + +\newcommand*{\@hexadecimal}[1]{% +\@DT@padzeroestrue +\@DT@loopN=5\relax +\@strctr=\@DT@loopN +\whiledo{\@strctr<\c@padzeroesN}{0\advance\@strctr by 1}% +\@strctr=65536\relax +\@DT@X=#1\relax +\loop +\@DT@modctr=\@DT@X +\divide\@DT@modctr by \@strctr +\ifthenelse{\boolean{@DT@padzeroes}\and\(\@DT@modctr=0\)\and +\(\@DT@loopN>\c@padzeroesN\)}{}{\@@hexadecimal\@DT@modctr}% +\ifnum\@DT@modctr=0\else\@DT@padzeroesfalse\fi +\multiply\@DT@modctr by \@strctr +\advance\@DT@X by -\@DT@modctr +\divide\@strctr by 16\relax +\advance\@DT@loopN by -1\relax +\ifnum\@strctr>1 +\repeat +\@@hexadecimal\@DT@X} + +\let\hexadecimalnum=\@hexadecimal +% \end{macrocode} +%\end{macro} +%\begin{macro}{\Hexadecimalnum} +% Uppercase hexadecimal +% \begin{macrocode} +\newcommand*{\@@Hexadecimal}[1]{\ifcase#10\or1\or2\or3\or4\or5\or6\or +7\or8\or9\or A\or B\or C\or D\or E\or F\fi} + +\newcommand*{\@Hexadecimal}[1]{% +\@DT@padzeroestrue +\@DT@loopN=5\relax +\@strctr=\@DT@loopN +\whiledo{\@strctr<\c@padzeroesN}{0\advance\@strctr by 1}% +\@strctr=65536\relax +\@DT@X=#1\relax +\loop +\@DT@modctr=\@DT@X +\divide\@DT@modctr by \@strctr +\ifthenelse{\boolean{@DT@padzeroes} \and \(\@DT@modctr=0\) \and \(\@DT@loopN>\c@padzeroesN\)}{}{\@@Hexadecimal\@DT@modctr}% +\ifnum\@DT@modctr=0\else\@DT@padzeroesfalse\fi +\multiply\@DT@modctr by \@strctr +\advance\@DT@X by -\@DT@modctr +\divide\@strctr by 16\relax +\advance\@DT@loopN by -1\relax +\ifnum\@strctr>1 +\repeat +\@@Hexadecimal\@DT@X} + +\let\Hexadecimalnum=\@Hexadecimal +% \end{macrocode} +%\end{macro} +%\begin{macro}{\aaalphnum} +% Lowercase alphabetical representation (a \ldots\ z aa \ldots\ zz) +% \begin{macrocode} +\newcommand*{\@aaalph}[1]{% +\@DT@loopN=#1\relax +\advance\@DT@loopN by -1\relax +\divide\@DT@loopN by 26\relax +\@DT@modctr=\@DT@loopN +\multiply\@DT@modctr by 26\relax +\@DT@X=#1\relax +\advance\@DT@X by -1\relax +\advance\@DT@X by -\@DT@modctr +\advance\@DT@loopN by 1\relax +\advance\@DT@X by 1\relax +\loop +\@alph\@DT@X +\advance\@DT@loopN by -1\relax +\ifnum\@DT@loopN>0 +\repeat +} + +\let\aaalphnum=\@aaalph +% \end{macrocode} +%\end{macro} +%\begin{macro}{\AAAlphnum} +% Uppercase alphabetical representation (a \ldots\ z aa \ldots\ zz) +% \begin{macrocode} +\newcommand*{\@AAAlph}[1]{% +\@DT@loopN=#1\relax +\advance\@DT@loopN by -1\relax +\divide\@DT@loopN by 26\relax +\@DT@modctr=\@DT@loopN +\multiply\@DT@modctr by 26\relax +\@DT@X=#1\relax +\advance\@DT@X by -1\relax +\advance\@DT@X by -\@DT@modctr +\advance\@DT@loopN by 1\relax +\advance\@DT@X by 1\relax +\loop +\@Alph\@DT@X +\advance\@DT@loopN by -1\relax +\ifnum\@DT@loopN>0 +\repeat +} + +\let\AAAlphnum=\@AAAlph +% \end{macrocode} +%\end{macro} +%\begin{macro}{\abalphnum} +% Lowercase alphabetical representation +% \begin{macrocode} +\newcommand*{\@abalph}[1]{% +\ifnum#1>17576\relax +\PackageError{fmtcount}{Value of counter too large for +\protect\@abalph}{Maximum value 17576}% +\else +\@DT@padzeroestrue +\@strctr=17576\relax +\@DT@X=#1\relax +\advance\@DT@X by -1\relax +\loop +\@DT@modctr=\@DT@X +\divide\@DT@modctr by \@strctr +\ifthenelse{\boolean{@DT@padzeroes}\and +\(\@DT@modctr=1\)}{}{\@alph\@DT@modctr}% +\ifnum\@DT@modctr=1\else\@DT@padzeroesfalse\fi +\multiply\@DT@modctr by \@strctr +\advance\@DT@X by -\@DT@modctr +\divide\@strctr by 26\relax +\ifnum\@strctr>1 +\repeat +\advance\@DT@X by 1\relax +\@alph\@DT@X +\fi} + +\let\abalphnum=\@abalph +% \end{macrocode} +%\end{macro} +%\begin{macro}{\ABAlphnum} +% Uppercase alphabetical representation +% \begin{macrocode} +\newcommand*{\@ABAlph}[1]{% +\ifnum#1>17576\relax +\PackageError{fmtcount}{Value of counter too large for +\protect\@ABAlph}{Maximum value 17576}% +\else +\@DT@padzeroestrue +\@strctr=17576\relax +\@DT@X=#1\relax +\advance\@DT@X by -1\relax +\loop +\@DT@modctr=\@DT@X +\divide\@DT@modctr by \@strctr +\ifthenelse{\boolean{@DT@padzeroes}\and +\(\@DT@modctr=1\)}{}{\@Alph\@DT@modctr}% +\ifnum\@DT@modctr=1\else\@DT@padzeroesfalse\fi +\multiply\@DT@modctr by \@strctr +\advance\@DT@X by -\@DT@modctr +\divide\@strctr by 26\relax +\ifnum\@strctr>1 +\repeat +\advance\@DT@X by 1\relax +\@Alph\@DT@X +\fi} + +\let\ABAlphnum=\@ABAlph +% \end{macrocode} +%\end{macro} +%\begin{macro}{\@fmtc@count} +% Recursive command to count number of characters in argument. +% |\@strctr| should be set to zero before calling it. +% \begin{macrocode} +\def\@fmtc@count#1#2\relax{% +\if\relax#1 +\else +\advance\@strctr by 1\relax +\@fmtc@count#2\relax +\fi} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\@decimal} +%\changes{1.31}{2009/10/02}{fixed unwanted space.} +% Format number as a decimal, possibly padded with zeroes in front. +% \begin{macrocode} +\newcommand{\@decimal}[1]{% +\@strctr=0\relax +\expandafter\@fmtc@count\number#1\relax +\@DT@loopN=\c@padzeroesN +\advance\@DT@loopN by -\@strctr +\ifnum\@DT@loopN>0\relax +\@strctr=0\relax +\whiledo{\@strctr < \@DT@loopN}{0\advance\@strctr by 1\relax}% +\fi +\number#1\relax +} + +\let\decimalnum=\@decimal +% \end{macrocode} +%\end{macro} +%\begin{macro}{\FCordinal} +%\begin{definition} +%\cs{FCordinal}\marg{number} +%\end{definition} +% This is a bit cumbersome. Previously \cs{@ordinal} +% was defined in a similar way to \cs{abalph} etc. +% This ensured that the actual value of the counter was +% written in the new label stuff in the .aux file. However +% adding in an optional argument to determine the gender +% for multilingual compatibility messed things up somewhat. +% This was the only work around I could get to keep the +% the cross-referencing stuff working, which is why +% the optional argument comes \emph{after} the compulsory +% argument, instead of the usual manner of placing it before. +% Note however, that putting the optional argument means that +% any spaces will be ignored after the command if the optional +% argument is omitted. +% Version 1.04 changed \cs{ordinal} to \cs{FCordinal} +% to prevent it clashing with the memoir class. +% \begin{macrocode} +\newcommand{\FCordinal}[1]{% +\expandafter\protect\expandafter\ordinalnum{% +\expandafter\the\csname c@#1\endcsname}} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\ordinal} +% If \cs{ordinal} isn't defined make \cs{ordinal} a synonym +% for \cs{FCordinal} to maintain compatibility with previous +% versions. +% \begin{macrocode} +\@ifundefined{ordinal}{\let\ordinal\FCordinal}{% +\PackageWarning{fmtcount}{\string\ordinal +\space already defined use \string\FCordinal \space instead.}} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\ordinalnum} +% Display ordinal where value is given as a number or +% count register instead of a counter: +%\changes{1.31}{2009/10/02}{replaced \cs{@ifnextchar} with +%\cs{new@ifnextchar}} +% \begin{macrocode} +\newcommand*{\ordinalnum}[1]{\new@ifnextchar[{\@ordinalnum{#1}}{% +\@ordinalnum{#1}[m]}} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\@ordinalnum} +% Display ordinal according to gender (neuter added in v1.1, +% \cs{xspace} added in v1.2, and removed in v1.3\footnote{I +%couldn't get it to work consistently both with and without the +%optional argument}): +% \begin{macrocode} +\def\@ordinalnum#1[#2]{{% +\ifthenelse{\equal{#2}{f}}{% + \protect\@ordinalF{#1}{\@fc@ordstr}% + }{% + \ifthenelse{\equal{#2}{n}}{% + \protect\@ordinalN{#1}{\@fc@ordstr}% + }{% + \ifthenelse{\equal{#2}{m}}{}{% + \PackageError{fmtcount}{Invalid gender option `#2'}{% + Available options are m, f or n}% + }% + \protect\@ordinalM{#1}{\@fc@ordstr}% + }% + }% +\@fc@ordstr +}} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\storeordinal} +% Store the ordinal (first argument +% is identifying name, second argument is a counter.) +% \begin{macrocode} +\newcommand*{\storeordinal}[2]{% +\expandafter\protect\expandafter\storeordinalnum{#1}{% +\expandafter\the\csname c@#2\endcsname}} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\storeordinalnum} +% Store ordinal (first argument +% is identifying name, second argument is a number or +% count register.) +% \begin{macrocode} +\newcommand*{\storeordinalnum}[2]{% +\@ifnextchar[{\@storeordinalnum{#1}{#2}}{% +\@storeordinalnum{#1}{#2}[m]}} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\@storeordinalnum} +% Store ordinal according to gender: +% \begin{macrocode} +\def\@storeordinalnum#1#2[#3]{% +\ifthenelse{\equal{#3}{f}}{% +\protect\@ordinalF{#2}{\@fc@ord}}{% +\ifthenelse{\equal{#3}{n}}{% +\protect\@ordinalN{#2}{\@fc@ord}}{% +\ifthenelse{\equal{#3}{m}}{}{% +\PackageError{fmtcount}{Invalid gender option `#3'}{% +Available options are m or f}}% +\protect\@ordinalM{#2}{\@fc@ord}}}% +\expandafter\let\csname @fcs@#1\endcsname\@fc@ord} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\FMCuse} +% Get stored information: +% \begin{macrocode} +\newcommand*{\FMCuse}[1]{\csname @fcs@#1\endcsname} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\ordinalstring} +% Display ordinal as a string (argument is a counter) +% \begin{macrocode} +\newcommand*{\ordinalstring}[1]{% +\expandafter\protect\expandafter\ordinalstringnum{% +\expandafter\the\csname c@#1\endcsname}} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\ordinalstringnum} +% Display ordinal as a string (argument is a count register or +% number.) +%\changes{1.31}{2009/10/02}{replaced \cs{@ifnextchar} with +%\cs{new@ifnextchar}} +% \begin{macrocode} +\newcommand{\ordinalstringnum}[1]{% +\new@ifnextchar[{\@ordinal@string{#1}}{\@ordinal@string{#1}[m]}} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\@ordinal@string} +% Display ordinal as a string according to gender. +% \begin{macrocode} +\def\@ordinal@string#1[#2]{{% +\ifthenelse{\equal{#2}{f}}{% +\protect\@ordinalstringF{#1}{\@fc@ordstr}}{% +\ifthenelse{\equal{#2}{n}}{% +\protect\@ordinalstringN{#1}{\@fc@ordstr}}{% +\ifthenelse{\equal{#2}{m}}{}{% +\PackageError{fmtcount}{Invalid gender option `#2' to +\string\ordinalstring}{Available options are m, f or f}}% +\protect\@ordinalstringM{#1}{\@fc@ordstr}}}\@fc@ordstr}} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\storeordinalstring} +% Store textual representation of number. First argument is +% identifying name, second argument is the counter set to the +% required number. +% \begin{macrocode} +\newcommand*{\storeordinalstring}[2]{% +\expandafter\protect\expandafter\storeordinalstringnum{#1}{% +\expandafter\the\csname c@#2\endcsname}} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\storeordinalstringnum} +% Store textual representation of number. First argument is +% identifying name, second argument is a count register or number. +% \begin{macrocode} +\newcommand*{\storeordinalstringnum}[2]{% +\@ifnextchar[{\@store@ordinal@string{#1}{#2}}{% +\@store@ordinal@string{#1}{#2}[m]}} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\@store@ordinal@string} +% Store textual representation of number according to gender. +% \begin{macrocode} +\def\@store@ordinal@string#1#2[#3]{% +\ifthenelse{\equal{#3}{f}}{% +\protect\@ordinalstringF{#2}{\@fc@ordstr}}{% +\ifthenelse{\equal{#3}{n}}{% +\protect\@ordinalstringN{#2}{\@fc@ordstr}}{% +\ifthenelse{\equal{#3}{m}}{}{% +\PackageError{fmtcount}{Invalid gender option `#3' to +\string\ordinalstring}{Available options are m, f or n}}% +\protect\@ordinalstringM{#2}{\@fc@ordstr}}}% +\expandafter\let\csname @fcs@#1\endcsname\@fc@ordstr} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\Ordinalstring} +% Display ordinal as a string with initial letters in upper case +% (argument is a counter) +% \begin{macrocode} +\newcommand*{\Ordinalstring}[1]{% +\expandafter\protect\expandafter\Ordinalstringnum{% +\expandafter\the\csname c@#1\endcsname}} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\Ordinalstringnum} +% Display ordinal as a string with initial letters in upper case +% (argument is a number or count register) +%\changes{1.31}{2009/10/02}{replaced \cs{@ifnextchar} with +%\cs{new@ifnextchar}} +% \begin{macrocode} +\newcommand*{\Ordinalstringnum}[1]{% +\new@ifnextchar[{\@Ordinal@string{#1}}{\@Ordinal@string{#1}[m]}} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\@Ordinal@string} +% Display ordinal as a string with initial letters in upper case +% according to gender +% \begin{macrocode} +\def\@Ordinal@string#1[#2]{{% +\ifthenelse{\equal{#2}{f}}{% +\protect\@OrdinalstringF{#1}{\@fc@ordstr}}{% +\ifthenelse{\equal{#2}{n}}{% +\protect\@OrdinalstringN{#1}{\@fc@ordstr}}{% +\ifthenelse{\equal{#2}{m}}{}{% +\PackageError{fmtcount}{Invalid gender option `#2'}{% +Available options are m, f or n}}% +\protect\@OrdinalstringM{#1}{\@fc@ordstr}}}\@fc@ordstr}} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\storeOrdinalstring} +% Store textual representation of number, with initial letters in +% upper case. First argument is identifying name, second argument +% is the counter set to the +% required number. +% \begin{macrocode} +\newcommand*{\storeOrdinalstring}[2]{% +\expandafter\protect\expandafter\storeOrdinalstringnum{#1}{% +\expandafter\the\csname c@#2\endcsname}} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\storeOrdinalstringnum} +% Store textual representation of number, with initial letters in +% upper case. First argument is identifying name, second argument +% is a count register or number. +% \begin{macrocode} +\newcommand*{\storeOrdinalstringnum}[2]{% +\@ifnextchar[{\@store@Ordinal@string{#1}{#2}}{% +\@store@Ordinal@string{#1}{#2}[m]}} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\@store@Ordinal@string} +% Store textual representation of number according to gender, +% with initial letters in upper case. +% \begin{macrocode} +\def\@store@Ordinal@string#1#2[#3]{% +\ifthenelse{\equal{#3}{f}}{% +\protect\@OrdinalstringF{#2}{\@fc@ordstr}}{% +\ifthenelse{\equal{#3}{n}}{% +\protect\@OrdinalstringN{#2}{\@fc@ordstr}}{% +\ifthenelse{\equal{#3}{m}}{}{% +\PackageError{fmtcount}{Invalid gender option `#3'}{% +Available options are m or f}}% +\protect\@OrdinalstringM{#2}{\@fc@ordstr}}}% +\expandafter\let\csname @fcs@#1\endcsname\@fc@ordstr} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\storeORDINALstring} +% Store upper case textual representation of ordinal. The first +% argument is identifying name, the second argument is a counter. +% \begin{macrocode} +\newcommand*{\storeORDINALstring}[2]{% +\expandafter\protect\expandafter\storeORDINALstringnum{#1}{% +\expandafter\the\csname c@#2\endcsname}} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\storeORDINALstringnum} +% As above, but the second argument is a count register or a +% number. +% \begin{macrocode} +\newcommand*{\storeORDINALstringnum}[2]{% +\@ifnextchar[{\@store@ORDINAL@string{#1}{#2}}{% +\@store@ORDINAL@string{#1}{#2}[m]}} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\@store@ORDINAL@string} +% Gender is specified as an optional argument at the end. +% \begin{macrocode} +\def\@store@ORDINAL@string#1#2[#3]{% +\ifthenelse{\equal{#3}{f}}{% +\protect\@ordinalstringF{#2}{\@fc@ordstr}}{% +\ifthenelse{\equal{#3}{n}}{% +\protect\@ordinalstringN{#2}{\@fc@ordstr}}{% +\ifthenelse{\equal{#3}{m}}{}{% +\PackageError{fmtcount}{Invalid gender option `#3'}{% +Available options are m or f}}% +\protect\@ordinalstringM{#2}{\@fc@ordstr}}}% +\expandafter\edef\csname @fcs@#1\endcsname{% +\noexpand\MakeUppercase{\@fc@ordstr}}} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\ORDINALstring} +% Display upper case textual representation of an ordinal. The +% argument must be a counter. +% \begin{macrocode} +\newcommand*{\ORDINALstring}[1]{% +\expandafter\protect\expandafter\ORDINALstringnum{% +\expandafter\the\csname c@#1\endcsname}} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\ORDINALstringnum} +% As above, but the argument is a count register or a number. +%\changes{1.31}{2009/10/02}{replaced \cs{@ifnextchar} with +%\cs{new@ifnextchar}} +% \begin{macrocode} +\newcommand*{\ORDINALstringnum}[1]{% +\new@ifnextchar[{\@ORDINAL@string{#1}}{\@ORDINAL@string{#1}[m]}} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\@ORDINAL@string} +% Gender is specified as an optional argument at the end. +% \begin{macrocode} +\def\@ORDINAL@string#1[#2]{{% +\ifthenelse{\equal{#2}{f}}{% +\protect\@ordinalstringF{#1}{\@fc@ordstr}}{% +\ifthenelse{\equal{#2}{n}}{% +\protect\@ordinalstringN{#1}{\@fc@ordstr}}{% +\ifthenelse{\equal{#2}{m}}{}{% +\PackageError{fmtcount}{Invalid gender option `#2'}{% +Available options are m, f or n}}% +\protect\@ordinalstringM{#1}{\@fc@ordstr}}}% +\MakeUppercase{\@fc@ordstr}}} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\storenumberstring} +% Convert number to textual respresentation, and store. First +% argument is the identifying name, second argument is a counter +% containing the number. +% \begin{macrocode} +\newcommand*{\storenumberstring}[2]{% +\expandafter\protect\expandafter\storenumberstringnum{#1}{% +\expandafter\the\csname c@#2\endcsname}} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\storenumberstringnum} +% As above, but second argument is a number or count register. +% \begin{macrocode} +\newcommand{\storenumberstringnum}[2]{% +\@ifnextchar[{\@store@number@string{#1}{#2}}{% +\@store@number@string{#1}{#2}[m]}} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\@store@number@string} +% Gender is given as optional argument, \emph{at the end}. +% \begin{macrocode} +\def\@store@number@string#1#2[#3]{% +\ifthenelse{\equal{#3}{f}}{% +\protect\@numberstringF{#2}{\@fc@numstr}}{% +\ifthenelse{\equal{#3}{n}}{% +\protect\@numberstringN{#2}{\@fc@numstr}}{% +\ifthenelse{\equal{#3}{m}}{}{% +\PackageError{fmtcount}{Invalid gender option `#3'}{% +Available options are m, f or n}}% +\protect\@numberstringM{#2}{\@fc@numstr}}}% +\expandafter\let\csname @fcs@#1\endcsname\@fc@numstr} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\numberstring} +% Display textual representation of a number. The argument +% must be a counter. +% \begin{macrocode} +\newcommand*{\numberstring}[1]{% +\expandafter\protect\expandafter\numberstringnum{% +\expandafter\the\csname c@#1\endcsname}} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\numberstringnum} +% As above, but the argument is a count register or a number. +%\changes{1.31}{2009/10/02}{replaced \cs{@ifnextchar} with +%\cs{new@ifnextchar}} +% \begin{macrocode} +\newcommand*{\numberstringnum}[1]{% +\new@ifnextchar[{\@number@string{#1}}{\@number@string{#1}[m]}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@number@string} +% Gender is specified as an optional argument \emph{at the end}. +% \begin{macrocode} +\def\@number@string#1[#2]{{% +\ifthenelse{\equal{#2}{f}}{% +\protect\@numberstringF{#1}{\@fc@numstr}}{% +\ifthenelse{\equal{#2}{n}}{% +\protect\@numberstringN{#1}{\@fc@numstr}}{% +\ifthenelse{\equal{#2}{m}}{}{% +\PackageError{fmtcount}{Invalid gender option `#2'}{% +Available options are m, f or n}}% +\protect\@numberstringM{#1}{\@fc@numstr}}}\@fc@numstr}} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\storeNumberstring} +% Store textual representation of number. First argument is +% identifying name, second argument is a counter. +% \begin{macrocode} +\newcommand*{\storeNumberstring}[2]{% +\expandafter\protect\expandafter\storeNumberstringnum{#1}{% +\expandafter\the\csname c@#2\endcsname}} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\storeNumberstringnum} +% As above, but second argument is a count register or number. +% \begin{macrocode} +\newcommand{\storeNumberstringnum}[2]{% +\@ifnextchar[{\@store@Number@string{#1}{#2}}{% +\@store@Number@string{#1}{#2}[m]}} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\@store@Number@string} +% Gender is specified as an optional argument \emph{at the end}: +% \begin{macrocode} +\def\@store@Number@string#1#2[#3]{% +\ifthenelse{\equal{#3}{f}}{% +\protect\@NumberstringF{#2}{\@fc@numstr}}{% +\ifthenelse{\equal{#3}{n}}{% +\protect\@NumberstringN{#2}{\@fc@numstr}}{% +\ifthenelse{\equal{#3}{m}}{}{% +\PackageError{fmtcount}{Invalid gender option `#3'}{% +Available options are m, f or n}}% +\protect\@NumberstringM{#2}{\@fc@numstr}}}% +\expandafter\let\csname @fcs@#1\endcsname\@fc@numstr} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\Numberstring} +% Display textual representation of number. The argument must be +% a counter. +% \begin{macrocode} +\newcommand*{\Numberstring}[1]{% +\expandafter\protect\expandafter\Numberstringnum{% +\expandafter\the\csname c@#1\endcsname}} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\Numberstringnum} +% As above, but the argument is a count register or number. +%\changes{1.31}{2009/10/02}{replaced \cs{@ifnextchar} with +%\cs{new@ifnextchar}} +% \begin{macrocode} +\newcommand*{\Numberstringnum}[1]{% +\new@ifnextchar[{\@Number@string{#1}}{\@Number@string{#1}[m]}} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\@Number@string} +% Gender is specified as an optional argument at the end. +% \begin{macrocode} +\def\@Number@string#1[#2]{{% +\ifthenelse{\equal{#2}{f}}{% +\protect\@NumberstringF{#1}{\@fc@numstr}}{% +\ifthenelse{\equal{#2}{n}}{% +\protect\@NumberstringN{#1}{\@fc@numstr}}{% +\ifthenelse{\equal{#2}{m}}{}{% +\PackageError{fmtcount}{Invalid gender option `#2'}{% +Available options are m, f or n}}% +\protect\@NumberstringM{#1}{\@fc@numstr}}}\@fc@numstr}} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\storeNUMBERstring} +% Store upper case textual representation of number. The first +% argument is identifying name, the second argument is a counter. +% \begin{macrocode} +\newcommand{\storeNUMBERstring}[2]{% +\expandafter\protect\expandafter\storeNUMBERstringnum{#1}{% +\expandafter\the\csname c@#2\endcsname}} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\storeNUMBERstringnum} +% As above, but the second argument is a count register or a +% number. +% \begin{macrocode} +\newcommand{\storeNUMBERstringnum}[2]{% +\@ifnextchar[{\@store@NUMBER@string{#1}{#2}}{% +\@store@NUMBER@string{#1}{#2}[m]}} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\@store@NUMBER@string} +% Gender is specified as an optional argument at the end. +% \begin{macrocode} +\def\@store@NUMBER@string#1#2[#3]{% +\ifthenelse{\equal{#3}{f}}{% +\protect\@numberstringF{#2}{\@fc@numstr}}{% +\ifthenelse{\equal{#3}{n}}{% +\protect\@numberstringN{#2}{\@fc@numstr}}{% +\ifthenelse{\equal{#3}{m}}{}{% +\PackageError{fmtcount}{Invalid gender option `#3'}{% +Available options are m or f}}% +\protect\@numberstringM{#2}{\@fc@numstr}}}% +\expandafter\edef\csname @fcs@#1\endcsname{% +\noexpand\MakeUppercase{\@fc@numstr}}} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\NUMBERstring} +% Display upper case textual representation of a number. The +% argument must be a counter. +% \begin{macrocode} +\newcommand*{\NUMBERstring}[1]{% +\expandafter\protect\expandafter\NUMBERstringnum{% +\expandafter\the\csname c@#1\endcsname}} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\NUMBERstringnum} +% As above, but the argument is a count register or a number. +%\changes{1.31}{2009/10/02}{replaced \cs{@ifnextchar} with +%\cs{new@ifnextchar}} +% \begin{macrocode} +\newcommand*{\NUMBERstringnum}[1]{% +\new@ifnextchar[{\@NUMBER@string{#1}}{\@NUMBER@string{#1}[m]}} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\@NUMBER@string} +% Gender is specified as an optional argument at the end. +% \begin{macrocode} +\def\@NUMBER@string#1[#2]{{% +\ifthenelse{\equal{#2}{f}}{% +\protect\@numberstringF{#1}{\@fc@numstr}}{% +\ifthenelse{\equal{#2}{n}}{% +\protect\@numberstringN{#1}{\@fc@numstr}}{% +\ifthenelse{\equal{#2}{m}}{}{% +\PackageError{fmtcount}{Invalid gender option `#2'}{% +Available options are m, f or n}}% +\protect\@numberstringM{#1}{\@fc@numstr}}}% +\MakeUppercase{\@fc@numstr}}} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\binary} +% Number representations in other bases. Binary: +% \begin{macrocode} +\providecommand*{\binary}[1]{% +\expandafter\protect\expandafter\@binary{% +\expandafter\the\csname c@#1\endcsname}} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\aaalph} +% Like \verb"\alph", but goes beyond 26. +% (a \ldots\ z aa \ldots zz \ldots) +% \begin{macrocode} +\providecommand*{\aaalph}[1]{% +\expandafter\protect\expandafter\@aaalph{% +\expandafter\the\csname c@#1\endcsname}} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\AAAlph} +% As before, but upper case. +% \begin{macrocode} +\providecommand*{\AAAlph}[1]{% +\expandafter\protect\expandafter\@AAAlph{% +\expandafter\the\csname c@#1\endcsname}} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\abalph} +% Like \verb"\alph", but goes beyond 26. +% (a \ldots\ z ab \ldots az \ldots) +% \begin{macrocode} +\providecommand*{\abalph}[1]{% +\expandafter\protect\expandafter\@abalph{% +\expandafter\the\csname c@#1\endcsname}} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\ABAlph} +% As above, but upper case. +% \begin{macrocode} +\providecommand*{\ABAlph}[1]{% +\expandafter\protect\expandafter\@ABAlph{% +\expandafter\the\csname c@#1\endcsname}} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\hexadecimal} +% Hexadecimal: +% \begin{macrocode} +\providecommand*{\hexadecimal}[1]{% +\expandafter\protect\expandafter\@hexadecimal{% +\expandafter\the\csname c@#1\endcsname}} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\Hexadecimal} +% As above, but in upper case. +% \begin{macrocode} +\providecommand*{\Hexadecimal}[1]{% +\expandafter\protect\expandafter\@Hexadecimal{% +\expandafter\the\csname c@#1\endcsname}} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\octal} +% Octal: +% \begin{macrocode} +\providecommand*{\octal}[1]{% +\expandafter\protect\expandafter\@octal{% +\expandafter\the\csname c@#1\endcsname}} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\decimal} +% Decimal: +% \begin{macrocode} +\providecommand*{\decimal}[1]{% +\expandafter\protect\expandafter\@decimal{% +\expandafter\the\csname c@#1\endcsname}} +% \end{macrocode} +%\end{macro} +% +%\subsection{Multilinguage Definitions} +%\begin{macro}{\@setdef@ultfmtcount} +% If multilingual support is provided, make \verb"\@numberstring" +% etc use the correct language (if defined). +% Otherwise use English definitions. "\@setdef@ultfmtcount" +% sets the macros to use English. +% \begin{macrocode} +\def\@setdef@ultfmtcount{ +\@ifundefined{@ordinalMenglish}{\input{fc-english.def}}{} +\def\@ordinalstringM{\@ordinalstringMenglish} +\let\@ordinalstringF=\@ordinalstringMenglish +\let\@ordinalstringN=\@ordinalstringMenglish +\def\@OrdinalstringM{\@OrdinalstringMenglish} +\let\@OrdinalstringF=\@OrdinalstringMenglish +\let\@OrdinalstringN=\@OrdinalstringMenglish +\def\@numberstringM{\@numberstringMenglish} +\let\@numberstringF=\@numberstringMenglish +\let\@numberstringN=\@numberstringMenglish +\def\@NumberstringM{\@NumberstringMenglish} +\let\@NumberstringF=\@NumberstringMenglish +\let\@NumberstringN=\@NumberstringMenglish +\def\@ordinalM{\@ordinalMenglish} +\let\@ordinalF=\@ordinalM +\let\@ordinalN=\@ordinalM +} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\@set@mulitling@fmtcount} +% This defines the number and ordinal string macros to use +% \cs{languagename}: +% \begin{macrocode} +\def\@set@mulitling@fmtcount{% +% \end{macrocode} +% The masculine version of \cs{numberstring}: +% \begin{macrocode} +\def\@numberstringM{\@ifundefined{@numberstringM\languagename}{% +\PackageError{fmtcount}{No support for language '\languagename'}{% +The fmtcount package currently does not support language +'\languagename' for command \string\@numberstringM}}{% +\csname @numberstringM\languagename\endcsname}}% +% \end{macrocode} +% The feminine version of \cs{numberstring}: +% \begin{macrocode} +\def\@numberstringF{\@ifundefined{@numberstringF\languagename}{% +\PackageError{fmtcount}{No support for language '\languagename'}{% +The fmtcount package currently does not support language +'\languagename' for command \string\@numberstringF}}{% +\csname @numberstringF\languagename\endcsname}}% +% \end{macrocode} +% The neuter version of \cs{numberstring}: +% \begin{macrocode} +\def\@numberstringN{\@ifundefined{@numberstringN\languagename}{% +\PackageError{fmtcount}{No support for language '\languagename'}{% +The fmtcount package currently does not support language +'\languagename' for command \string\@numberstringN}}{% +\csname @numberstringN\languagename\endcsname}}% +% \end{macrocode} +% The masculine version of \cs{Numberstring}: +% \begin{macrocode} +\def\@NumberstringM{\@ifundefined{@NumberstringM\languagename}{% +\PackageError{fmtcount}{No support for language '\languagename'}{% +The fmtcount package currently does not support language +'\languagename' for command \string\@NumberstringM}}{% +\csname @NumberstringM\languagename\endcsname}}% +% \end{macrocode} +% The feminine version of \cs{Numberstring}: +% \begin{macrocode} +\def\@NumberstringF{\@ifundefined{@NumberstringF\languagename}{% +\PackageError{fmtcount}{No support for language '\languagename'}{% +The fmtcount package currently does not support language +'\languagename' for command \string\@NumberstringF}}{% +\csname @NumberstringF\languagename\endcsname}}% +% \end{macrocode} +% The neuter version of \cs{Numberstring}: +% \begin{macrocode} +\def\@NumberstringN{\@ifundefined{@NumberstringN\languagename}{% +\PackageError{fmtcount}{No support for language '\languagename'}{% +The fmtcount package currently does not support language +'\languagename' for command \string\@NumberstringN}}{% +\csname @NumberstringN\languagename\endcsname}}% +% \end{macrocode} +% The masculine version of \cs{ordinal}: +% \begin{macrocode} +\def\@ordinalM{\@ifundefined{@ordinalM\languagename}{% +\PackageError{fmtcount}{No support for language '\languagename'}{% +The fmtcount package currently does not support language +'\languagename' for command \string\@ordinalM}}{% +\csname @ordinalM\languagename\endcsname}}% +% \end{macrocode} +% The feminine version of \cs{ordinal}: +% \begin{macrocode} +\def\@ordinalF{\@ifundefined{@ordinalF\languagename}{% +\PackageError{fmtcount}{No support for language '\languagename'}{% +The fmtcount package currently does not support language +'\languagename' for command \string\@ordinalF}}{% +\csname @ordinalF\languagename\endcsname}}% +% \end{macrocode} +% The neuter version of \cs{ordinal}: +% \begin{macrocode} +\def\@ordinalN{\@ifundefined{@ordinalN\languagename}{% +\PackageError{fmtcount}{No support for language '\languagename'}{% +The fmtcount package currently does not support language +'\languagename' for command \string\@ordinalN}}{% +\csname @ordinalN\languagename\endcsname}}% +% \end{macrocode} +% The masculine version of \cs{ordinalstring}: +% \begin{macrocode} +\def\@ordinalstringM{\@ifundefined{@ordinalstringM\languagename}{% +\PackageError{fmtcount}{No support for language '\languagename'}{% +The fmtcount package currently does not support language +'\languagename' for command \string\@ordinalstringM}}{% +\csname @ordinalstringM\languagename\endcsname}}% +% \end{macrocode} +% The feminine version of \cs{ordinalstring}: +% \begin{macrocode} +\def\@ordinalstringF{\@ifundefined{@ordinalstringF\languagename}{% +\PackageError{fmtcount}{No support for language '\languagename'}{% +The fmtcount package currently does not support language +'\languagename' for command \string\@ordinalstringF}}{% +\csname @ordinalstringF\languagename\endcsname}}% +% \end{macrocode} +% The neuter version of \cs{ordinalstring}: +% \begin{macrocode} +\def\@ordinalstringN{\@ifundefined{@ordinalstringN\languagename}{% +\PackageError{fmtcount}{No support for language '\languagename'}{% +The fmtcount package currently does not support language +'\languagename' for command \string\@ordinalstringN}}{% +\csname @ordinalstringN\languagename\endcsname}}% +% \end{macrocode} +% The masculine version of \cs{Ordinalstring}: +% \begin{macrocode} +\def\@OrdinalstringM{\@ifundefined{@OrdinalstringM\languagename}{% +\PackageError{fmtcount}{No support for language '\languagename'}{% +The fmtcount package currently does not support language +'\languagename' for command \string\@OrdinalstringM}}{% +\csname @OrdinalstringM\languagename\endcsname}}% +% \end{macrocode} +% The feminine version of \cs{Ordinalstring}: +% \begin{macrocode} +\def\@OrdinalstringF{\@ifundefined{@OrdinalstringF\languagename}{% +\PackageError{fmtcount}{No support for language '\languagename'}{% +The fmtcount package currently does not support language +'\languagename' for command \string\@OrdinalstringF}}{% +\csname @OrdinalstringF\languagename\endcsname}}% +% \end{macrocode} +% The neuter version of \cs{Ordinalstring}: +% \begin{macrocode} +\def\@OrdinalstringN{\@ifundefined{@OrdinalstringN\languagename}{% +\PackageError{fmtcount}{No support for language '\languagename'}{% +The fmtcount package currently does not support language +'\languagename' for command \string\@OrdinalstringN}}{% +\csname @OrdinalstringN\languagename\endcsname}} +} +% \end{macrocode} +%\end{macro} +% Check to see if babel or ngerman packages have been loaded. +% \begin{macrocode} +\@ifpackageloaded{babel}{% +\ifthenelse{\equal{\languagename}{nohyphenation}\or +\equal{languagename}{english}}{\@setdef@ultfmtcount}{% +\@set@mulitling@fmtcount} +}{% +\@ifpackageloaded{ngerman}{% +\@ifundefined{@numberstringMgerman}{% +\input{fc-german.def}}{}\@set@mulitling@fmtcount}{% +\@setdef@ultfmtcount}} +% \end{macrocode} +% Backwards compatibility: +% \begin{macrocode} +\let\@ordinal=\@ordinalM +\let\@ordinalstring=\@ordinalstringM +\let\@Ordinalstring=\@OrdinalstringM +\let\@numberstring=\@numberstringM +\let\@Numberstring=\@NumberstringM +% \end{macrocode} +%\iffalse +% \begin{macrocode} +%</fmtcount.sty> +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} %<*fc-british.def> % \end{macrocode} %\fi -% \subsection{fc-british.def} +% \subsubsection{fc-british.def} % British definitions % \begin{macrocode} \ProvidesFile{fc-british}[2007/06/14] @@ -648,7 +1865,7 @@ %<*fc-english.def> % \end{macrocode} %\fi -% \subsection{fc-english.def} +% \subsubsection{fc-english.def} % English definitions % \begin{macrocode} \ProvidesFile{fc-english}[2007/05/26] @@ -1193,7 +2410,7 @@ this number}% %<*fc-french.def> % \end{macrocode} %\fi -% \subsection{fc-french.def} +% \subsubsection{fc-french.def} % French definitions % \begin{macrocode} \ProvidesFile{fc-french.def}[2007/05/26] @@ -2408,7 +3625,7 @@ this number}% %<*fc-german.def> % \end{macrocode} %\fi -% \subsection{fc-german.def} +% \subsubsection{fc-german.def} % German definitions (thank you to K. H. Fricke for supplying % this information) % \begin{macrocode} @@ -2954,10 +4171,754 @@ zehntes% %\fi %\iffalse % \begin{macrocode} +%<*fc-italian.def> +% \end{macrocode} +%\fi +% \subsubsection{fc-italian} +% Italian definitions provided by Edoardo Pasca (2008). +% \begin{macrocode} +\ProvidesFile{fc-italian.def}[2009/10/02 Italian support for fmtcount (Edoardo Pasca)] +\newcommand{\@@unitstringitalian}[1]{% +\ifcase#1\relax +zero% +\or uno% +\or due% +\or tre% +\or quattro% +\or cinque% +\or sei% +\or sette% +\or otto% +\or nove% +\fi +} + +\newcommand{\@@unitstringFitalian}[1]{% +\ifcase#1\relax +zero% +\or una% +\or doe% +\or tre% +\or quattro% +\or cinque% +\or sei% +\or sette% +\or otto% +\or nove% +\fi +} + +\newcommand{\@@tenstringitalian}[1]{% +\ifcase#1\relax +\or dieci% +\or venti% +\or trenta% +\or quaranta% +\or cinquanta% +\or sessanta% +\or settanta% +\or ottanta% +\or novanta% +\or cento% +\fi +} + +\newcommand{\@@teenstringitalian}[1]{% +\ifcase#1\relax +dieci% +\or undici% +\or dodici% +\or tredici% +\or quattordici% +\or quindici% +\or sedici% +\or diciassette% +\or diciotto% +\or diciannove% +\fi +} + +\newcommand{\@@twentystringitalian}[1]{% +\ifcase#1\relax +venti% +\or ventuno% +\or ventidue% +\or ventitre% +\or ventiquattro% +\or venticinque% +\or ventisei% +\or ventisette% +\or ventiotto% +\or ventinove% +\fi} + +\newcommand{\@@twentystringFitalian}[1]{% +\ifcase#1\relax +venti% +\or ventuna% +\or ventidue% +\or ventitre% +\or ventiquattro% +\or venticinque% +\or ventisei% +\or ventisette% +\or ventiotto% +\or ventinove% +\fi} + +\newcommand{\@@hundredstringitalian}[1]{% +\ifcase#1\relax +\or cento% +\or duecento% +\or trecento% +\or quattrocento% +\or cinquecento% +\or seicento% +\or settecento% +\or ottocento% +\or novecento% +\fi} + +\newcommand{\@@hundredstringFitalian}[1]{% +\ifcase#1\relax +\or cento% +\or duecento% +\or trecento% +\or quattrocento% +\or cinquecento% +\or seicento% +\or settecento% +\or ottocento% +\or novecento% +\fi} + +\newcommand{\@@Unitstringitalian}[1]{% +\ifcase#1\relax +Zero% +\or Uno% +\or Due% +\or Tre% +\or Quattro% +\or Cinque% +\or Sei% +\or Sette% +\or Otto% +\or Nove% +\fi +} + +\newcommand{\@@UnitstringFitalian}[1]{% +\ifcase#1\relax +Zero% +\or Una% +\or Due% +\or Tre% +\or Quattro% +\or Cinque% +\or Sei% +\or Sette% +\or Otto% +\or Nove% +\fi +} + +\newcommand{\@@Tenstringitalian}[1]{% +\ifcase#1\relax +\or Dieci% +\or Venti% +\or Trenta% +\or Quaranta% +\or Cinquanta% +\or Sessanta% +\or Settanta% +\or Ottanta% +\or Novanta% +\or Cento% +\fi +} + +\newcommand{\@@Teenstringitalian}[1]{% +\ifcase#1\relax +Dieci% +\or Undici% +\or Dodici% +\or Tredici% +\or Quattordici% +\or Quindici% +\or Sedici% +\or Diciassette% +\or Diciotto% +\or Diciannove% +\fi +} + +\newcommand{\@@Twentystringitalian}[1]{% +\ifcase#1\relax +Venti% +\or Ventuno% +\or Ventidue% +\or Ventitre% +\or Ventiquattro% +\or Venticinque% +\or Ventisei% +\or Ventisette% +\or Ventiotto% +\or Ventinove% +\fi} + +\newcommand{\@@TwentystringFitalian}[1]{% +\ifcase#1\relax +Venti% +\or Ventuno% +\or Ventidue% +\or Ventitre% +\or Ventiquattro% +\or Venticinque% +\or Ventisei% +\or Ventisette% +\or Ventiotto% +\or Ventinove% +\fi} + +\newcommand{\@@Hundredstringitalian}[1]{% +\ifcase#1\relax +\or Cento% +\or Duecento% +\or Trecento% +\or Quattrocento% +\or Cinquecento% +\or Seicento% +\or Settecento% +\or Ottocento% +\or Novecento% +\fi} + +\newcommand{\@@HundredstringFitalian}[1]{% +\ifcase#1\relax +\or Cento% +\or Duecento% +\or Trecento% +\or Quattrocento% +\or Cinquecento% +\or Seicento% +\or Settecento% +\or Ottocento% +\or Novecento% +\fi} + + +\newcommand{\@numberstringMitalian}[2]{% +\let\@unitstring=\@@unitstringitalian +\let\@teenstring=\@@teenstringitalian +\let\@tenstring=\@@tenstringitalian +\let\@twentystring=\@@twentystringitalian +\let\@hundredstring=\@@hundredstringitalian +\def\@hundred{cien}\def\@thousand{mil}% +\def\@andname{y}% +\@@numberstringitalian{#1}{#2}} + +\newcommand{\@numberstringFitalian}[2]{% +\let\@unitstring=\@@unitstringFitalian +\let\@teenstring=\@@teenstringitalian +\let\@tenstring=\@@tenstringitalian +\let\@twentystring=\@@twentystringFitalian +\let\@hundredstring=\@@hundredstringFitalian +\def\@hundred{cien}\def\@thousand{mil}% +\def\@andname{y}% +\@@numberstringitalian{#1}{#2}} + +\newcommand{\@NumberstringMitalian}[2]{% +\let\@unitstring=\@@Unitstringitalian +\let\@teenstring=\@@Teenstringitalian +\let\@tenstring=\@@Tenstringitalian +\let\@twentystring=\@@Twentystringitalian +\let\@hundredstring=\@@Hundredstringitalian +\def\@andname{y}% +\def\@hundred{Cien}\def\@thousand{Mil}% +\@@numberstringitalian{#1}{#2}} + +\newcommand{\@NumberstringFitalian}[2]{% +\let\@unitstring=\@@UnitstringFitalian +\let\@teenstring=\@@Teenstringitalian +\let\@tenstring=\@@Tenstringitalian +\let\@twentystring=\@@TwentystringFitalian +\let\@hundredstring=\@@HundredstringFitalian +\def\@andname{y}% +\def\@hundred{Cien}\def\@thousand{Mil}% +\@@numberstringitalian{#1}{#2}} + +\newcommand{\@ordinalstringMitalian}[2]{% +\let\@unitthstring=\@@unitthstringitalian +\let\@unitstring=\@@unitstringitalian +\let\@teenthstring=\@@teenthstringitalian +\let\@tenthstring=\@@tenthstringitalian +\let\@hundredthstring=\@@hundredthstringitalian +\def\@thousandth{millesimo}% +\@@ordinalstringitalian{#1}{#2}} + +\newcommand{\@ordinalstringFitalian}[2]{% +\let\@unitthstring=\@@unitthstringFitalian +\let\@unitstring=\@@unitstringFitalian +\let\@teenthstring=\@@teenthstringFitalian +\let\@tenthstring=\@@tenthstringFitalian +\let\@hundredthstring=\@@hundredthstringFitalian +\def\@thousandth{millesima}% +\@@ordinalstringitalian{#1}{#2}} + +\newcommand{\@OrdinalstringMitalian}[2]{% +\let\@unitthstring=\@@Unitthstringitalian +\let\@unitstring=\@@Unitstringitalian +\let\@teenthstring=\@@Teenthstringitalian +\let\@tenthstring=\@@Tenthstringitalian +\let\@hundredthstring=\@@Hundredthstringitalian +\def\@thousandth{Millesimo}% +\@@ordinalstringitalian{#1}{#2}} + +\newcommand{\@OrdinalstringFitalian}[2]{% +\let\@unitthstring=\@@UnitthstringFitalian +\let\@unitstring=\@@UnitstringFitalian +\let\@teenthstring=\@@TeenthstringFitalian +\let\@tenthstring=\@@TenthstringFitalian +\let\@hundredthstring=\@@HundredthstringFitalian +\def\@thousandth{Millesima}% +\@@ordinalstringitalian{#1}{#2}} + +\newcommand{\@ordinalMitalian}[2]{\edef#2{#1\relax\noexpand\fmtord{o}}} +\newcommand{\@ordinalFitalian}[2]{\edef#2{#1\relax\noexpand\fmtord{a}}} + +\newcommand{\@@unitthstringitalian}[1]{% +\ifcase#1\relax +zero% +\or primo% +\or secondo% +\or terzo% +\or quarto% +\or quinto% +\or sesto% +\or settimo% +\or ottavo% +\or nono% +\fi +} + +\newcommand{\@@tenthstringitalian}[1]{% +\ifcase#1\relax +\or decimo% +\or ventesimo% +\or trentesimo% +\or quarantesimo% +\or cinquantesimo% +\or sessantesimo% +\or settantesimo% +\or ottantesimo% +\or novantesimo% +\fi +} + +\newcommand{\@@teenthstringitalian}[1]{% +\ifcase#1\relax +decimo% +\or undicesimo% +\or dodicesimo% +\or tredicesimo% +\or quattordicesimo% +\or quindicesimo% +\or sedicesimo% +\or diciassettesimo% +\or diciottesimo% +\or diciannovesimo% +\fi +} + +\newcommand{\@@hundredthstringitalian}[1]{% +\ifcase#1\relax +\or centesimo% +\or duecentesimo% +\or trecentesimo% +\or quattrocentesimo% +\or cinquecentesimo% +\or seicentesimo% +\or settecentesimo% +\or ottocentesimo% +\or novecentesimo% +\fi} + +\newcommand{\@@unitthstringFitalian}[1]{% +\ifcase#1\relax +zero% +\or prima% +\or seconda% +\or terza% +\or quarta% +\or quinta% +\or sesta% +\or settima% +\or ottava% +\or nona% +\fi +} + +\newcommand{\@@tenthstringFitalian}[1]{% +\ifcase#1\relax +\or decima% +\or ventesima% +\or trentesima% +\or quarantesima% +\or cinquantesima% +\or sessantesima% +\or settantesima% +\or ottantesima% +\or novantesima% +\fi +} + +\newcommand{\@@teenthstringFitalian}[1]{% +\ifcase#1\relax +decima% +\or undicesima% +\or dodicesima% +\or tredicesima% +\or quattordicesima% +\or quindicesima% +\or sedicesima% +\or diciassettesima% +\or diciottesima% +\or diciannovesima% +\fi +} + +\newcommand{\@@hundredthstringFitalian}[1]{% +\ifcase#1\relax +\or centesima% +\or duecentesima% +\or trecentesima% +\or quattrocentesima% +\or cinquecentesima% +\or seicentesima% +\or settecentesima% +\or ottocentesima% +\or novecentesima% +\fi} + +\newcommand{\@@Unitthstringitalian}[1]{% +\ifcase#1\relax +Zero% +\or Primo% +\or Secondo% +\or Terzo% +\or Quarto% +\or Quinto% +\or Sesto% +\or Settimo% +\or Ottavo% +\or Nono% +\fi +} + +\newcommand{\@@Tenthstringitalian}[1]{% +\ifcase#1\relax +\or Decimo% +\or Ventesimo% +\or Trentesimo% +\or Quarantesimo% +\or Cinquantesimo% +\or Sessantesimo% +\or Settantesimo% +\or Ottantesimo% +\or Novantesimo% +\fi +} + +\newcommand{\@@Teenthstringitalian}[1]{% +\ifcase#1\relax +Decimo% +\or Undicesimo% +\or Dodicesimo% +\or Tredicesimo% +\or Quattordicesimo% +\or Quindicesimo% +\or Sedicesimo% +\or Diciassettesimo% +\or Diciottesimo% +\or Diciannovesimo% +\fi +} + +\newcommand{\@@Hundredthstringitalian}[1]{% +\ifcase#1\relax +\or Centesimo% +\or Duecentesimo% +\or Trecentesimo% +\or Quattrocentesimo% +\or Cinquecentesimo% +\or Seicentesimo% +\or Settecentesimo% +\or Ottocentesimo% +\or Novecentesimo% +\fi} + +\newcommand{\@@UnitthstringFitalian}[1]{% +\ifcase#1\relax +Zero% +\or Prima% +\or Seconda% +\or Terza% +\or Quarta% +\or Quinta% +\or Sesta% +\or Settima% +\or Ottava% +\or Nona% +\fi +} + +\newcommand{\@@TenthstringFitalian}[1]{% +\ifcase#1\relax +\or Decima% +\or Ventesima% +\or Trentesima% +\or Quarantesima% +\or Cinquantesima% +\or Sessantesima% +\or Settantesima% +\or Ottantesima% +\or Novantesima% +\fi +} + +\newcommand{\@@TeenthstringFitalian}[1]{% +\ifcase#1\relax +Decima% +\or Undicesima% +\or Dodicesima% +\or Tredicesima% +\or Quattordicesima% +\or Quindicesima% +\or Sedicesima% +\or Diciassettesima% +\or Diciottesima% +\or Diciannovesima% +\fi +} + +\newcommand{\@@HundredthstringFitalian}[1]{% +\ifcase#1\relax +\or Centesima% +\or Duecentesima% +\or Trecentesima% +\or Quattrocentesima% +\or Cinquecentesima% +\or Seicentesima% +\or Settecentesima% +\or Ottocentesima% +\or Novecentesima% +\fi} + + +\newcommand{\@@numberstringitalian}[2]{% +\def#2{}% +\ifnum#1>99999\relax + \PackageError{fmtcount}{Out of range}% + {This macro only works for values less than 100000}% +\else + \ifnum#1<0\relax + \PackageError{fmtcount}{Negative numbers not permitted}% + {This macro does not work for negative numbers, however + you can try typing "minus" first, and then pass the modulus of + this number}% + \fi +\fi +\@strctr=#1\relax \divide\@strctr by 1000\relax +\ifnum\@strctr>9\relax + \divide\@strctr by 10\relax + \ifnum\@strctr>1\relax + \edef#2{\@tenstring{\@strctr}}% + \@strctr=#1 \divide\@strctr by 1000\relax + \@modulo{\@strctr}{10}% + \ifnum\@strctr>0\relax + \let\@@fc@numstr#2\relax + \edef#2{\@@fc@numstr\ \@andname\ \@unitstring{\@strctr}}% + \fi + \else + \@strctr=#1\relax + \divide\@strctr by 1000\relax + \@modulo{\@strctr}{10}% + \let\@@fc@numstr#2\relax + \edef#2{\@@fc@numstr\@teenstring{\@strctr}}% + \fi + \let\@@fc@numstr#2\relax + \edef#2{\@@fc@numstr\ \@thousand}% +\else + \ifnum\@strctr>0\relax + \ifnum\@strctr>1\relax + \let\@@fc@numstr#2\relax + \edef#2{\@@fc@numstr\@unitstring{\@strctr}\ }% + \fi + \let\@@fc@numstr#2\relax + \edef#2{\@@fc@numstr\@thousand}% + \fi +\fi +\@strctr=#1\relax \@modulo{\@strctr}{1000}% +\divide\@strctr by 100\relax +\ifnum\@strctr>0\relax + \ifnum#1>1000\relax + \let\@@fc@numstr#2\relax + \edef#2{\@@fc@numstr\ }% + \fi + \@tmpstrctr=#1\relax + \@modulo{\@tmpstrctr}{1000}% + \let\@@fc@numstr#2\relax + \ifnum\@tmpstrctr=100\relax + \edef#2{\@@fc@numstr\@tenstring{10}}% + \else + \edef#2{\@@fc@numstr\@hundredstring{\@strctr}}% + \fi +\fi +\@strctr=#1\relax \@modulo{\@strctr}{100}% +\ifnum#1>100\relax + \ifnum\@strctr>0\relax + \let\@@fc@numstr#2\relax + \edef#2{\@@fc@numstr\ \@andname\ }% + \fi +\fi +\ifnum\@strctr>29\relax + \divide\@strctr by 10\relax + \let\@@fc@numstr#2\relax + \edef#2{\@@fc@numstr\@tenstring{\@strctr}}% + \@strctr=#1\relax \@modulo{\@strctr}{10}% + \ifnum\@strctr>0\relax + \let\@@fc@numstr#2\relax + \edef#2{\@@fc@numstr\ \@andname\ \@unitstring{\@strctr}}% + \fi +\else + \ifnum\@strctr<10\relax + \ifnum\@strctr=0\relax + \ifnum#1<100\relax + \let\@@fc@numstr#2\relax + \edef#2{\@@fc@numstr\@unitstring{\@strctr}}% + \fi + \else + \let\@@fc@numstr#2\relax + \edef#2{\@@fc@numstr\@unitstring{\@strctr}}% + \fi + \else + \ifnum\@strctr>19\relax + \@modulo{\@strctr}{10}% + \let\@@fc@numstr#2\relax + \edef#2{\@@fc@numstr\@twentystring{\@strctr}}% + \else + \@modulo{\@strctr}{10}% + \let\@@fc@numstr#2\relax + \edef#2{\@@fc@numstr\@teenstring{\@strctr}}% + \fi + \fi +\fi +} + +\newcommand{\@@ordinalstringitalian}[2]{% +\@strctr=#1\relax +\def#2{}% +\ifnum#1>99999\relax + \PackageError{fmtcount}{Out of range}% + {This macro only works for values less than 100000}% +\else + \ifnum#1<0\relax + \PackageError{fmtcount}{Negative numbers not permitted}% + {This macro does not work for negative numbers, however + you can try typing "minus" first, and then pass the modulus of + this number}% + \else + \ifnum\@strctr>999\relax + \divide\@strctr by 1000\relax + \ifnum\@strctr>1\relax + \ifnum\@strctr>9\relax + \@tmpstrctr=\@strctr + \ifnum\@strctr<20\relax + \@modulo{\@tmpstrctr}{10}% + \let\@@fc@numstr#2\relax + \edef#2{\@@fc@numstr\@teenthstring{\@tmpstrctr} }% + \else + \divide\@tmpstrctr by 10\relax + \let\@@fc@numstr#2\relax + \edef#2{\@@fc@numstr\@tenthstring{\@tmpstrctr} }% + \@tmpstrctr=\@strctr + \@modulo{\@tmpstrctr}{10}% + \ifnum\@tmpstrctr>0\relax + \let\@@fc@numstr#2\relax + \edef#2{\@@fc@numstr\@unitthstring{\@tmpstrctr} }% + \fi + \fi + \else + \let\@@fc@numstr#2\relax + \edef#2{\@@fc@numstr\@unitstring{\@strctr} }% + \fi + \fi + \let\@@fc@numstr#2\relax + \edef#2{\@@fc@numstr\@thousandth}% + \fi + \@strctr=#1\relax + \@modulo{\@strctr}{1000}% + \ifnum\@strctr>99\relax + \@tmpstrctr=\@strctr + \divide\@tmpstrctr by 100\relax + \ifnum#1>1000\relax + \let\@@fc@numstr#2\relax + \edef#2{\@@fc@numstr\ }% + \fi + \let\@@fc@numstr#2\relax + \edef#2{\@@fc@numstr\@hundredthstring{\@tmpstrctr}}% + \fi + \@modulo{\@strctr}{100}% + \ifnum#1>99\relax + \ifnum\@strctr>0\relax + \let\@@fc@numstr#2\relax + \edef#2{\@@fc@numstr\ }% + \fi + \fi + \ifnum\@strctr>19\relax + \@tmpstrctr=\@strctr + \divide\@tmpstrctr by 10\relax + \let\@@fc@numstr#2\relax + \edef#2{\@@fc@numstr\@tenthstring{\@tmpstrctr}}% + \@tmpstrctr=\@strctr + \@modulo{\@tmpstrctr}{10}% + \ifnum\@tmpstrctr>0\relax + \let\@@fc@numstr#2\relax + \edef#2{\@@fc@numstr\ \@unitthstring{\@tmpstrctr}}% + \fi + \else + \ifnum\@strctr>9\relax + \@modulo{\@strctr}{10}% + \let\@@fc@numstr#2\relax + \edef#2{\@@fc@numstr\@teenthstring{\@strctr}}% + \else + \ifnum\@strctr=0\relax + \ifnum#1=0\relax + \let\@@fc@numstr#2\relax + \edef#2{\@@fc@numstr\@unitstring{0}}% + \fi + \else + \let\@@fc@numstr#2\relax + \edef#2{\@@fc@numstr\@unitthstring{\@strctr}}% + \fi + \fi + \fi + \fi +\fi +} +% \end{macrocode} + +%\iffalse +% \begin{macrocode} +%</fc-italian.def> +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} %<*fc-portuges.def> % \end{macrocode} %\fi -% \subsection{fc-portuges.def} +% \subsubsection{fc-portuges.def} % Portuguse definitions % \begin{macrocode} \ProvidesFile{fc-portuges.def}[2007/05/26] @@ -3706,7 +5667,7 @@ this number}% %<*fc-spanish.def> % \end{macrocode} %\fi -% \subsection{fc-spanish.def} +% \subsubsection{fc-spanish.def} % Spanish definitions % \begin{macrocode} \ProvidesFile{fc-spanish.def}[2007/05/26] @@ -4579,7 +6540,7 @@ this number}% %<*fc-UKenglish.def> % \end{macrocode} %\fi -% \subsection{fc-UKenglish.def} +% \subsubsection{fc-UKenglish.def} % UK English definitions % \begin{macrocode} \ProvidesFile{fc-UKenglish}[2007/06/14] @@ -4617,7 +6578,7 @@ this number}% %<*fc-USenglish.def> % \end{macrocode} %\fi -% \subsection{fc-USenglish.def} +% \subsubsection{fc-USenglish.def} % US English definitions % \begin{macrocode} \ProvidesFile{fc-USenglish}[2007/06/14] @@ -4652,1191 +6613,6 @@ this number}% %\fi %\iffalse % \begin{macrocode} -%<*fmtcount.sty> -% \end{macrocode} -%\fi -%\subsection{fmtcount.sty} -% This section deals with the code for |fmtcount.sty| -% \begin{macrocode} -\NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{fmtcount}[2007/07/20 v1.3] -\RequirePackage{ifthen} -\RequirePackage{keyval} -% \end{macrocode} -% These commands need to be defined before the -% configuration file is loaded.\changes{1.3}{2007/7/19}{no -%longer using xspace package} -% -% Define the macro to format the |st|, |nd|, |rd| or |th| of an -% ordinal. -%\begin{macro}{\fmtord} -% \begin{macrocode} -\providecommand*{\fmtord}[1]{\textsuperscript{#1}} -% \end{macrocode} -%\end{macro} -%\begin{macro}{\padzeros} -%\begin{definition} -%\cs{padzeroes}\oarg{n} -%\end{definition} -% Specifies how many digits should be displayed for commands such as -% \cs{decimal} and \cs{binary}. -% \begin{macrocode} -\newcount\c@padzeroesN -\c@padzeroesN=1\relax -\providecommand*{\padzeroes}[1][17]{\c@padzeroesN=#1} -% \end{macrocode} -%\end{macro} -% Load appropriate language definition files: -%\changes{v1.1}{14 June 2007}{added check for UKenglish, -% british and USenglish babel settings} -% \begin{macrocode} -\@ifundefined{l@english}{}{\input{fc-english.def}} -\@ifundefined{l@UKenglish}{}{\input{fc-UKenglish.def}} -\@ifundefined{l@british}{}{\input{fc-british.def}} -\@ifundefined{l@USenglish}{}{\input{fc-USenglish.def}} -\@ifundefined{l@spanish}{}{\input{fc-spanish.def}} -\@ifundefined{l@portuges}{}{\input{fc-portuges.def}} -\@ifundefined{l@french}{}{\input{fc-french.def}} -\@ifundefined{l@german}{% -\@ifundefined{l@ngerman}{}{\input{fc-german.def}}}{% -\input{fc-german.def}} -% \end{macrocode} -%\begin{macro}{\fmtcount@french} -% Define keys for use with |\fmtcountsetoptions|. -% Key to switch French dialects (Does babel store -%this kind of information?) -% \begin{macrocode} -\def\fmtcount@french{france} -\define@key{fmtcount}{french}[france]{% -\@ifundefined{datefrench}{% -\PackageError{fmtcount}{Language `french' not defined}{You need -to load babel before loading fmtcount}}{ -\ifthenelse{\equal{#1}{france} - \or\equal{#1}{swiss} - \or\equal{#1}{belgian}}{% - \def\fmtcount@french{#1}}{% -\PackageError{fmtcount}{Invalid value `#1' to french key} -{Option `french' can only take the values `france', -`belgian' or `swiss'}} -}} -% \end{macrocode} -%\end{macro} -% Key to determine how to display the ordinal -% \begin{macrocode} -\define@key{fmtcount}{fmtord}{% -\ifthenelse{\equal{#1}{level} - \or\equal{#1}{raise} - \or\equal{#1}{user}}{ - \def\fmtcount@fmtord{#1}}{% -\PackageError{fmtcount}{Invalid value `#1' to fmtord key} -{Option `fmtord' can only take the values `level', `raise' -or `user'}}} -% \end{macrocode} -%\begin{macro}{\iffmtord@abbrv} -% Key to determine whether the ordinal should be abbreviated -% (language dependent, currently only affects French ordinals.) -% \begin{macrocode} -\newif\iffmtord@abbrv -\fmtord@abbrvfalse -\define@key{fmtcount}{abbrv}[true]{% -\ifthenelse{\equal{#1}{true}\or\equal{#1}{false}}{ - \csname fmtord@abbrv#1\endcsname}{% -\PackageError{fmtcount}{Invalid value `#1' to fmtord key} -{Option `fmtord' can only take the values `true' or -`false'}}} -% \end{macrocode} -%\end{macro} -%\begin{macro}{\fmtcountsetoptions} -% Define command to set options. -% \begin{macrocode} -\newcommand*{\fmtcountsetoptions}[1]{% -\def\fmtcount@fmtord{}% -\setkeys{fmtcount}{#1}% -\@ifundefined{datefrench}{}{% -\edef\@ordinalstringMfrench{\noexpand -\csname @ordinalstringMfrench\fmtcount@french\noexpand\endcsname}% -\edef\@ordinalstringFfrench{\noexpand -\csname @ordinalstringFfrench\fmtcount@french\noexpand\endcsname}% -\edef\@OrdinalstringMfrench{\noexpand -\csname @OrdinalstringMfrench\fmtcount@french\noexpand\endcsname}% -\edef\@OrdinalstringFfrench{\noexpand -\csname @OrdinalstringFfrench\fmtcount@french\noexpand\endcsname}% -\edef\@numberstringMfrench{\noexpand -\csname @numberstringMfrench\fmtcount@french\noexpand\endcsname}% -\edef\@numberstringFfrench{\noexpand -\csname @numberstringFfrench\fmtcount@french\noexpand\endcsname}% -\edef\@NumberstringMfrench{\noexpand -\csname @NumberstringMfrench\fmtcount@french\noexpand\endcsname}% -\edef\@NumberstringFfrench{\noexpand -\csname @NumberstringFfrench\fmtcount@french\noexpand\endcsname}% -}% -% -\ifthenelse{\equal{\fmtcount@fmtord}{level}}{% -\renewcommand{\fmtord}[1]{##1}}{% -\ifthenelse{\equal{\fmtcount@fmtord}{raise}}{% -\renewcommand{\fmtord}[1]{\textsuperscript{##1}}}{% -}} -} -% \end{macrocode} -%\end{macro} -% Load confguration file if it exists. This needs to be done -% before the package options, to allow the user to override -% the settings in the configuration file. -% \begin{macrocode} -\InputIfFileExists{fmtcount.cfg}{% -\typeout{Using configuration file fmtcount.cfg}}{% -\typeout{No configuration file fmtcount.cfg found.}} -% \end{macrocode} -%Declare options -% \begin{macrocode} -\DeclareOption{level}{\def\fmtcount@fmtord{level}% -\def\fmtord#1{#1}} -\DeclareOption{raise}{\def\fmtcount@fmtord{raise}% -\def\fmtord#1{\textsuperscript{#1}}} -% \end{macrocode} -% Process package options -% \begin{macrocode} -\ProcessOptions -% \end{macrocode} -%\begin{macro}{\@modulo} -%\begin{definition} -%\cs{@modulo}\marg{count reg}\marg{n} -%\end{definition} -% Sets the count register to be its value modulo \meta{n}. -% This is used for the -% date, time, ordinal and numberstring commands. (The fmtcount -% package was originally part of the datetime package.) -% \begin{macrocode} -\newcount\@DT@modctr -\def\@modulo#1#2{% -\@DT@modctr=#1\relax -\divide \@DT@modctr by #2\relax -\multiply \@DT@modctr by #2\relax -\advance #1 by -\@DT@modctr} -% \end{macrocode} -%\end{macro} -% The following registers are needed by |\@ordinal| etc -% \begin{macrocode} -\newcount\@ordinalctr -\newcount\@orgargctr -\newcount\@strctr -\newcount\@tmpstrctr -% \end{macrocode} -%Define commands that display numbers in different bases. -% Define counters and conditionals needed. -% \begin{macrocode} -\newif\if@DT@padzeroes -\newcount\@DT@loopN -\newcount\@DT@X -% \end{macrocode} -%\begin{macro}{\binarynum} -% Converts a decimal number to binary, and display. -% \begin{macrocode} -\newcommand*{\@binary}[1]{% -\@DT@padzeroestrue -\@DT@loopN=17\relax -\@strctr=\@DT@loopN -\whiledo{\@strctr<\c@padzeroesN}{0\advance\@strctr by 1}% -\@strctr=65536\relax -\@DT@X=#1\relax -\loop -\@DT@modctr=\@DT@X -\divide\@DT@modctr by \@strctr -\ifthenelse{\boolean{@DT@padzeroes} \and \(\@DT@modctr=0\) \and \(\@DT@loopN>\c@padzeroesN\)}{}{\the\@DT@modctr}% -\ifnum\@DT@modctr=0\else\@DT@padzeroesfalse\fi -\multiply\@DT@modctr by \@strctr -\advance\@DT@X by -\@DT@modctr -\divide\@strctr by 2\relax -\advance\@DT@loopN by -1\relax -\ifnum\@strctr>1 -\repeat -\the\@DT@X} - -\let\binarynum=\@binary -% \end{macrocode} -%\end{macro} -%\begin{macro}{\octalnum} -% Converts a decimal number to octal, and displays. -% \begin{macrocode} -\newcommand*{\@octal}[1]{% -\ifnum#1>32768 -\PackageError{fmtcount}{Value of counter too large for \protect\@octal}{Maximum value 32768} -\else -\@DT@padzeroestrue -\@DT@loopN=6\relax -\@strctr=\@DT@loopN -\whiledo{\@strctr<\c@padzeroesN}{0\advance\@strctr by 1}% -\@strctr=32768\relax -\@DT@X=#1\relax -\loop -\@DT@modctr=\@DT@X -\divide\@DT@modctr by \@strctr -\ifthenelse{\boolean{@DT@padzeroes} \and \(\@DT@modctr=0\) \and \(\@DT@loopN>\c@padzeroesN\)}{}{\the\@DT@modctr}% -\ifnum\@DT@modctr=0\else\@DT@padzeroesfalse\fi -\multiply\@DT@modctr by \@strctr -\advance\@DT@X by -\@DT@modctr -\divide\@strctr by 8\relax -\advance\@DT@loopN by -1\relax -\ifnum\@strctr>1 -\repeat -\the\@DT@X -\fi} -\let\octalnum=\@octal -% \end{macrocode} -%\end{macro} -%\begin{macro}{\hexadecimalnum} -% Converts a decimal number to a lowercase hexadecimal number, -% and displays it. -% \begin{macrocode} -\newcommand*{\@@hexadecimal}[1]{\ifcase#10\or1\or2\or3\or4\or5\or -6\or7\or8\or9\or a\or b\or c\or d\or e\or f\fi} - -\newcommand*{\@hexadecimal}[1]{% -\@DT@padzeroestrue -\@DT@loopN=5\relax -\@strctr=\@DT@loopN -\whiledo{\@strctr<\c@padzeroesN}{0\advance\@strctr by 1}% -\@strctr=65536\relax -\@DT@X=#1\relax -\loop -\@DT@modctr=\@DT@X -\divide\@DT@modctr by \@strctr -\ifthenelse{\boolean{@DT@padzeroes}\and\(\@DT@modctr=0\)\and -\(\@DT@loopN>\c@padzeroesN\)}{}{\@@hexadecimal\@DT@modctr}% -\ifnum\@DT@modctr=0\else\@DT@padzeroesfalse\fi -\multiply\@DT@modctr by \@strctr -\advance\@DT@X by -\@DT@modctr -\divide\@strctr by 16\relax -\advance\@DT@loopN by -1\relax -\ifnum\@strctr>1 -\repeat -\@@hexadecimal\@DT@X} - -\let\hexadecimalnum=\@hexadecimal -% \end{macrocode} -%\end{macro} -%\begin{macro}{\Hexadecimalnum} -% Uppercase hexadecimal -% \begin{macrocode} -\newcommand*{\@@Hexadecimal}[1]{\ifcase#10\or1\or2\or3\or4\or5\or6\or -7\or8\or9\or A\or B\or C\or D\or E\or F\fi} - -\newcommand*{\@Hexadecimal}[1]{% -\@DT@padzeroestrue -\@DT@loopN=5\relax -\@strctr=\@DT@loopN -\whiledo{\@strctr<\c@padzeroesN}{0\advance\@strctr by 1}% -\@strctr=65536\relax -\@DT@X=#1\relax -\loop -\@DT@modctr=\@DT@X -\divide\@DT@modctr by \@strctr -\ifthenelse{\boolean{@DT@padzeroes} \and \(\@DT@modctr=0\) \and \(\@DT@loopN>\c@padzeroesN\)}{}{\@@Hexadecimal\@DT@modctr}% -\ifnum\@DT@modctr=0\else\@DT@padzeroesfalse\fi -\multiply\@DT@modctr by \@strctr -\advance\@DT@X by -\@DT@modctr -\divide\@strctr by 16\relax -\advance\@DT@loopN by -1\relax -\ifnum\@strctr>1 -\repeat -\@@Hexadecimal\@DT@X} - -\let\Hexadecimalnum=\@Hexadecimal -% \end{macrocode} -%\end{macro} -%\begin{macro}{\aaalphnum} -% Lowercase alphabetical representation (a \ldots\ z aa \ldots\ zz) -% \begin{macrocode} -\newcommand*{\@aaalph}[1]{% -\@DT@loopN=#1\relax -\advance\@DT@loopN by -1\relax -\divide\@DT@loopN by 26\relax -\@DT@modctr=\@DT@loopN -\multiply\@DT@modctr by 26\relax -\@DT@X=#1\relax -\advance\@DT@X by -1\relax -\advance\@DT@X by -\@DT@modctr -\advance\@DT@loopN by 1\relax -\advance\@DT@X by 1\relax -\loop -\@alph\@DT@X -\advance\@DT@loopN by -1\relax -\ifnum\@DT@loopN>0 -\repeat -} - -\let\aaalphnum=\@aaalph -% \end{macrocode} -%\end{macro} -%\begin{macro}{\AAAlphnum} -% Uppercase alphabetical representation (a \ldots\ z aa \ldots\ zz) -% \begin{macrocode} -\newcommand*{\@AAAlph}[1]{% -\@DT@loopN=#1\relax -\advance\@DT@loopN by -1\relax -\divide\@DT@loopN by 26\relax -\@DT@modctr=\@DT@loopN -\multiply\@DT@modctr by 26\relax -\@DT@X=#1\relax -\advance\@DT@X by -1\relax -\advance\@DT@X by -\@DT@modctr -\advance\@DT@loopN by 1\relax -\advance\@DT@X by 1\relax -\loop -\@Alph\@DT@X -\advance\@DT@loopN by -1\relax -\ifnum\@DT@loopN>0 -\repeat -} - -\let\AAAlphnum=\@AAAlph -% \end{macrocode} -%\end{macro} -%\begin{macro}{\abalphnum} -% Lowercase alphabetical representation -% \begin{macrocode} -\newcommand*{\@abalph}[1]{% -\ifnum#1>17576\relax -\PackageError{fmtcount}{Value of counter too large for -\protect\@abalph}{Maximum value 17576}% -\else -\@DT@padzeroestrue -\@strctr=17576\relax -\@DT@X=#1\relax -\advance\@DT@X by -1\relax -\loop -\@DT@modctr=\@DT@X -\divide\@DT@modctr by \@strctr -\ifthenelse{\boolean{@DT@padzeroes}\and -\(\@DT@modctr=1\)}{}{\@alph\@DT@modctr}% -\ifnum\@DT@modctr=1\else\@DT@padzeroesfalse\fi -\multiply\@DT@modctr by \@strctr -\advance\@DT@X by -\@DT@modctr -\divide\@strctr by 26\relax -\ifnum\@strctr>1 -\repeat -\advance\@DT@X by 1\relax -\@alph\@DT@X -\fi} - -\let\abalphnum=\@abalph -% \end{macrocode} -%\end{macro} -%\begin{macro}{\ABAlphnum} -% Uppercase alphabetical representation -% \begin{macrocode} -\newcommand*{\@ABAlph}[1]{% -\ifnum#1>17576\relax -\PackageError{fmtcount}{Value of counter too large for -\protect\@ABAlph}{Maximum value 17576}% -\else -\@DT@padzeroestrue -\@strctr=17576\relax -\@DT@X=#1\relax -\advance\@DT@X by -1\relax -\loop -\@DT@modctr=\@DT@X -\divide\@DT@modctr by \@strctr -\ifthenelse{\boolean{@DT@padzeroes}\and -\(\@DT@modctr=1\)}{}{\@Alph\@DT@modctr}% -\ifnum\@DT@modctr=1\else\@DT@padzeroesfalse\fi -\multiply\@DT@modctr by \@strctr -\advance\@DT@X by -\@DT@modctr -\divide\@strctr by 26\relax -\ifnum\@strctr>1 -\repeat -\advance\@DT@X by 1\relax -\@Alph\@DT@X -\fi} - -\let\ABAlphnum=\@ABAlph -% \end{macrocode} -%\end{macro} -%\begin{macro}{\@fmtc@count} -% Recursive command to count number of characters in argument. -% |\@strctr| should be set to zero before calling it. -% \begin{macrocode} -\def\@fmtc@count#1#2\relax{% -\if\relax#1 -\else -\advance\@strctr by 1\relax -\@fmtc@count#2\relax -\fi} -% \end{macrocode} -%\end{macro} -%\begin{macro}{\@decimal} -% Format number as a decimal, possibly padded with zeroes in front. -% \begin{macrocode} -\newcommand{\@decimal}[1]{% -\@strctr=0\relax -\expandafter\@fmtc@count\number#1\relax -\@DT@loopN=\c@padzeroesN -\advance\@DT@loopN by -\@strctr -\ifnum\@DT@loopN>0\relax -\@strctr=0\relax -\whiledo{\@strctr < \@DT@loopN}{0\advance\@strctr by 1}% -\fi -\number#1\relax -} - -\let\decimalnum=\@decimal -% \end{macrocode} -%\end{macro} -%\begin{macro}{\FCordinal} -%\begin{definition} -%\cs{FCordinal}\marg{number} -%\end{definition} -% This is a bit cumbersome. Previously \cs{@ordinal} -% was defined in a similar way to \cs{abalph} etc. -% This ensured that the actual value of the counter was -% written in the new label stuff in the .aux file. However -% adding in an optional argument to determine the gender -% for multilingual compatibility messed things up somewhat. -% This was the only work around I could get to keep the -% the cross-referencing stuff working, which is why -% the optional argument comes \emph{after} the compulsory -% argument, instead of the usual manner of placing it before. -% Note however, that putting the optional argument means that -% any spaces will be ignored after the command if the optional -% argument is omitted. -% Version 1.04 changed \cs{ordinal} to \cs{FCordinal} -% to prevent it clashing with the memoir class. -% \begin{macrocode} -\newcommand{\FCordinal}[1]{% -\expandafter\protect\expandafter\ordinalnum{% -\expandafter\the\csname c@#1\endcsname}} -% \end{macrocode} -%\end{macro} -%\begin{macro}{\ordinal} -% If \cs{ordinal} isn't defined make \cs{ordinal} a synonym -% for \cs{FCordinal} to maintain compatibility with previous -% versions. -% \begin{macrocode} -\@ifundefined{ordinal}{\let\ordinal\FCordinal}{% -\PackageWarning{fmtcount}{\string\ordinal -\space already defined use \string\FCordinal \space instead.}} -% \end{macrocode} -%\end{macro} -%\begin{macro}{\ordinalnum} -% Display ordinal where value is given as a number or -% count register instead of a counter: -% \begin{macrocode} -\newcommand*{\ordinalnum}[1]{\@ifnextchar[{\@ordinalnum{#1}}{% -\@ordinalnum{#1}[m]}} -% \end{macrocode} -%\end{macro} -%\begin{macro}{\@ordinalnum} -% Display ordinal according to gender (neuter added in v1.1, -% \cs{xspace} added in v1.2, and removed in v1.3\footnote{I -%couldn't get it to work consistently both with and without the -%optional argument}): -% \begin{macrocode} -\def\@ordinalnum#1[#2]{{% -\ifthenelse{\equal{#2}{f}}{% - \protect\@ordinalF{#1}{\@fc@ordstr}% - }{% - \ifthenelse{\equal{#2}{n}}{% - \protect\@ordinalN{#1}{\@fc@ordstr}% - }{% - \ifthenelse{\equal{#2}{m}}{}{% - \PackageError{fmtcount}{Invalid gender option `#2'}{% - Available options are m, f or n}% - }% - \protect\@ordinalM{#1}{\@fc@ordstr}% - }% - }% -\@fc@ordstr -}} -% \end{macrocode} -%\end{macro} -%\begin{macro}{\storeordinal} -% Store the ordinal (first argument -% is identifying name, second argument is a counter.) -% \begin{macrocode} -\newcommand*{\storeordinal}[2]{% -\expandafter\protect\expandafter\storeordinalnum{#1}{% -\expandafter\the\csname c@#2\endcsname}} -% \end{macrocode} -%\end{macro} -%\begin{macro}{\storeordinalnum} -% Store ordinal (first argument -% is identifying name, second argument is a number or -% count register.) -% \begin{macrocode} -\newcommand*{\storeordinalnum}[2]{% -\@ifnextchar[{\@storeordinalnum{#1}{#2}}{% -\@storeordinalnum{#1}{#2}[m]}} -% \end{macrocode} -%\end{macro} -%\begin{macro}{\@storeordinalnum} -% Store ordinal according to gender: -% \begin{macrocode} -\def\@storeordinalnum#1#2[#3]{% -\ifthenelse{\equal{#3}{f}}{% -\protect\@ordinalF{#2}{\@fc@ord}}{% -\ifthenelse{\equal{#3}{n}}{% -\protect\@ordinalN{#2}{\@fc@ord}}{% -\ifthenelse{\equal{#3}{m}}{}{% -\PackageError{fmtcount}{Invalid gender option `#3'}{% -Available options are m or f}}% -\protect\@ordinalM{#2}{\@fc@ord}}}% -\expandafter\let\csname @fcs@#1\endcsname\@fc@ord} -% \end{macrocode} -%\end{macro} -%\begin{macro}{\FMCuse} -% Get stored information: -% \begin{macrocode} -\newcommand*{\FMCuse}[1]{\csname @fcs@#1\endcsname} -% \end{macrocode} -%\end{macro} -%\begin{macro}{\ordinalstring} -% Display ordinal as a string (argument is a counter) -% \begin{macrocode} -\newcommand*{\ordinalstring}[1]{% -\expandafter\protect\expandafter\ordinalstringnum{% -\expandafter\the\csname c@#1\endcsname}} -% \end{macrocode} -%\end{macro} -%\begin{macro}{\ordinalstringnum} -% Display ordinal as a string (argument is a count register or -% number.) -% \begin{macrocode} -\newcommand{\ordinalstringnum}[1]{% -\@ifnextchar[{\@ordinal@string{#1}}{\@ordinal@string{#1}[m]}} -% \end{macrocode} -%\end{macro} -%\begin{macro}{\@ordinal@string} -% Display ordinal as a string according to gender. -% \begin{macrocode} -\def\@ordinal@string#1[#2]{{% -\ifthenelse{\equal{#2}{f}}{% -\protect\@ordinalstringF{#1}{\@fc@ordstr}}{% -\ifthenelse{\equal{#2}{n}}{% -\protect\@ordinalstringN{#1}{\@fc@ordstr}}{% -\ifthenelse{\equal{#2}{m}}{}{% -\PackageError{fmtcount}{Invalid gender option `#2' to -\string\ordinalstring}{Available options are m, f or f}}% -\protect\@ordinalstringM{#1}{\@fc@ordstr}}}\@fc@ordstr}} -% \end{macrocode} -%\end{macro} -%\begin{macro}{\storeordinalstring} -% Store textual representation of number. First argument is -% identifying name, second argument is the counter set to the -% required number. -% \begin{macrocode} -\newcommand*{\storeordinalstring}[2]{% -\expandafter\protect\expandafter\storeordinalstringnum{#1}{% -\expandafter\the\csname c@#2\endcsname}} -% \end{macrocode} -%\end{macro} -%\begin{macro}{\storeordinalstringnum} -% Store textual representation of number. First argument is -% identifying name, second argument is a count register or number. -% \begin{macrocode} -\newcommand*{\storeordinalstringnum}[2]{% -\@ifnextchar[{\@store@ordinal@string{#1}{#2}}{% -\@store@ordinal@string{#1}{#2}[m]}} -% \end{macrocode} -%\end{macro} -%\begin{macro}{\@store@ordinal@string} -% Store textual representation of number according to gender. -% \begin{macrocode} -\def\@store@ordinal@string#1#2[#3]{% -\ifthenelse{\equal{#3}{f}}{% -\protect\@ordinalstringF{#2}{\@fc@ordstr}}{% -\ifthenelse{\equal{#3}{n}}{% -\protect\@ordinalstringN{#2}{\@fc@ordstr}}{% -\ifthenelse{\equal{#3}{m}}{}{% -\PackageError{fmtcount}{Invalid gender option `#3' to -\string\ordinalstring}{Available options are m, f or n}}% -\protect\@ordinalstringM{#2}{\@fc@ordstr}}}% -\expandafter\let\csname @fcs@#1\endcsname\@fc@ordstr} -% \end{macrocode} -%\end{macro} -%\begin{macro}{\Ordinalstring} -% Display ordinal as a string with initial letters in upper case -% (argument is a counter) -% \begin{macrocode} -\newcommand*{\Ordinalstring}[1]{% -\expandafter\protect\expandafter\Ordinalstringnum{% -\expandafter\the\csname c@#1\endcsname}} -% \end{macrocode} -%\end{macro} -%\begin{macro}{\Ordinalstringnum} -% Display ordinal as a string with initial letters in upper case -% (argument is a number or count register) -% \begin{macrocode} -\newcommand*{\Ordinalstringnum}[1]{% -\@ifnextchar[{\@Ordinal@string{#1}}{\@Ordinal@string{#1}[m]}} -% \end{macrocode} -%\end{macro} -%\begin{macro}{\@Ordinal@string} -% Display ordinal as a string with initial letters in upper case -% according to gender -% \begin{macrocode} -\def\@Ordinal@string#1[#2]{{% -\ifthenelse{\equal{#2}{f}}{% -\protect\@OrdinalstringF{#1}{\@fc@ordstr}}{% -\ifthenelse{\equal{#2}{n}}{% -\protect\@OrdinalstringN{#1}{\@fc@ordstr}}{% -\ifthenelse{\equal{#2}{m}}{}{% -\PackageError{fmtcount}{Invalid gender option `#2'}{% -Available options are m, f or n}}% -\protect\@OrdinalstringM{#1}{\@fc@ordstr}}}\@fc@ordstr}} -% \end{macrocode} -%\end{macro} -%\begin{macro}{\storeOrdinalstring} -% Store textual representation of number, with initial letters in -% upper case. First argument is identifying name, second argument -% is the counter set to the -% required number. -% \begin{macrocode} -\newcommand*{\storeOrdinalstring}[2]{% -\expandafter\protect\expandafter\storeOrdinalstringnum{#1}{% -\expandafter\the\csname c@#2\endcsname}} -% \end{macrocode} -%\end{macro} -%\begin{macro}{\storeOrdinalstringnum} -% Store textual representation of number, with initial letters in -% upper case. First argument is identifying name, second argument -% is a count register or number. -% \begin{macrocode} -\newcommand*{\storeOrdinalstringnum}[2]{% -\@ifnextchar[{\@store@Ordinal@string{#1}{#2}}{% -\@store@Ordinal@string{#1}{#2}[m]}} -% \end{macrocode} -%\end{macro} -%\begin{macro}{\@store@Ordinal@string} -% Store textual representation of number according to gender, -% with initial letters in upper case. -% \begin{macrocode} -\def\@store@Ordinal@string#1#2[#3]{% -\ifthenelse{\equal{#3}{f}}{% -\protect\@OrdinalstringF{#2}{\@fc@ordstr}}{% -\ifthenelse{\equal{#3}{n}}{% -\protect\@OrdinalstringN{#2}{\@fc@ordstr}}{% -\ifthenelse{\equal{#3}{m}}{}{% -\PackageError{fmtcount}{Invalid gender option `#3'}{% -Available options are m or f}}% -\protect\@OrdinalstringM{#2}{\@fc@ordstr}}}% -\expandafter\let\csname @fcs@#1\endcsname\@fc@ordstr} -% \end{macrocode} -%\end{macro} -% -%\begin{macro}{\storeORDINALstring} -% Store upper case textual representation of ordinal. The first -% argument is identifying name, the second argument is a counter. -% \begin{macrocode} -\newcommand*{\storeORDINALstring}[2]{% -\expandafter\protect\expandafter\storeORDINALstringnum{#1}{% -\expandafter\the\csname c@#2\endcsname}} -% \end{macrocode} -%\end{macro} -%\begin{macro}{\storeORDINALstringnum} -% As above, but the second argument is a count register or a -% number. -% \begin{macrocode} -\newcommand*{\storeORDINALstringnum}[2]{% -\@ifnextchar[{\@store@ORDINAL@string{#1}{#2}}{% -\@store@ORDINAL@string{#1}{#2}[m]}} -% \end{macrocode} -%\end{macro} -%\begin{macro}{\@store@ORDINAL@string} -% Gender is specified as an optional argument at the end. -% \begin{macrocode} -\def\@store@ORDINAL@string#1#2[#3]{% -\ifthenelse{\equal{#3}{f}}{% -\protect\@ordinalstringF{#2}{\@fc@ordstr}}{% -\ifthenelse{\equal{#3}{n}}{% -\protect\@ordinalstringN{#2}{\@fc@ordstr}}{% -\ifthenelse{\equal{#3}{m}}{}{% -\PackageError{fmtcount}{Invalid gender option `#3'}{% -Available options are m or f}}% -\protect\@ordinalstringM{#2}{\@fc@ordstr}}}% -\expandafter\edef\csname @fcs@#1\endcsname{% -\noexpand\MakeUppercase{\@fc@ordstr}}} -% \end{macrocode} -%\end{macro} -%\begin{macro}{\ORDINALstring} -% Display upper case textual representation of an ordinal. The -% argument must be a counter. -% \begin{macrocode} -\newcommand*{\ORDINALstring}[1]{% -\expandafter\protect\expandafter\ORDINALstringnum{% -\expandafter\the\csname c@#1\endcsname}} -% \end{macrocode} -%\end{macro} -%\begin{macro}{\ORDINALstringnum} -% As above, but the argument is a count register or a number. -% \begin{macrocode} -\newcommand*{\ORDINALstringnum}[1]{% -\@ifnextchar[{\@ORDINAL@string{#1}}{\@ORDINAL@string{#1}[m]}} -% \end{macrocode} -%\end{macro} -%\begin{macro}{\@ORDINAL@string} -% Gender is specified as an optional argument at the end. -% \begin{macrocode} -\def\@ORDINAL@string#1[#2]{{% -\ifthenelse{\equal{#2}{f}}{% -\protect\@ordinalstringF{#1}{\@fc@ordstr}}{% -\ifthenelse{\equal{#2}{n}}{% -\protect\@ordinalstringN{#1}{\@fc@ordstr}}{% -\ifthenelse{\equal{#2}{m}}{}{% -\PackageError{fmtcount}{Invalid gender option `#2'}{% -Available options are m, f or n}}% -\protect\@ordinalstringM{#1}{\@fc@ordstr}}}% -\MakeUppercase{\@fc@ordstr}}} -% \end{macrocode} -%\end{macro} -%\begin{macro}{\storenumberstring} -% Convert number to textual respresentation, and store. First -% argument is the identifying name, second argument is a counter -% containing the number. -% \begin{macrocode} -\newcommand*{\storenumberstring}[2]{% -\expandafter\protect\expandafter\storenumberstringnum{#1}{% -\expandafter\the\csname c@#2\endcsname}} -% \end{macrocode} -%\end{macro} -%\begin{macro}{\storenumberstringnum} -% As above, but second argument is a number or count register. -% \begin{macrocode} -\newcommand{\storenumberstringnum}[2]{% -\@ifnextchar[{\@store@number@string{#1}{#2}}{% -\@store@number@string{#1}{#2}[m]}} -% \end{macrocode} -%\end{macro} -%\begin{macro}{\@store@number@string} -% Gender is given as optional argument, \emph{at the end}. -% \begin{macrocode} -\def\@store@number@string#1#2[#3]{% -\ifthenelse{\equal{#3}{f}}{% -\protect\@numberstringF{#2}{\@fc@numstr}}{% -\ifthenelse{\equal{#3}{n}}{% -\protect\@numberstringN{#2}{\@fc@numstr}}{% -\ifthenelse{\equal{#3}{m}}{}{% -\PackageError{fmtcount}{Invalid gender option `#3'}{% -Available options are m, f or n}}% -\protect\@numberstringM{#2}{\@fc@numstr}}}% -\expandafter\let\csname @fcs@#1\endcsname\@fc@numstr} -% \end{macrocode} -%\end{macro} -%\begin{macro}{\numberstring} -% Display textual representation of a number. The argument -% must be a counter. -% \begin{macrocode} -\newcommand*{\numberstring}[1]{% -\expandafter\protect\expandafter\numberstringnum{% -\expandafter\the\csname c@#1\endcsname}} -% \end{macrocode} -%\end{macro} -%\begin{macro}{\numberstringnum} -% As above, but the argument is a count register or a number. -% \begin{macrocode} -\newcommand*{\numberstringnum}[1]{% -\@ifnextchar[{\@number@string{#1}}{\@number@string{#1}[m]}% -} -% \end{macrocode} -%\end{macro} -% -%\begin{macro}{\@number@string} -% Gender is specified as an optional argument \emph{at the end}. -% \begin{macrocode} -\def\@number@string#1[#2]{{% -\ifthenelse{\equal{#2}{f}}{% -\protect\@numberstringF{#1}{\@fc@numstr}}{% -\ifthenelse{\equal{#2}{n}}{% -\protect\@numberstringN{#1}{\@fc@numstr}}{% -\ifthenelse{\equal{#2}{m}}{}{% -\PackageError{fmtcount}{Invalid gender option `#2'}{% -Available options are m, f or n}}% -\protect\@numberstringM{#1}{\@fc@numstr}}}\@fc@numstr}} -% \end{macrocode} -%\end{macro} -%\begin{macro}{\storeNumberstring} -% Store textual representation of number. First argument is -% identifying name, second argument is a counter. -% \begin{macrocode} -\newcommand*{\storeNumberstring}[2]{% -\expandafter\protect\expandafter\storeNumberstringnum{#1}{% -\expandafter\the\csname c@#2\endcsname}} -% \end{macrocode} -%\end{macro} -%\begin{macro}{\storeNumberstringnum} -% As above, but second argument is a count register or number. -% \begin{macrocode} -\newcommand{\storeNumberstringnum}[2]{% -\@ifnextchar[{\@store@Number@string{#1}{#2}}{% -\@store@Number@string{#1}{#2}[m]}} -% \end{macrocode} -%\end{macro} -%\begin{macro}{\@store@Number@string} -% Gender is specified as an optional argument \emph{at the end}: -% \begin{macrocode} -\def\@store@Number@string#1#2[#3]{% -\ifthenelse{\equal{#3}{f}}{% -\protect\@NumberstringF{#2}{\@fc@numstr}}{% -\ifthenelse{\equal{#3}{n}}{% -\protect\@NumberstringN{#2}{\@fc@numstr}}{% -\ifthenelse{\equal{#3}{m}}{}{% -\PackageError{fmtcount}{Invalid gender option `#3'}{% -Available options are m, f or n}}% -\protect\@NumberstringM{#2}{\@fc@numstr}}}% -\expandafter\let\csname @fcs@#1\endcsname\@fc@numstr} -% \end{macrocode} -%\end{macro} -%\begin{macro}{\Numberstring} -% Display textual representation of number. The argument must be -% a counter. -% \begin{macrocode} -\newcommand*{\Numberstring}[1]{% -\expandafter\protect\expandafter\Numberstringnum{% -\expandafter\the\csname c@#1\endcsname}} -% \end{macrocode} -%\end{macro} -%\begin{macro}{\Numberstringnum} -% As above, but the argument is a count register or number. -% \begin{macrocode} -\newcommand*{\Numberstringnum}[1]{% -\@ifnextchar[{\@Number@string{#1}}{\@Number@string{#1}[m]}} -% \end{macrocode} -%\end{macro} -%\begin{macro}{\@Number@string} -% Gender is specified as an optional argument at the end. -% \begin{macrocode} -\def\@Number@string#1[#2]{{% -\ifthenelse{\equal{#2}{f}}{% -\protect\@NumberstringF{#1}{\@fc@numstr}}{% -\ifthenelse{\equal{#2}{n}}{% -\protect\@NumberstringN{#1}{\@fc@numstr}}{% -\ifthenelse{\equal{#2}{m}}{}{% -\PackageError{fmtcount}{Invalid gender option `#2'}{% -Available options are m, f or n}}% -\protect\@NumberstringM{#1}{\@fc@numstr}}}\@fc@numstr}} -% \end{macrocode} -%\end{macro} -%\begin{macro}{\storeNUMBERstring} -% Store upper case textual representation of number. The first -% argument is identifying name, the second argument is a counter. -% \begin{macrocode} -\newcommand{\storeNUMBERstring}[2]{% -\expandafter\protect\expandafter\storeNUMBERstringnum{#1}{% -\expandafter\the\csname c@#2\endcsname}} -% \end{macrocode} -%\end{macro} -%\begin{macro}{\storeNUMBERstringnum} -% As above, but the second argument is a count register or a -% number. -% \begin{macrocode} -\newcommand{\storeNUMBERstringnum}[2]{% -\@ifnextchar[{\@store@NUMBER@string{#1}{#2}}{% -\@store@NUMBER@string{#1}{#2}[m]}} -% \end{macrocode} -%\end{macro} -%\begin{macro}{\@store@NUMBER@string} -% Gender is specified as an optional argument at the end. -% \begin{macrocode} -\def\@store@NUMBER@string#1#2[#3]{% -\ifthenelse{\equal{#3}{f}}{% -\protect\@numberstringF{#2}{\@fc@numstr}}{% -\ifthenelse{\equal{#3}{n}}{% -\protect\@numberstringN{#2}{\@fc@numstr}}{% -\ifthenelse{\equal{#3}{m}}{}{% -\PackageError{fmtcount}{Invalid gender option `#3'}{% -Available options are m or f}}% -\protect\@numberstringM{#2}{\@fc@numstr}}}% -\expandafter\edef\csname @fcs@#1\endcsname{% -\noexpand\MakeUppercase{\@fc@numstr}}} -% \end{macrocode} -%\end{macro} -%\begin{macro}{\NUMBERstring} -% Display upper case textual representation of a number. The -% argument must be a counter. -% \begin{macrocode} -\newcommand*{\NUMBERstring}[1]{% -\expandafter\protect\expandafter\NUMBERstringnum{% -\expandafter\the\csname c@#1\endcsname}} -% \end{macrocode} -%\end{macro} -%\begin{macro}{\NUMBERstringnum} -% As above, but the argument is a count register or a number. -% \begin{macrocode} -\newcommand*{\NUMBERstringnum}[1]{% -\@ifnextchar[{\@NUMBER@string{#1}}{\@NUMBER@string{#1}[m]}} -% \end{macrocode} -%\end{macro} -%\begin{macro}{\@NUMBER@string} -% Gender is specified as an optional argument at the end. -% \begin{macrocode} -\def\@NUMBER@string#1[#2]{{% -\ifthenelse{\equal{#2}{f}}{% -\protect\@numberstringF{#1}{\@fc@numstr}}{% -\ifthenelse{\equal{#2}{n}}{% -\protect\@numberstringN{#1}{\@fc@numstr}}{% -\ifthenelse{\equal{#2}{m}}{}{% -\PackageError{fmtcount}{Invalid gender option `#2'}{% -Available options are m, f or n}}% -\protect\@numberstringM{#1}{\@fc@numstr}}}% -\MakeUppercase{\@fc@numstr}}} -% \end{macrocode} -%\end{macro} -%\begin{macro}{\binary} -% Number representations in other bases. Binary: -% \begin{macrocode} -\providecommand*{\binary}[1]{% -\expandafter\protect\expandafter\@binary{% -\expandafter\the\csname c@#1\endcsname}} -% \end{macrocode} -%\end{macro} -%\begin{macro}{\aaalph} -% Like \verb"\alph", but goes beyond 26. -% (a \ldots\ z aa \ldots zz \ldots) -% \begin{macrocode} -\providecommand*{\aaalph}[1]{% -\expandafter\protect\expandafter\@aaalph{% -\expandafter\the\csname c@#1\endcsname}} -% \end{macrocode} -%\end{macro} -%\begin{macro}{\AAAlph} -% As before, but upper case. -% \begin{macrocode} -\providecommand*{\AAAlph}[1]{% -\expandafter\protect\expandafter\@AAAlph{% -\expandafter\the\csname c@#1\endcsname}} -% \end{macrocode} -%\end{macro} -%\begin{macro}{\abalph} -% Like \verb"\alph", but goes beyond 26. -% (a \ldots\ z ab \ldots az \ldots) -% \begin{macrocode} -\providecommand*{\abalph}[1]{% -\expandafter\protect\expandafter\@abalph{% -\expandafter\the\csname c@#1\endcsname}} -% \end{macrocode} -%\end{macro} -%\begin{macro}{\ABAlph} -% As above, but upper case. -% \begin{macrocode} -\providecommand*{\ABAlph}[1]{% -\expandafter\protect\expandafter\@ABAlph{% -\expandafter\the\csname c@#1\endcsname}} -% \end{macrocode} -%\end{macro} -%\begin{macro}{\hexadecimal} -% Hexadecimal: -% \begin{macrocode} -\providecommand*{\hexadecimal}[1]{% -\expandafter\protect\expandafter\@hexadecimal{% -\expandafter\the\csname c@#1\endcsname}} -% \end{macrocode} -%\end{macro} -%\begin{macro}{\Hexadecimal} -% As above, but in upper case. -% \begin{macrocode} -\providecommand*{\Hexadecimal}[1]{% -\expandafter\protect\expandafter\@Hexadecimal{% -\expandafter\the\csname c@#1\endcsname}} -% \end{macrocode} -%\end{macro} -%\begin{macro}{\octal} -% Octal: -% \begin{macrocode} -\providecommand*{\octal}[1]{% -\expandafter\protect\expandafter\@octal{% -\expandafter\the\csname c@#1\endcsname}} -% \end{macrocode} -%\end{macro} -%\begin{macro}{\decimal} -% Decimal: -% \begin{macrocode} -\providecommand*{\decimal}[1]{% -\expandafter\protect\expandafter\@decimal{% -\expandafter\the\csname c@#1\endcsname}} -% \end{macrocode} -%\end{macro} -% -%\subsubsection{Multilinguage Definitions} -%\begin{macro}{\@setdef@ultfmtcount} -% If multilingual support is provided, make \verb"\@numberstring" -% etc use the correct language (if defined). -% Otherwise use English definitions. "\@setdef@ultfmtcount" -% sets the macros to use English. -% \begin{macrocode} -\def\@setdef@ultfmtcount{ -\@ifundefined{@ordinalMenglish}{\input{fc-english.def}}{} -\def\@ordinalstringM{\@ordinalstringMenglish} -\let\@ordinalstringF=\@ordinalstringMenglish -\let\@ordinalstringN=\@ordinalstringMenglish -\def\@OrdinalstringM{\@OrdinalstringMenglish} -\let\@OrdinalstringF=\@OrdinalstringMenglish -\let\@OrdinalstringN=\@OrdinalstringMenglish -\def\@numberstringM{\@numberstringMenglish} -\let\@numberstringF=\@numberstringMenglish -\let\@numberstringN=\@numberstringMenglish -\def\@NumberstringM{\@NumberstringMenglish} -\let\@NumberstringF=\@NumberstringMenglish -\let\@NumberstringN=\@NumberstringMenglish -\def\@ordinalM{\@ordinalMenglish} -\let\@ordinalF=\@ordinalM -\let\@ordinalN=\@ordinalM -} -% \end{macrocode} -%\end{macro} -%\begin{macro}{\@set@mulitling@fmtcount} -% This defines the number and ordinal string macros to use -% \cs{languagename}: -% \begin{macrocode} -\def\@set@mulitling@fmtcount{% -% \end{macrocode} -% The masculine version of \cs{numberstring}: -% \begin{macrocode} -\def\@numberstringM{\@ifundefined{@numberstringM\languagename}{% -\PackageError{fmtcount}{No support for language '\languagename'}{% -The fmtcount package currently does not support language -'\languagename' for command \string\@numberstringM}}{% -\csname @numberstringM\languagename\endcsname}}% -% \end{macrocode} -% The feminine version of \cs{numberstring}: -% \begin{macrocode} -\def\@numberstringF{\@ifundefined{@numberstringF\languagename}{% -\PackageError{fmtcount}{No support for language '\languagename'}{% -The fmtcount package currently does not support language -'\languagename' for command \string\@numberstringF}}{% -\csname @numberstringF\languagename\endcsname}}% -% \end{macrocode} -% The neuter version of \cs{numberstring}: -% \begin{macrocode} -\def\@numberstringN{\@ifundefined{@numberstringN\languagename}{% -\PackageError{fmtcount}{No support for language '\languagename'}{% -The fmtcount package currently does not support language -'\languagename' for command \string\@numberstringN}}{% -\csname @numberstringN\languagename\endcsname}}% -% \end{macrocode} -% The masculine version of \cs{Numberstring}: -% \begin{macrocode} -\def\@NumberstringM{\@ifundefined{@NumberstringM\languagename}{% -\PackageError{fmtcount}{No support for language '\languagename'}{% -The fmtcount package currently does not support language -'\languagename' for command \string\@NumberstringM}}{% -\csname @NumberstringM\languagename\endcsname}}% -% \end{macrocode} -% The feminine version of \cs{Numberstring}: -% \begin{macrocode} -\def\@NumberstringF{\@ifundefined{@NumberstringF\languagename}{% -\PackageError{fmtcount}{No support for language '\languagename'}{% -The fmtcount package currently does not support language -'\languagename' for command \string\@NumberstringF}}{% -\csname @NumberstringF\languagename\endcsname}}% -% \end{macrocode} -% The neuter version of \cs{Numberstring}: -% \begin{macrocode} -\def\@NumberstringN{\@ifundefined{@NumberstringN\languagename}{% -\PackageError{fmtcount}{No support for language '\languagename'}{% -The fmtcount package currently does not support language -'\languagename' for command \string\@NumberstringN}}{% -\csname @NumberstringN\languagename\endcsname}}% -% \end{macrocode} -% The masculine version of \cs{ordinal}: -% \begin{macrocode} -\def\@ordinalM{\@ifundefined{@ordinalM\languagename}{% -\PackageError{fmtcount}{No support for language '\languagename'}{% -The fmtcount package currently does not support language -'\languagename' for command \string\@ordinalM}}{% -\csname @ordinalM\languagename\endcsname}}% -% \end{macrocode} -% The feminine version of \cs{ordinal}: -% \begin{macrocode} -\def\@ordinalF{\@ifundefined{@ordinalF\languagename}{% -\PackageError{fmtcount}{No support for language '\languagename'}{% -The fmtcount package currently does not support language -'\languagename' for command \string\@ordinalF}}{% -\csname @ordinalF\languagename\endcsname}}% -% \end{macrocode} -% The neuter version of \cs{ordinal}: -% \begin{macrocode} -\def\@ordinalN{\@ifundefined{@ordinalN\languagename}{% -\PackageError{fmtcount}{No support for language '\languagename'}{% -The fmtcount package currently does not support language -'\languagename' for command \string\@ordinalN}}{% -\csname @ordinalN\languagename\endcsname}}% -% \end{macrocode} -% The masculine version of \cs{ordinalstring}: -% \begin{macrocode} -\def\@ordinalstringM{\@ifundefined{@ordinalstringM\languagename}{% -\PackageError{fmtcount}{No support for language '\languagename'}{% -The fmtcount package currently does not support language -'\languagename' for command \string\@ordinalstringM}}{% -\csname @ordinalstringM\languagename\endcsname}}% -% \end{macrocode} -% The feminine version of \cs{ordinalstring}: -% \begin{macrocode} -\def\@ordinalstringF{\@ifundefined{@ordinalstringF\languagename}{% -\PackageError{fmtcount}{No support for language '\languagename'}{% -The fmtcount package currently does not support language -'\languagename' for command \string\@ordinalstringF}}{% -\csname @ordinalstringF\languagename\endcsname}}% -% \end{macrocode} -% The neuter version of \cs{ordinalstring}: -% \begin{macrocode} -\def\@ordinalstringN{\@ifundefined{@ordinalstringN\languagename}{% -\PackageError{fmtcount}{No support for language '\languagename'}{% -The fmtcount package currently does not support language -'\languagename' for command \string\@ordinalstringN}}{% -\csname @ordinalstringN\languagename\endcsname}}% -% \end{macrocode} -% The masculine version of \cs{Ordinalstring}: -% \begin{macrocode} -\def\@OrdinalstringM{\@ifundefined{@OrdinalstringM\languagename}{% -\PackageError{fmtcount}{No support for language '\languagename'}{% -The fmtcount package currently does not support language -'\languagename' for command \string\@OrdinalstringM}}{% -\csname @OrdinalstringM\languagename\endcsname}}% -% \end{macrocode} -% The feminine version of \cs{Ordinalstring}: -% \begin{macrocode} -\def\@OrdinalstringF{\@ifundefined{@OrdinalstringF\languagename}{% -\PackageError{fmtcount}{No support for language '\languagename'}{% -The fmtcount package currently does not support language -'\languagename' for command \string\@OrdinalstringF}}{% -\csname @OrdinalstringF\languagename\endcsname}}% -% \end{macrocode} -% The neuter version of \cs{Ordinalstring}: -% \begin{macrocode} -\def\@OrdinalstringN{\@ifundefined{@OrdinalstringN\languagename}{% -\PackageError{fmtcount}{No support for language '\languagename'}{% -The fmtcount package currently does not support language -'\languagename' for command \string\@OrdinalstringN}}{% -\csname @OrdinalstringN\languagename\endcsname}} -} -% \end{macrocode} -%\end{macro} -% Check to see if babel or ngerman packages have been loaded. -% \begin{macrocode} -\@ifpackageloaded{babel}{% -\ifthenelse{\equal{\languagename}{nohyphenation}\or -\equal{languagename}{english}}{\@setdef@ultfmtcount}{% -\@set@mulitling@fmtcount} -}{% -\@ifpackageloaded{ngerman}{% -\@ifundefined{@numberstringMgerman}{% -\input{fc-german.def}}{}\@set@mulitling@fmtcount}{% -\@setdef@ultfmtcount}} -% \end{macrocode} -% Backwards compatibility: -% \begin{macrocode} -\let\@ordinal=\@ordinalM -\let\@ordinalstring=\@ordinalstringM -\let\@Ordinalstring=\@OrdinalstringM -\let\@numberstring=\@numberstringM -\let\@Numberstring=\@NumberstringM -% \end{macrocode} -%\iffalse -% \begin{macrocode} -%</fmtcount.sty> -% \end{macrocode} -%\fi -%\iffalse -% \begin{macrocode} %<*fmtcount.perl> % \end{macrocode} %\fi @@ -8520,5 +9296,405 @@ sub load_fmtcount_cfg{ %</fmtcount.perl> % \end{macrocode} %\fi +%\iffalse +% \begin{macrocode} +%<*fc-lang.tex> +% \end{macrocode} +%\fi +% \begin{macrocode} + % This is an interactive script. Run it through \LaTeX + % and enter appropriate responses. (This won't work with + % LaTeX2HTML + +\documentclass[a4paper]{article} + +\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} +% \end{macrocode} +%\iffalse +% \begin{macrocode} +%</fc-lang.tex> +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +%<*fc-samp.tex> +% \end{macrocode} +%\fi +% \begin{macrocode} +\documentclass[a4paper]{article} + +\usepackage{fmtcount} +\newcounter{N} + +\padzeroes[5] + +\newcommand{\printrow}[1]{% +\newline +\setcounter{N}{#1} +\makebox[0.75in][r]{\decimal{N}\quad} +\makebox[0.75in][r]{\hexadecimal{N}\quad} +\makebox[0.75in][r]{\ordinal{N}\quad} +\makebox[2in][l]{\numberstring{N}} +} + +\renewcommand{\thesection}{\ordinal{section}} + +\begin{document} + +\section{Displaying the value of a counter} +\label{ex} + +\begin{ttfamily} +\noindent +\makebox[0.75in][c]{decimal} +\makebox[0.75in][c]{hexadecimal} +\makebox[0.75in][c]{ordinal} +numberstring +\printrow{0} +\printrow{1} +\printrow{2} +\printrow{3} +\printrow{4} +\printrow{5} +\printrow{6} +\printrow{7} +\printrow{8} +\printrow{9} +\printrow{10} +\printrow{11} +\printrow{12} +\printrow{13} +\printrow{14} +\printrow{15} +\printrow{16} +\printrow{17} +\printrow{18} +\printrow{19} +\printrow{20} +\printrow{21} +\printrow{22} +\printrow{23} +\printrow{24} +\printrow{25} +\printrow{30} +\printrow{40} +\printrow{50} +\printrow{60} +\printrow{70} +\printrow{71} +\printrow{75} +\printrow{80} +\printrow{81} +\printrow{85} +\printrow{90} +\printrow{91} +\printrow{95} +\printrow{100} +\printrow{101} +\printrow{110} +\printrow{125} +\printrow{150} +\printrow{170} +\printrow{180} +\printrow{190} +\printrow{200} +\printrow{250} +\printrow{300} +\printrow{400} +\printrow{500} +\printrow{600} +\printrow{700} +\printrow{800} +\printrow{900} +\printrow{1000} +\printrow{99999} +\end{ttfamily} + +\section{Cross-Referencing} + +Referencing a label: \ref{ex}. + +Passing numbers explicitly: \ordinalnum{10}, +\Numberstringnum{10}, \NUMBERstringnum{10}, \Ordinalstringnum{10}, +\ORDINALstringnum{10}. + +\end{document} +% \end{macrocode} +%\iffalse +% \begin{macrocode} +%</fc-samp.tex> +% \end{macrocode} +%\fi %\Finale \endinput |