summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/fmtcount
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2012-09-25 22:58:08 +0000
committerKarl Berry <karl@freefriends.org>2012-09-25 22:58:08 +0000
commit5972810af729299af222498461a459998df88906 (patch)
treef32df205f6b61c129fda672be1edd763854cafc8 /Master/texmf-dist/source/latex/fmtcount
parentd21e43ac989ba93e0f327fc32fd99f3b1c3f0c6e (diff)
fmtcount (25sep12)
git-svn-id: svn://tug.org/texlive/trunk@27805 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/fmtcount')
-rw-r--r--Master/texmf-dist/source/latex/fmtcount/fmtcount.dtx9941
-rw-r--r--Master/texmf-dist/source/latex/fmtcount/fmtcount.ins29
-rw-r--r--Master/texmf-dist/source/latex/fmtcount/fmtcount.perl10
3 files changed, 4365 insertions, 5615 deletions
diff --git a/Master/texmf-dist/source/latex/fmtcount/fmtcount.dtx b/Master/texmf-dist/source/latex/fmtcount/fmtcount.dtx
index 0fbf2f94beb..8315fcf4777 100644
--- a/Master/texmf-dist/source/latex/fmtcount/fmtcount.dtx
+++ b/Master/texmf-dist/source/latex/fmtcount/fmtcount.dtx
@@ -1,19 +1,12 @@
%\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 "(.+)\.(sty)=>\1.\2"
% -src "(.+)\.(def)=>\1.\2"
-% -src "(fmtcount\.perl)=>\1"
-% -src "(fc-.+\.tex\Z)=>\1"
% -doc "fmtcount-manual.tex"
% -author "Nicola Talbot"
-% -dir "source"
% fmtcount
-% Created on 2009/10/2 18:35
+% Created on 2012/9/25 10:12
%\fi
%\iffalse
%<*package>
@@ -36,13 +29,22 @@
%\fi
% \iffalse
% Doc-Source file to use with LaTeX2e
-% Copyright (C) 2009 Nicola Talbot, all rights reserved.
+% Copyright (C) 2012 Nicola Talbot, all rights reserved.
% \fi
% \iffalse
%<*driver>
-\documentclass{ltxdoc}
+\documentclass{nlctdoc}
\usepackage{color}
+\usepackage[utf8]{inputenc}
+\usepackage[french,english]{babel}
+\usepackage{amsmath,amssymb}
+\usepackage{tabularx,supertabular,multirow}
+\usepackage[T1]{fontenc}
+\usepackage{cmap}
+\newcommand*\uref[1]{\href{#1}{#1}}
+\DeclareMathOperator{\intv}{..}
+\newcommand*\interface{}
\usepackage[colorlinks,
bookmarks,
bookmarksopen,
@@ -50,29 +52,11 @@
pdftitle={fmtcount.sty: Displaying the Values of LaTeX Counters},
pdfkeywords={LaTeX,counter}]{hyperref}
-\definecolor{defbackground}{rgb}{1,1,0.75}
-\newsavebox\defsbox
-\newlength\defwidth
-\newenvironment{definition}{%
-\setlength{\fboxsep}{4pt}\setlength{\fboxrule}{1.25pt}%
-\begin{lrbox}{\defsbox}%
-\setlength\defwidth\linewidth
-\addtolength\defwidth{-2\fboxrule}%
-\addtolength\defwidth{-2\fboxsep}%
-\begin{minipage}{\defwidth}\flushleft
-}{%
-\end{minipage}
-\end{lrbox}%
-\vskip10pt
-\noindent
-\fcolorbox{black}{defbackground}{\usebox\defsbox}%
-\vskip10pt
-}
+\CheckSum{9034}
+\doxitem{Option}{option}{options}
-\newcommand{\sty}[1]{\textsf{#1}}\newcommand{\cls}[1]{\textsf{#1}}
-\CheckSum{9371}
-\OnlyDescription
+\newlength{\tabcolwidth}
\begin{document}
\DocInput{fmtcount.dtx}
@@ -81,19 +65,19 @@
%\fi
%\RecordChanges
%
-% \title{fmtcount.sty v1.31: Displaying the Values of
+% \title{fmtcount.sty: Displaying the Values of
%\LaTeX\ Counters}
-% \author{Nicola L.C. Talbot\\[10pt]
-% School of Computing Sciences\\
-% University of East Anglia\\
-% Norwich. NR4 7TJ.\\
-% United Kingdom.\\
-% \url{http://theoval.cmp.uea.ac.uk/~nlct/}}
-% \date{2nd October 2009}
+% \author{Nicola L.C. Talbot\\
+% \url{www.dickimaw-books.com}
+% \and
+% Vincent Belaïche}
+% \date{2012-06-18 (version 2.0)\relax
+%}
% \maketitle
% \tableofcontents
% \section{Introduction}
-%The \sty{fmtcount} package provides commands to display
+%
+%The \styfmt{fmtcount} package provides commands to display
%the values of \LaTeX\ counters in a variety of formats. It also
%provides equivalent commands for actual numbers rather than
%counter names. Limited multilingual support is available.
@@ -101,42 +85,22 @@
%Belgian and Swiss variations), Spanish, Portuguese, German and
%Italian.
%
-%\section{Installation}
-%
-%This package is distributed with the files \texttt{fmtcount.dtx}
-%and \texttt{fmtcount.ins}. To extract the code do:
-%\begin{verbatim}
-%latex fmtcount.ins
-%\end{verbatim}
-%This will create the files \texttt{fmtcount.sty} and
-%\texttt{fmtcount.perl}, along with several \texttt{.def} files.
-%Place \texttt{fmtcount.sty} and the \texttt{.def} files somewhere
-%where \LaTeX\ will find them (e.g.\
-%\texttt{texmf/tex/latex/fmtcount/}) and place \texttt{fmtcount.perl}
-%somewhere where \LaTeX2HTML
-%will find it (e.g.\ \texttt{latex2html/styles}). Remember to refresh
-%the \TeX\ database (using \texttt{texhash} or \texttt{mktexlsr}
-%under Linux, for
-%other operating systems check the manual.)
-%
%\section{Available Commands}
%
%The commands can be divided into two categories: those that
%take the name of a counter as the argument, and those
%that take a number as the argument.
%
-% \DescribeMacro{\ordinal}
-%\begin{definition}
+%\begin{definition}[\DescribeMacro{\ordinal}]
%\cs{ordinal}\marg{counter}\oarg{gender}
%\end{definition}
-% This will print the value of a \LaTeX\ counter \meta{counter} as an
+%This will print the value of a \LaTeX\ counter \meta{counter} as an
%ordinal, where the macro
-%\DescribeMacro{\fmtord}
-%\begin{definition}
+%\begin{definition}[\DescribeMacro{\fmtord}]
%\cs{fmtord}\marg{text}
%\end{definition}
%is used to format the st, nd, rd, th bit. By default the ordinal is
-%formatted as a superscript, if the package option \texttt{level} is
+%formatted as a superscript, if the package option \pkgopt{level} is
%used, it is level with the text. For example, if the current section
%is 3, then \verb"\ordinal{section}" will produce the output:
%3\textsuperscript{rd}. Note that the optional argument \meta{gender}
@@ -151,9 +115,12 @@
%\item the \cls{memoir} class also defines a command called
%\cs{ordinal} which takes a number as an argument instead of a
%counter. In order to overcome this incompatiblity, if you want
-%to use the \sty{fmtcount} package with the \cls{memoir} class
-%you should use \DescribeMacro{\FCordinal}\cs{FCordinal} to access
-%\sty{fmtcount}'s version of \cs{ordinal}, and use
+%to use the \styfmt{fmtcount} package with the \cls{memoir} class
+%you should use
+%\begin{definition}[\DescribeMacro{\FCordinal}]
+%\cs{FCordinal}
+%\end{definition}
+%to access \styfmt{fmtcount}'s version of \cs{ordinal}, and use
%\cs{ordinal} to use \cls{memoir}'s version of that command.
%
%\item As with all commands which have an optional argument as the
@@ -166,32 +133,29 @@
%3\textsuperscript{rd} !
%\end{enumerate}
%
-%\DescribeMacro{\ordinalnum}
-%\begin{definition}
+%The commands below only work for numbers in the range 0~to~99999.
+%\begin{definition}[\DescribeMacro{\ordinalnum}]
%\cs{ordinalnum}\marg{n}\oarg{gender}
%\end{definition}
%This is like \cs{ordinal} but takes an actual number rather than a
%counter as the argument. For example: \verb"\ordinalnum{3}" will
%produce: 3\textsuperscript{rd}.
%
-% \DescribeMacro{\numberstring}
-%\begin{definition}
+%\begin{definition}[\DescribeMacro{\numberstring}]
%\cs{numberstring}\marg{counter}\oarg{gender}
%\end{definition}
%This will print the value of \meta{counter} as text. E.g.\
%\verb"\numberstring{section}" will produce: three. The optional
%argument is the same as that for \cs{ordinal}.
%
-% \DescribeMacro{\Numberstring}
-%\begin{definition}
+%\begin{definition}[\DescribeMacro{\Numberstring}]
%\cs{Numberstring}\marg{counter}\oarg{gender}
%\end{definition}
%This does the same as \cs{numberstring}, but with initial letters in
%uppercase. For example, \verb"\Numberstring{section}" will produce:
%Three.
%
-%\DescribeMacro{\NUMBERstring}
-%\begin{definition}
+%\begin{definition}[\DescribeMacro{\NUMBERstring}]
%\cs{NUMBERstring}\marg{counter}\oarg{gender}
%\end{definition}
%This does the same as \cs{numberstring}, but converts the string to
@@ -201,16 +165,13 @@
%argument\footnote{See all the various postings to
%\texttt{comp.text.tex} about \cs{MakeUppercase}}.
%
-%\DescribeMacro{\numberstringnum}
-%\begin{definition}
+%\begin{definition}[\DescribeMacro{\numberstringnum}]
%\cs{numberstringnum}\marg{n}\oarg{gender}
%\end{definition}
-%\DescribeMacro{\Numberstringnum}
-%\begin{definition}
+%\begin{definition}[\DescribeMacro{\Numberstringnum}]
%\cs{Numberstringnum}\marg{n}\oarg{gender}
%\end{definition}
-%\DescribeMacro{\NUMBERstringnum}
-%\begin{definition}
+%\begin{definition}[\DescribeMacro{\NUMBERstringnum}]
%\cs{NUMBERstringnum}\marg{n}\oarg{gender}
%\end{definition}
%Theses macros work like
@@ -219,39 +180,33 @@
%rather than a counter as the argument. For example:
%\verb'\Numberstringnum{105}' will produce: One Hundred and Five.
%
-% \DescribeMacro{\ordinalstring}
-%\begin{definition}
+%\begin{definition}[\DescribeMacro{\ordinalstring}]
%\cs{ordinalstring}\marg{counter}\oarg{gender}
%\end{definition}
%This will print the value of \meta{counter} as a textual ordinal.
%E.g.\ \verb"\ordinalstring{section}" will produce: third. The
%optional argument is the same as that for \cs{ordinal}.
%
-% \DescribeMacro{\Ordinalstring}
-%\begin{definition}
+%\begin{definition}[\DescribeMacro{\Ordinalstring}]
%\cs{Ordinalstring}\marg{counter}\oarg{gender}
%\end{definition}
%This does the same as \cs{ordinalstring}, but with initial letters in
%uppercase. For example, \verb"\Ordinalstring{section}" will produce:
%Third.
%
-%\DescribeMacro{\ORDINALstring}
-%\begin{definition}
+%\begin{definition}[\DescribeMacro{\ORDINALstring}]
%\cs{ORDINALstring}\marg{counter}\oarg{gender}
%\end{definition}
%This does the same as \cs{ordinalstring}, but with all words in upper
%case (see previous note about \cs{MakeUppercase}).
%
-%\DescribeMacro{\ordinalstringnum}
-%\begin{definition}
+%\begin{definition}[\DescribeMacro{\ordinalstringnum}]
%\cs{ordinalstringnum}\marg{n}\oarg{gender}
%\end{definition}
-%\DescribeMacro{\Ordinalstringnum}
-%\begin{definition}
+%\begin{definition}[\DescribeMacro{\Ordinalstringnum}]
%\cs{Ordinalstringnum}\marg{n}\oarg{gender}
%\end{definition}
-%\DescribeMacro{\ORDINALstringnum}
-%\begin{definition}
+%\begin{definition}[\DescribeMacro{\ORDINALstringnum}]
%\cs{ORDINALstringnum}\marg{n}\oarg{gender}
%\end{definition}
%These macros work like \cs{ordinalstring}, \cs{Ordinalstring} and
@@ -268,100 +223,96 @@
%the other arguments are as the analogous commands above. These
%commands do not display anything, but store the textual
%representation. This can later be retrieved using
-%\DescribeMacro{\FMCuse}
-%\begin{definition}
+%
+%\begin{definition}[\DescribeMacro{\FMCuse}]
%\cs{FMCuse}\marg{label}
%\end{definition}
+%
+%\begin{important}
%Note: with \cs{storeordinal} and \cs{storeordinalnum}, the
%only bit that doesn't get expanded is \cs{fmtord}. So, for
%example, \verb"\storeordinalnum{mylabel}{3}" will be stored as
%\verb"3\relax \fmtord{rd}".
+%\end{important}
%
-%\DescribeMacro{\storeordinal}
-%\begin{definition}
+%\begin{definition}[\DescribeMacro{\storeordinal}]
%\cs{storeordinal}\marg{label}\marg{counter}\oarg{gender}
%\end{definition}
-%\DescribeMacro{\storeordinalstring}
-%\begin{definition}
+%
+%\begin{definition}[\DescribeMacro{\storeordinalstring}]
%\cs{storeordinalstring}\marg{label}\marg{counter}\oarg{gender}
%\end{definition}
-%\DescribeMacro{\storeOrdinalstring}
-%\begin{definition}
+%
+%\begin{definition}[\DescribeMacro{\storeOrdinalstring}]
%\cs{storeOrdinalstring}\marg{label}\marg{counter}\oarg{gender}
%\end{definition}
-%\par
-%\DescribeMacro{\storeORDINALstring}
-%\begin{definition}
+%
+%
+%\begin{definition}[\DescribeMacro{\storeORDINALstring}]
%\cs{storeORDINALstring}\marg{label}\marg{counter}\oarg{gender}
%\end{definition}
-%\DescribeMacro{\storenumberstring}
-%\begin{definition}
+%
+%\begin{definition}[\DescribeMacro{\storenumberstring}]
%\cs{storenumberstring}\marg{label}\marg{counter}\oarg{gender}
%\end{definition}
-%\DescribeMacro{\storeNumberstring}
-%\begin{definition}
+%
+%\begin{definition}[\DescribeMacro{\storeNumberstring}]
%\cs{storeNumberstring}\marg{label}\marg{counter}\oarg{gender}
%\end{definition}
-%\DescribeMacro{\storeNUMBERstring}
-%\begin{definition}
+%
+%\begin{definition}[\DescribeMacro{\storeNUMBERstring}]
%\cs{storeNUMBERstring}\marg{label}\marg{counter}\oarg{gender}
%\end{definition}
-%\DescribeMacro{\storeordinalnum}
-%\begin{definition}
+%
+%\begin{definition}[\DescribeMacro{\storeordinalnum}]
%\cs{storeordinalnum}\marg{label}\marg{number}\oarg{gender}
%\end{definition}
-%\DescribeMacro{\storeordinalstringnum}
-%\begin{definition}
+%
+%\begin{definition}[\DescribeMacro{\storeordinalstringnum}]
%\cs{storeordinalstring}\marg{label}\marg{number}\oarg{gender}
%\end{definition}
-%\DescribeMacro{\storeOrdinalstringnum}
-%\begin{definition}
+%
+%\begin{definition}[\DescribeMacro{\storeOrdinalstringnum}]
%\cs{storeOrdinalstringnum}\marg{label}\marg{number}\oarg{gender}
%\end{definition}
-%\DescribeMacro{\storeORDINALstringnum}
-%\begin{definition}
+%
+%\begin{definition}[\DescribeMacro{\storeORDINALstringnum}]
%\cs{storeORDINALstringnum}\marg{label}\marg{number}\oarg{gender}
%\end{definition}
-%\DescribeMacro{\storenumberstringnum}
-%\begin{definition}
+%
+%\begin{definition}[\DescribeMacro{\storenumberstringnum}]
%\cs{storenumberstring}\marg{label}\marg{number}\oarg{gender}
%\end{definition}
-%\DescribeMacro{\storeNumberstringnum}
-%\begin{definition}
+%
+%\begin{definition}[\DescribeMacro{\storeNumberstringnum}]
%\cs{storeNumberstring}\marg{label}\marg{number}\oarg{gender}
%\end{definition}
-%\DescribeMacro{\storeNUMBERstringnum}
-%\begin{definition}
+%
+%\begin{definition}[\DescribeMacro{\storeNUMBERstringnum}]
%\cs{storeNUMBERstring}\marg{label}\marg{number}\oarg{gender}
%\end{definition}
%
-% \DescribeMacro{\binary}
-%\changes{v2.4}{25 Sept 2004}{'binary added}
-%\begin{definition}
+%\begin{definition}[\DescribeMacro{\binary}]
%\cs{binary}\marg{counter}
%\end{definition}
-%This will print the
-%value of \meta{counter} as a binary number.
-%E.g.\ \verb"\binary{section}" will produce: 11. The declaration
-%\DescribeMacro{\padzeroes}
-%\begin{definition}
+%This will print the value of \meta{counter} as a binary number.
+%E.g.\ \verb"\binary{section}" will produce: 11. The declaration
+%\begin{definition}[\DescribeMacro{\padzeroes}]
%\cs{padzeroes}\oarg{n}
-%\end{definition}\noindent
-%will ensure numbers are written to \meta{n} digits, padding with
-%zeroes if necessary. E.g.\ \verb"\padzeroes[8]\binary{section}"
-%will produce: 00000011. The default value for \meta{n} is 17.
+%\end{definition}
+%will ensure numbers are written to \meta{n} digits, padding with
+%zeroes if necessary. E.g.\ \verb"\padzeroes[8]\binary{section}" will
+%produce: 00000011. The default value for \meta{n} is 17.
%
-%\DescribeMacro{\binarynum}
-%\begin{definition}
+%\begin{definition}[\DescribeMacro{\binarynum}]
%\cs{binary}\marg{n}
%\end{definition}
%This is like \cs{binary} but takes an actual number rather than a
%counter as the argument. For example: \verb"\binarynum{5}" will
%produce: 101.
%
-%\DescribeMacro{\octal}
-%\changes{v2.4}{25 Sept 2004}{'octal added}
-%\begin{definition}
+%The octal commands only work for values in the range 0~to~32768.
+%\begin{definition}[\DescribeMacro{\octal}]
%\cs{octal}\marg{counter}
%\end{definition}
%This will print the value of \meta{counter} as an octal number. For
@@ -370,17 +321,14 @@
%177. Again, the number will be padded with zeroes if necessary,
%depending on whether \cs{padzeroes} has been used.
%
-%\DescribeMacro{\octalnum}
-%\begin{definition}
+%\begin{definition}[\DescribeMacro{\octalnum}]
%\cs{octalnum}\marg{n}
%\end{definition}
%This is like \cs{octal} but takes an actual number rather than a
%counter as the argument. For example: \verb"\octalnum{125}" will
%produce: 177.
%
-% \DescribeMacro{\hexadecimal}
-%\changes{v2.4}{25 Sept 2004}{'hexadecimal added}
-%\begin{definition}
+%\begin{definition}[\DescribeMacro{\hexadecimal}]
%\cs{hexadecimal}\marg{counter}
%\end{definition}
%This will print the value of \meta{counter} as a hexadecimal number.
@@ -389,19 +337,17 @@
%will be padded with zeroes if necessary, depending on whether
%\cs{padzeroes} has been used.
%
-%\DescribeMacro{\Hexadecimal}
-%\begin{definition}
+%\begin{definition}[\DescribeMacro{\Hexadecimal}]
%\cs{Hexadecimal}\marg{counter}
%\end{definition}
%This does the same thing, but uses uppercase characters, e.g.\
%\verb"\Hexadecimal{mycounter}" will produce: 7D.
%
-%\DescribeMacro{\hexadecimalnum}
-%\begin{definition}
+%\begin{definition}[\DescribeMacro{\hexadecimalnum}]
%\cs{hexadecimalnum}\marg{n}
%\end{definition}
-%\DescribeMacro{\Hexadecimalnum}
-%\begin{definition}
+%
+%\begin{definition}[\DescribeMacro{\Hexadecimalnum}]
%\cs{Hexadecimalnum}\marg{n}
%\end{definition}
%These are like \cs{hexadecimal} and \cs{Hexadecimal}
@@ -410,9 +356,7 @@
%produce: 7d, and \verb"\Hexadecimalnum{125}" will
%produce: 7D.
%
-%\DescribeMacro{\decimal}
-%\changes{v2.41}{22 Oct 2004}{'decimal added}
-%\begin{definition}
+%\begin{definition}[\DescribeMacro{\decimal}]
%\cs{decimal}\marg{counter}
%\end{definition}
%This is similar to \cs{arabic} but the number can be padded with
@@ -420,36 +364,31 @@
%example: \verb"\padzeroes[8]\decimal{section}" will produce:
%00000005.
%
-%\DescribeMacro{\decimalnum}
-%\begin{definition}
+%\begin{definition}[\DescribeMacro{\decimalnum}]
%\cs{decimalnum}\marg{n}
%\end{definition}
%This is like \cs{decimal} but takes an actual number rather than a
%counter as the argument. For example:
%\verb"\padzeroes[8]\decimalnum{5}" will produce: 00000005.
%
-% \DescribeMacro{\aaalph}
-%\changes{v2.4}{25 Sept 2004}{'aaalph added}
-%\begin{definition}
+%\begin{definition}[\DescribeMacro{\aaalph}]
%\cs{aaalph}\marg{counter}
%\end{definition}
%This will print the value of \meta{counter} as: a b \ldots\ z aa bb
%\ldots\ zz etc. For example, \verb"\aaalpha{mycounter}" will
%produce: uuuuu if \texttt{mycounter} is set to 125.
%
-%\DescribeMacro{\AAAlph}
-%\begin{definition}
+%\begin{definition}[\DescribeMacro{\AAAlph}]
%\cs{AAAlph}\marg{counter}
%\end{definition}
%This does the same thing, but uses uppercase characters, e.g.\
%\verb"\AAAlph{mycounter}" will produce: UUUUU.
%
-%\DescribeMacro{\aaalphnum}
-%\begin{definition}
+%\begin{definition}[\DescribeMacro{\aaalphnum}]
%\cs{aaalphnum}\marg{n}
%\end{definition}
-%\DescribeMacro{\AAAlphnum}
-%\begin{definition}
+%
+%\begin{definition}[\DescribeMacro{\AAAlphnum}]
%\cs{AAAlphnum}\marg{n}
%\end{definition}
%These macros are like \cs{aaalph} and \cs{AAAlph}
@@ -458,28 +397,26 @@
%produce: uuuuu, and \verb"\AAAlphnum{125}" will
%produce: UUUUU.
%
-% \DescribeMacro{\abalph}
-%\changes{v2.4}{25 Sept 2004}{'abalph added}
-%\begin{definition}
+%The abalph commands described below only work for values in the
+%range 0~to~17576.
+%\begin{definition}[\DescribeMacro{\abalph}]
%\cs{abalph}\marg{counter}
%\end{definition}
%This will print the value of \meta{counter} as: a b \ldots\ z aa ab
%\ldots\ az etc. For example, \verb"\abalpha{mycounter}" will
%produce: du if \texttt{mycounter} is set to 125.
%
-% \DescribeMacro{\ABAlph}
-%\begin{definition}
+%\begin{definition}[\DescribeMacro{\ABAlph}]
%\cs{ABAlph}\marg{counter}
%\end{definition}
%This does the same thing, but uses uppercase characters, e.g.\
%\verb"\ABAlph{mycounter}" will produce: DU.
%
-%\DescribeMacro{\abalphnum}
-%\begin{definition}
+%\begin{definition}[\DescribeMacro{\abalphnum}]
%\cs{abalphnum}\marg{n}
%\end{definition}
-%\DescribeMacro{\ABAlphnum}
-%\begin{definition}
+%
+%\begin{definition}[\DescribeMacro{\ABAlphnum}]
%\cs{ABAlphnum}\marg{n}
%\end{definition}
%These macros are like \cs{abalph} and \cs{ABAlph}
@@ -493,18 +430,17 @@
%The following options can be passed to this package:
%
%\begin{tabular}{ll}
-% \texttt{raise} & make ordinal st,nd,rd,th appear as superscript\\
-% \texttt{level} & make ordinal st,nd,rd,th appear level with rest of
+% \pkgopt{raise} & make ordinal st,nd,rd,th appear as superscript\\
+% \pkgopt{level} & make ordinal st,nd,rd,th appear level with rest of
%text
%\end{tabular}
%
%\noindent These can also be set using the command:
%
-%\DescribeMacro{\fmtcountsetoptions}
-%\begin{definition}
+%\begin{definition}[\DescribeMacro{\fmtcountsetoptions}]
%\cs{fmtcountsetoptions}\verb"{fmtord="\meta{type}\verb'}'
%\end{definition}
-%\noindent where \meta{type} is either \texttt{level} or
+%where \meta{type} is either \texttt{level} or
%\texttt{raise}.
%
%\section{Multilingual Support}
@@ -523,20 +459,11 @@
%\cs{ordinal}, \cs{ordinalstring} and \cs{numberstring} (and their
%variants) will then be formatted in the currently selected language.
%
-%If the French language is selected, the French (France) version
-%will be used by default (e.g.\ soxiante-dix for 70). To
-%select the Swiss or Belgian variants (e.g.\ septente for 70) use:
-%\verb"\fmtcountsetoptions{french="\meta{dialect}\verb'}'
-%where \meta{dialect} is either \texttt{swiss} or \texttt{belgian}.
-%You can also use this command to change the action of
-%\cs{ordinal}.
-%\verb"\fmtcountsetoptions{abbrv=true}" to produce ordinals
-%of the form 2\textsuperscript{e} or
-%\verb"\fmtcountsetoptions{abbrv=false}" to produce ordinals
-%of the form 2\textsuperscript{eme} (default).
+%If the French language is selected, the \texttt{french} option let you
+%configure the dialect and other aspects. The \texttt{abbr} also has
+%some influence with French. Please refer to \S~\ref
+%{sec:options-french}.
%
-%The \texttt{french} and \texttt{abbrv} settings only have an
-%effect if the French language has been defined.
%
%The male gender for all languages is used by default, however the
%feminine or neuter forms can be obtained by passing \texttt{f} or
@@ -553,6 +480,280 @@
%you will need to let me know how to form the numbers and ordinals
%from~0 to~99999 in that language for each gender.
%
+%\subsection{Options for French}
+%\label{sec:options-french}
+%
+%This section is in French, as it is most useful to French speaking people.
+%
+%\selectlanguage{french} Il est possible de configurer plusieurs
+%aspects de la numérotation en français avec les options
+%\texttt{french} et \texttt{abbr}. Ces options n'ont d'effet que si le
+%langage \texttt{french} est chargé.
+%
+%\begin{definition}[\DescribeMacro{\fmtcountsetoptions}]
+%\cs{fmtcountsetoptions}\verb"{french="\marg{french options}\verb'}'
+%\end{definition}
+%L'argument \meta{french options} est une liste entre accolades et
+%séparée par des virgules de réglages de la forme
+%``\meta{clef}\texttt{=}\meta{valeur}'', chacun de ces réglages est
+%ci-après désigné par ``option française'' pour le distinguer des
+%``options générales'' telles que \texttt{french}.
+%
+%Le dialecte peut être sélectionné avec l'option française
+%\texttt{dialect} dont la valeur \meta{dialect} peut être
+%\texttt{france}, \texttt{belgian} ou \texttt{swiss}.
+%\begin{definition}[\DescribeOption{dialect}]
+%\cs{fmtcountsetoptions}\verb"{french={dialect="\marg{dialect}\verb'}}'
+%\end{definition}
+%\begin{definition}[\DescribeOption{french}]
+%\cs{fmtcountsetoptions}\verb"{french="\meta{dialect}\verb'}'
+%\end{definition}
+%
+%Pour alléger la notation et par souci de rétro-compatibilité
+%\texttt{france}, \texttt{belgian} ou \texttt{swiss} sont également des
+%\meta{clef}s pour \meta{french options} à utiliser sans \meta{valeur}.
+%
+%L'effet de l'option \texttt{dialect} est illustré ainsi:\newline
+%\begin{tabularx}{\linewidth}{@{}lX@{}}
+% \pkgopt{france}& soixante-dix pour 70, quatre-vingts pour 80, et
+% quate-vingts-dix pour 90,\\
+% \pkgopt{belgian} & septante pour 70, quatre-vingts pour 80, et
+% nonante pour 90, \\
+% \pkgopt{swiss} &septante pour 70, huitante\footnote{voir
+% \href{http://www.alain.be/Boece/huitante_octante.html}{Octante et
+% huitante} sur le site d'Alain Lassine} pour 80, et
+% nonante pour 90
+%\end{tabularx}
+%Il est à noter que la variante \texttt{belgian} est parfaitement
+%correcte pour les francophones français\footnote{je précise que
+% l'auteur de ces lignes est français}, et qu'elle est également
+%utilisée en Suisse Romande hormis dans les cantons de Vaud, du Valais
+%et de Fribourg. En ce qui concerne le mot ``octante'', il n'est
+%actuellement pas pris en charge et n'est guère plus utilisé, ce qui
+%est sans doute dommage car il est sans doute plus acceptable que le
+%``huitante'' de certains de nos amis suisses.
+%
+%\begin{definition}[\DescribeOption{abbr}]
+%\cs{fmtcountsetoptions}\verb"{abbr="\meta{boolean}\verb'}'
+%\end{definition}
+%L'option générale \texttt{abbr} permet de changer l'effet de
+%\cs{ordinal}. Selon \meta{boolean} on a:\newline
+%\begin{tabularx}{\linewidth}{@{}lX@{}}
+% \pkgopt{true}& pour produire des ordinaux de la forme
+% 2\textsuperscript{e}, ou\\
+% \pkgopt{false}& pour produire des ordinaux de la forme
+% 2\textsuperscript{eme} (par defaut)\\
+%\end{tabularx}
+%
+%\begin{definition}[\DescribeOption{vingt plural}]
+%\cs{fmtcountsetoptions}\verb"{french={vingt plural="\meta{french plural control}\verb'}}'
+%\end{definition}
+%\begin{definition}[\DescribeOption{cent plural}]
+%\cs{fmtcountsetoptions}\verb"{french={cent plural="\meta{french plural control}\verb'}}'
+%\end{definition}
+%\begin{definition}[\DescribeOption{mil plural}]
+%\cs{fmtcountsetoptions}\verb"{french={mil plural="\meta{french plural control}\verb'}}'
+%\end{definition}
+%\begin{definition}[\DescribeOption{n-illion plural}]
+%\cs{fmtcountsetoptions}\verb"{french={n-illion plural="\meta{french plural control}\verb'}}'
+%\end{definition}
+%\begin{definition}[\DescribeOption{n-illiard plural}]
+%\cs{fmtcountsetoptions}\verb"{french={n-illiard plural="\meta{french plural control}\verb'}}'
+%\end{definition}
+%\begin{definition}[\DescribeOption{all plural}]
+%\cs{fmtcountsetoptions}\verb"{french={all plural="\meta{french plural control}\verb'}}'
+%\end{definition}
+%Les options \texttt{vingt plural}, \texttt{cent plural}, \texttt{mil plural}, \texttt{n-illion plural}, et
+%\texttt{n-illiard plural}, permettent de contrôler très finement l'accord en nombre des mots respectivement
+%vingt, cent, mil, et des mots de la forme \meta{\(n\)}illion et \meta{\(n\)}illiard, où \meta{\(n\)} désigne
+%`m' pour 1, `b' pour 2, 'tr' pour 3, etc. L'option \texttt{all plural} est un raccourci permettant de
+%contrôler de concert l'accord en nombre de tous ces mots. Tous ces paramètres valent \texttt{reformed} par
+%défaut.
+%
+%Attention, comme on va l'expliquer, seules quelques combinaisons de configurations de ces options donnent un
+%orthographe correcte vis à vis des règles en vigueur. La raison d'être de ces options est la suivante~:
+%\begin{itemize}
+%\item la règle de l'accord en nombre des noms de nombre dans un numéral cardinal dépend de savoir s'il a
+% vraiment une valeur cardinale ou bien une valeur ordinale, ainsi on écrit \og aller à la page deux-cent
+% (sans s) d'un livre de deux-cents (avec s) pages\fg, il faut donc pouvoir changer la configuration pour
+% sélectionner le cas considéré,
+%\item un autre cas demandant quelque configurabilité est celui de \og mil\fg\ et \og mille\fg. Pour rappel \og
+% mille\fg\ est le pluriel irrégulier de \og mil\fg, mais l'alternance mil/mille est rare, voire pédante, car
+% aujourd'hui \og mille\fg\ n'est utilisé que comme un mot invariable, en effet le sort des pluriels étrangers
+% est systématiquement de finir par disparaître comme par exemple \og scénarii\fg\ aujourd'hui supplanté par
+% \og scénarios\fg. Pour continuer à pouvoir écrire \og mil\fg, il aurait fallu former le pluriel comme \og
+% mils\fg, ce qui n'est pas l'usage. Certaines personnes utilisent toutefois encore \og mil\fg\ dans les
+% dates, par exemple \og mil neuf cent quatre-vingt quatre\fg\ au lieu de \og mille neuf cent quatre-vingt
+% quatre\fg,
+%\item finalement les règles du français quoique bien définies ne sont pas très cohérentes et il est donc
+% inévitable qu'un jour ou l'autre on on les simplifie. Le paquetage \styfmt{fmtcount} est déjà prêt à cette
+% éventualité.
+%\end{itemize}
+%
+%Le paramètre \meta{french plural control} peut prendre les valeurs suivantes:\newline
+%\settowidth{\tabcolwidth}{\pkgopt{multiple lng-width}}
+%\begin{supertabular}{@{}p{\tabcolwidth}p{\dimexpr\linewidth-\tabcolwidth-2\tabcolsep}@{}}
+% \pkgopt{traditional}& pour sélectionner la règle en usage chez les adultes à la date de parution de ce
+% document, et dans le cas des numéraux cardinaux, lorsqu'ils ont une valeur cardinale,\\
+% \pkgopt{reformed}& pour suivre toute nouvelle recommandation à la date de parution de ce document, , et
+% dans le cas des numéraux cardinaux, lorsqu'ils ont une valeur cardinale, l'idée des options
+% \texttt{traditional} et \texttt{reformed} est donc de pouvoir contenter à la fois les anciens et les
+% modernes, mais à dire vrai à la date où ce document est écrit elles ont exactement
+% le même effet,\\
+% \pkgopt{traditional o}& pareil que \texttt{traditional} mais dans le cas des numéraux cardinaux,
+% lorsqu'ils
+% ont une valeur ordinale,\\
+% \pkgopt{reformed o}& pareil que \texttt{reformed} mais dans le cas des numéraux cardinaux, lorsqu'ils ont
+% une valeur ordinale, de même que précédemment \texttt{reformed o} et \texttt{traditional o} ont
+% exactement le même effet,\\
+% \pkgopt{always}& pour marquer toujours le pluriel, ceci n'est correct que pour \og mil\fg\ vis à vis des
+% règles en vigueur,\\
+% \pkgopt{never}& pour ne jamais marquer le pluriel, ceci est incorrect vis à vis des règles d'orthographe
+% en vigueur,\\
+% \pkgopt{multiple}& pour marquer le pluriel lorsque le nombre considéré est multiplié par au moins 2, ceci
+% est la règle en vigueur pour les nombres de la forme \meta{\(n\)}illion et \meta{\(n\)}illiard lorsque le
+% nombre a une valeur cardinale,\\
+% \pkgopt{multiple g-last}& pour marquer le pluriel lorsque le nombre considéré est multiplié par au moins 2
+% est est \emph{\textbf{g}lobalement} en dernière position, où ``globalement'' signifie qu'on considère le
+% nombre formaté en entier, ceci est incorrect vis à vis des règles d'orthographe
+% en vigueur,\\
+% \pkgopt{multiple l-last}& pour marquer le pluriel lorsque le nombre considéré est multiplié par au moins 2
+% et est \emph{\textbf{l}ocalement} en dernière position, où ``localement'' siginifie qu'on considère
+% seulement la portion du nombre qui multiplie soit l'unité, soit un \meta{\(n\)}illion ou un
+% \meta{\(n\)}illiard~; ceci est la convention en vigueur pour le pluriel de ``vingt'' et de ``cent''
+% lorsque le nombre formaté a une valeur cardinale,\\
+% \pkgopt{multiple lng-last}& pour marquer le pluriel lorsque le nombre considéré est multiplié par au moins
+% 2 et est \emph{\textbf{l}ocalement} mais \emph{\textbf{n}on \textbf{g}lobablement} en dernière position,
+% où ``localement'' et \emph{globablement} on la même siginification que pour les options \texttt{multiple
+% g-last} et \texttt{multiple l-last}~; ceci est la convention en vigueur pour le pluriel de ``vingt'' et
+% de ``cent'' lorsque le nombre formaté a une valeur ordinale,\\
+% \pkgopt{multiple ng-last}& pour marquer le pluriel lorsque le nombre considéré est multiplié par au moins
+% 2, et \emph{\textbf{n}}'est pas \emph{\textbf{g}lobalement} en dernière position, où ``globalement'' a la
+% même signification que pour l'option \texttt{multiple g-last}~; ceci est la règle que j'infère être en
+% vigueur pour les nombres de la forme \meta{\(n\)}illion et \meta{\(n\)}illiard lorsque le nombre a une
+% valeur ordinale, mais à dire vrai pour des nombres aussi grands, par exemple \og deux millions\fg, je
+% pense qu'il n'est tout simplement pas d'usage de dire \og l'exemplaire deux million(s?)\fg\ pour \og le
+% deux millionième
+% exemplaire\fg.\\
+%\end{supertabular}
+%
+%L'effet des paramètres \texttt{traditional}, \texttt{traditional o}, \texttt{reformed}, et \texttt{reformed
+% o}, est le suivant~:
+%
+%\setlength{\tabcolwidth}{\linewidth}
+%\addtolength{\tabcolwidth}{-10\tabcolsep}
+%\addtolength{\tabcolwidth}{-6\arrayrulewidth}
+%\noindent\begin{tabular*}{\linewidth}{|%
+% >{\centering\arraybackslash\ttfamily}p{\dimexpr0.204\tabcolwidth-\arrayrulewidth-\doublerulesep}||%
+% *{4}{>{\centering\arraybackslash\ttfamily}p{0.199\tabcolwidth}|}}\hline
+% \textrm{\meta{x} dans ``\meta{x} }plural\textrm{''}&traditional&reformed&traditional o&reformed o\\\hline
+% \hline
+% vingt&\multicolumn{2}{c|}{}&\multicolumn{2}{c|}{}\\\cline{1-1}
+% cent&%
+% \multicolumn{2}{c|}{\multirow{-2}{\dimexpr0.398\tabcolwidth+\arrayrulewidth+2\tabcolsep}{\centering
+% multiple l-last}}&%
+% \multicolumn{2}{c|}{\multirow{-2}{\dimexpr0.398\tabcolwidth+\arrayrulewidth+2\tabcolsep}{\centering
+% multiple lng-last}}\\\hline
+% mil&\multicolumn{4}{c|}{always}\\\hline
+% n-illion&\multicolumn{2}{c|}{}&\multicolumn{2}{c|}{}\\\cline{1-1}
+% n-illiard&%
+% \multicolumn{2}{c|}{\multirow{-2}{\dimexpr0.398\tabcolwidth+\arrayrulewidth+2\tabcolsep}{\centering
+% multiple}}&%
+% \multicolumn{2}{c|}{\multirow{-2}{\dimexpr0.398\tabcolwidth+\arrayrulewidth+2\tabcolsep}{\centering
+% multiple ng-last}}\\\hline
+%\end{tabular*}
+%
+%Les configurations qui respectent les règles d'orthographe sont les suivantes~:
+%\begin{itemize}
+%\item \verb"\fmtcountsetoptions{french={all plural=reformed o}}" pour formater les numéraux cardinaux à
+% valeur ordinale,
+%\item \verb"\fmtcountsetoptions{french={mil plural=multiple}}" pour activer l'alternance mil/mille.
+%\item \verb"\fmtcountsetoptions{french={all plural=reformed}}" pour revenir dans la configuration par
+% défaut.
+%\end{itemize}
+%
+%\begin{definition}[\DescribeOption{dash or space}]
+%\cs{fmtcountsetoptions}\verb"{french={dash or space="\meta{dash or space}\verb'}}'
+%\end{definition}
+%Avant la réforme de l'orthographe de 1990, on ne met des traits d'union qu'entre les dizaines et les unités,
+%et encore sauf quand le nombre \(n\) considéré est tel que \(n\mod10=1\), dans ce cas on écrit ``et un''
+%sans trait d'union. Après la réforme de 1990, on recommande de mettre des traits d'union de partout sauf
+%autour de ``mille'', ``million'' et ``milliard'', et les mots analogues comme ``billion'',
+%``billiard''. Cette exception a toutefois été contestée par de nombreux auteurs, et on peut aussi mettre des
+%traits d'union de partout. Mettre l'option \meta{dash or space} à:\newline
+%\begin{tabularx}{\linewidth}{lX}
+% \pkgopt{traditional}& pour sélectionner la règle d'avant la réforme de 1990,\\
+% \pkgopt{1990}& pour suivre la recommandation de la réforme de 1990, \\
+% \pkgopt{reformed}& pour suivre la recommandation de la dernière
+% réforme pise en charge, actuellement l'effet est le même que \textrm{1990}, ou à\\
+% \pkgopt{always}& pour mettre systématiquement des traits d'union de partout.\\
+%\end{tabularx}
+%Par défaut, l'option vaut \texttt{reformed}.
+%
+%
+%\begin{definition}[\DescribeOption{scale}]
+%\cs{fmtcountsetoptions}\verb"{french={scale="\meta{scale}\verb'}}'
+%\end{definition}
+%L'option \texttt{scale} permet de configurer l'écriture des grands
+%nombres. Mettre \meta{scale} à:\newline
+%\begin{tabularx}{\linewidth}{lX}
+% \pkgopt{recursive}& dans ce cas \(10^{30}\) donne mille milliards de
+% milliards de milliards, pour \(10^n\), on écrit \(10^{n-9\times
+% \max\{(n\div 9)-1,0\}}\) suivi de la répétition \(\max\{(n\div
+% 9)-1,0\}\) fois de ``de milliards''\\
+% \pkgopt{long}& \(10^{6\times n}\) donne un \meta{\(n\)}illion où
+% \meta{\(n\)} est remplacé par ``bi'' pour 2, ``tri'' pour 3, etc. et
+% \(10^{6\times n+3}\) donne un \meta{\(n\)}illiard avec la même
+% convention pour \meta{\(n\)}. L'option \texttt{long} est correcte en
+% Europe, par contre j'ignore l'usage au
+% Québec.\\
+% \pkgopt{short}& \(10^{6\times n}\) donne un \meta{\(n\)}illion où
+% \meta{\(n\)} est remplacé par ``bi'' pour 2, ``tri'' pour 3,
+% etc. L'option \texttt{short} est incorrecte en Europe.
+%\end{tabularx}
+%Par défaut, l'option vaut \texttt{recursive}.
+%
+%\begin{definition}[\DescribeOption{n-illiard upto}]
+%\cs{fmtcountsetoptions}\verb"{french={n-illiard upto="\meta{n-illiard upto}\verb'}}'
+%\end{definition}
+%Cette option n'a de sens que si \texttt{scale} vaut
+%\texttt{long}. Certaines personnes préfèrent dire ``mille
+%\meta{$n$}illions'' qu'un ``\meta{$n$}illiard''. Mettre l'option
+%\texttt{n-illiard upto} à:\newline
+%\begin{tabularx}{\linewidth}{lX}
+% \pkgopt{infinity}& pour que \(10^{6\times n +3}\) donne
+% \meta{$n$}illiards pour tout \(n>0\),\\
+% \pkgopt{infty}& même effet que \texttt{infinity}, \\
+% \(k\)& où \(k\) est un entier quelconque strictement positif, dans
+% ce cas \(10^{6\times n +3}\) donne ``mille \meta{\(n\)}illions''
+% lorsque \(n>k\), et donne ``\meta{\(n\)}illiard'' sinon\\
+%\end{tabularx}
+%
+%\begin{definition}[\DescribeOption{mil plural mark}]
+%\cs{fmtcountsetoptions}\verb"{french={mil plural mark="\meta{any text}\verb'}}'
+%\end{definition}
+%La valeur par défaut de cette option est \og\texttt{le}\fg. Il s'agit de la terminaison ajoutée à \og
+%mil\fg\ pour former le pluriel, c'est à dire \og mille\fg, cette option ne sert pas à grand chose sauf dans
+%l'éventualité où ce pluriel serait francisé un jour --- à dire vrai si cela se produisait une alternance
+%mille/milles est plus vraisemblable, car \og mille\fg\ est plus fréquent que \og mille\fg\ et que les
+%pluriels francisés sont formés en ajoutant \og s\fg\ à la forme la plus fréquente, par exemple \og
+%blini/blinis\fg, alors que \og blini\fg\ veut dire \og crêpes\fg\ (au pluriel).
+%
+%
+%\selectlanguage{english}
+%
+%%\subsection{Prefixes}
+%%\label{sec:latin-prefixes}
+%%
+%%\begin{definition}[\DescribeMacro{\latinnumeralstring}]
+%%\cs{latinnumeralstring}\marg{counter}\oarg{prefix options}
+%%\end{definition}
+%%
+%%\begin{definition}[\DescribeMacro{\latinnumeralstringnum}]
+%%\cs{latinnumeralstringnum}\marg{number}\oarg{prefix options}
+%%\end{definition}
+%
+%
%\section{Configuration File \texttt{fmtcount.cfg}}
%
%You can save your preferred default settings to a file called
@@ -597,11 +798,7 @@
%
%\section{Acknowledgements}
%
-%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 and to Edoardo Pasca for providing me with the
-%Italian translations.
+%I would like to thank all the people who have provided translations.
%
%\section{Troubleshooting}
%
@@ -614,6 +811,1195 @@
%\section{The Code}
%\iffalse
% \begin{macrocode}
+%<*fcnumparser.sty>
+% \end{macrocode}
+%\fi
+%\subsubsection{fcnumparser.sty}
+% \begin{macrocode}
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesPackage{fcnumparser}
+% \end{macrocode}
+% \cs{fc@counter@parser} is just a shorthand to parse a number held in a counter.
+% \begin{macrocode}
+\def\fc@counter@parser#1{%
+ \expandafter\fc@number@parser\expandafter{\the#1.}%
+}
+% \end{macrocode}
+% \begin{macrocode}
+\newcount\fc@digit@counter
+
+\def\fc@end@{\fc@end}
+% \end{macrocode}
+% \DescribeMacro\fc@number@analysis First of all we need to separate the number between integer and fractional
+% part. Number to be analysed is in `\texttt{\#1}'. Decimal separator may be . or , whichever first. At end of
+% this macro, integer part goes to \cs{fc@integer@part} and fractional part goes to \cs{fc@fractional@part}.
+% \begin{macrocode}
+\def\fc@number@analysis#1\fc@nil{%
+% \end{macrocode}
+% First check for the presence of a decimal point in the number.
+% \begin{macrocode}
+ \def\@tempb##1.##2\fc@nil{\def\fc@integer@part{##1}\def\@tempa{##2}}%
+ \@tempb#1.\fc@end\fc@nil
+ \ifx\@tempa\fc@end@
+% \end{macrocode}
+% Here \cs{@tempa} is \cs{ifx}-equal to \cs{fc@end}, which means that the number does not contain any decimal
+% point. So we do the same trick to search for a comma.
+% \begin{macrocode}
+ \def\@tempb##1,##2\fc@nil{\def\fc@integer@part{##1}\def\@tempa{##2}}%
+ \@tempb#1,\fc@end\fc@nil
+ \ifx\@tempa\fc@end@
+% \end{macrocode}
+% No comma either, so fractional part is set empty.
+% \begin{macrocode}
+ \def\fc@fractional@part{}%
+ \else
+% \end{macrocode}
+% Comma has been found, so we just need to drop `\texttt{,}\cs{fc@end}' from the end of \cs{@tempa} to get the
+% fractional part.
+% \begin{macrocode}
+ \def\@tempb##1,\fc@end{\def\fc@fractional@part{##1}}%
+ \expandafter\@tempb\@tempa
+ \fi
+ \else
+% \end{macrocode}
+% Decimal point has been found, so we just need to drop `\texttt{.}\cs{fc@end}' from the end \cs{@tempa} to
+% get the fractional part.
+% \begin{macrocode}
+ \def\@tempb##1.\fc@end{\def\fc@fractional@part{##1}}%
+ \expandafter\@tempb\@tempa
+ \fi
+}
+% \end{macrocode}
+% \DescribeMacro\fc@number@parser Macro \cs{fc@number@parser} is the main engine to parse a number. Argument
+% `\#1' is input and contains the number to be parsed. At end of this macro, each digit is stored separately
+% in a \cs{fc@digit@}\meta{$n$}, and macros \cs{fc@min@weight} and \cs{fc@max@weight} are set to the bounds
+% for \meta{$n$}.
+% \begin{macrocode}
+\def\fc@number@parser#1{%
+% \end{macrocode}
+% First remove all the spaces in \texttt{\#1}, and place the result into \cs{@tempa}.
+% \begin{macrocode}
+ \let\@tempa\@empty
+ \def\@tempb##1##2\fc@nil{%
+ \def\@tempc{##1}%
+ \ifx\@tempc\space
+ \else
+ \expandafter\def\expandafter\@tempa\expandafter{\@tempa ##1}%
+ \fi
+ \def\@tempc{##2}%
+ \ifx\@tempc\@empty
+ \expandafter\@gobble
+ \else
+ \expandafter\@tempb
+ \fi
+ ##2\fc@nil
+ }%
+ \@tempb#1\fc@nil
+% \end{macrocode}
+% Get the sign into \cs{fc@sign} and the unsigned number part into \cs{fc@number}.
+% \begin{macrocode}
+ \def\@tempb##1##2\fc@nil{\def\fc@sign{##1}\def\fc@number{##2}}%
+ \expandafter\@tempb\@tempa\fc@nil
+ \expandafter\if\fc@sign+%
+ \def\fc@sign@case{1}%
+ \else
+ \expandafter\if\fc@sign-%
+ \def\fc@sign@case{2}%
+ \else
+ \def\fc@sign{}%
+ \def\fc@sign@case{0}%
+ \let\fc@number\@tempa
+ \fi
+ \fi
+ \ifx\fc@number\@empty
+ \PackageError{fcnumparser}{Invalid number}{Number must contain at least one non blank
+ character after sign}%
+ \fi
+% \end{macrocode}
+% Now, split \cs{fc@number} into \cs{fc@integer@part} and \cs{fc@fractional@part}.
+% \begin{macrocode}
+ \expandafter\fc@number@analysis\fc@number\fc@nil
+% \end{macrocode}
+% Now, split \cs{fc@integer@part} into a sequence of \cs{fc@digit@}\meta{$n$} with \meta{$n$} ranging from
+% \cs{fc@unit@weight} to \cs{fc@max@weight}. We will use macro \cs{fc@parse@integer@digits} for that, but that
+% will place the digits into \cs{fc@digit@}\meta{$n$} with \meta{$n$} ranging from
+% \(2\times\cs{fc@unit@weight}-\cs{fc@max@weight}\) upto \(\cs{fc@unit@weight}-1\).
+% \begin{macrocode}
+ \expandafter\fc@digit@counter\fc@unit@weight
+ \expandafter\fc@parse@integer@digits\fc@integer@part\fc@end\fc@nil
+% \end{macrocode}
+% First we compute the weight of the most significant digit: after \cs{fc@parse@integer@digits},
+% \cs{fc@digit@counter} is equal to \(\cs{fc@unit@weight} -\mathrm{mw} -1\) and we want to set
+% \cs{fc@max@weight} to \(\cs{fc@unit@weight} +\mathrm{mw}\) so we do:
+% \begin{equation*}
+% \cs{fc@max@weight}\leftarrow (-\cs{fc@digit@counter}) + 2\times\cs{fc@unit@weight} -1
+% \end{equation*}
+% \begin{macrocode}
+ \fc@digit@counter -\fc@digit@counter
+ \advance\fc@digit@counter by \fc@unit@weight
+ \advance\fc@digit@counter by \fc@unit@weight
+ \advance\fc@digit@counter by -1 %
+ \edef\fc@max@weight{\the\fc@digit@counter}%
+% \end{macrocode}
+% Now we loop for \(i = \cs{fc@unit@weight}\) to \cs{fc@max@weight} in order to copy all the digits from
+% \cs{fc@digit@}\meta{\(i + \mathrm{offset}\)} to \cs{fc@digit@}\meta{\(i\)}. First we compute
+% \(\mathrm{offset}\) into \cs{@tempi}.
+% \begin{macrocode}
+ {%
+ \count0 \fc@unit@weight\relax
+ \count1 \fc@max@weight\relax
+ \advance\count0 by -\count1 %
+ \advance\count0 by -1 %
+ \def\@tempa##1{\def\@tempb{\def\@tempi{##1}}}%
+ \expandafter\@tempa\expandafter{\the\count0}%
+ \expandafter
+ }\@tempb
+% \end{macrocode}
+% Now we loop to copy the digits. To do that we define a macro \cs{@templ} for terminal recursion.
+% \begin{macrocode}
+ \expandafter\fc@digit@counter\fc@unit@weight
+ \def\@templ{%
+ \ifnum\fc@digit@counter>\fc@max@weight
+ \let\next\relax
+ \else
+% \end{macrocode}
+% Here is the loop body:
+% \begin{macrocode}
+ {%
+ \count0 \@tempi
+ \advance\count0 by \fc@digit@counter
+ \expandafter\def\expandafter\@tempd\expandafter{\csname fc@digit@\the\count0\endcsname}%
+ \expandafter\def\expandafter\@tempe\expandafter{\csname fc@digit@\the\fc@digit@counter\endcsname}%
+ \def\@tempa####1####2{\def\@tempb{\let####1####2}}%
+ \expandafter\expandafter\expandafter\@tempa\expandafter\@tempe\@tempd
+ \expandafter
+ }\@tempb
+ \advance\fc@digit@counter by 1 %
+ \fi
+ \next
+ }%
+ \let\next\@templ
+ \@templ
+% \end{macrocode}
+% Split \cs{fc@fractional@part} into a sequence of \cs{fc@digit@}\meta{$n$} with \meta{$n$} ranging from
+% \(\cs{fc@unit@weight}-1\) to \cs{fc@min@weight} by step of \(-1\). This is much more simpler because we get
+% the digits with the final range of index, so no post-processing loop is needed.
+% \begin{macrocode}
+ \expandafter\fc@digit@counter\fc@unit@weight
+ \expandafter\fc@parse@integer@digits\fc@fractional@part\fc@end\fc@nil
+ \edef\fc@min@weight{\the\fc@digit@counter}%
+}
+% \end{macrocode}
+% \DescribeMacro\fc@parse@integer@digits Macro \cs{fc@parse@integer@digits} is used to
+% \begin{macrocode}
+\@ifundefined{fc@parse@integer@digits}{}{%
+ \PackageError{fcnumparser}{Duplicate definition}{Redefinition of
+ macro `fc@parse@integer@digits'}}
+\def\fc@parse@integer@digits#1#2\fc@nil{%
+ \def\@tempa{#1}%
+ \ifx\@tempa\fc@end@
+ \def\next##1\fc@nil{}%
+ \else
+ \let\next\fc@parse@integer@digits
+ \advance\fc@digit@counter by -1
+ \expandafter\def\csname fc@digit@\the\fc@digit@counter\endcsname{#1}%
+ \fi
+ \next#2\fc@nil
+}
+
+
+\newcommand*{\fc@unit@weight}{0}
+
+% \end{macrocode}
+% Now we have macros to read a few digits from the \cs{fc@digit@}\meta{$n$} array and form a correspoding
+% number.\newline \DescribeMacro\fc@read@unit \cs{fc@read@unit} just reads one digit and form an integer in
+% the range \([0 \intv 9]\). First we check that the macro is not yet defined.
+% \begin{macrocode}
+\@ifundefined{fc@read@unit}{}{%
+ \PackageError{fcnumparser}{Duplicate definition}{Redefinition of macro `fc@read@unit'}}
+% \end{macrocode}
+% Arguments as follows:\def\interface{\newline\noindent
+% \begin{tabularx}{\linewidth}{@{}>{\raggedleft\arraybackslash\ttfamily}rX@{}}
+% \#1&output counter: into which the read value is placed\\
+% \#2&input number: unit weight at which reach the value is to be read
+% \end{tabularx}}\interface
+% \#2 does not need to be comprised between \cs{fc@min@weight} and {fc@min@weight}, if outside this interval,
+% then a zero is read.
+% \begin{macrocode}
+\def\fc@read@unit#1#2{%
+ \ifnum#2>\fc@max@weight
+ #1=0\relax
+ \else
+ \ifnum#2<\fc@min@weight
+ #1=0\relax
+ \else
+ {%
+ \edef\@tempa{\number#2}%
+ \count0=\@tempa
+ \edef\@tempa{\csname fc@digit@\the\count0\endcsname}%
+ \def\@tempb##1{\def\@tempa{#1=##1\relax}}%
+ \expandafter\@tempb\expandafter{\@tempa}%
+ \expandafter
+ }\@tempa
+ \fi
+ \fi
+}
+% \end{macrocode}
+% \DescribeMacro\fc@read@hundred Macro \cs{fc@read@hundred} is used to read a pair of digits and form an
+% integer in the range \([0 \intv 99]\). First we check that the macro is not yet defined.
+% \begin{macrocode}
+\@ifundefined{fc@read@hundred}{}{%
+ \PackageError{fcnumparser}{Duplicate definition}{Redefinition of macro `fc@read@hundred'}}
+% \end{macrocode}
+% Arguments as follows --- same interface as \cs{fc@read@unit}:\interface
+% \begin{macrocode}
+\def\fc@read@hundred#1#2{%
+ {%
+ \fc@read@unit{\count0}{#2}%
+ \def\@tempa##1{\fc@read@unit{\count1}{##1}}%
+ \count2=#2%
+ \advance\count2 by 1 %
+ \expandafter\@tempa{\the\count2}%
+ \multiply\count1 by 10 %
+ \advance\count1 by \count0 %
+ \def\@tempa##1{\def\@tempb{#1=##1\relax}}
+ \expandafter\@tempa\expandafter{\the\count1}%
+ \expandafter
+ }\@tempb
+}
+% \end{macrocode}
+% \DescribeMacro\fc@read@thousand Macro \cs{fc@read@thousand} is used to read a trio of digits and form an
+% integer in the range \([0 \intv 999]\). First we check that the macro is not yet defined.
+% \begin{macrocode}
+\@ifundefined{fc@read@thousand}{}{%
+ \PackageError{fcnumparser}{Duplicate definition}{Redefinition of macro
+ `fc@read@thousand'}}
+% \end{macrocode}
+% Arguments as follows --- same interface as \cs{fc@read@unit}:\interface
+% \begin{macrocode}
+\def\fc@read@thousand#1#2{%
+ {%
+ \fc@read@unit{\count0}{#2}%
+ \def\@tempa##1{\fc@read@hundred{\count1}{##1}}%
+ \count2=#2%
+ \advance\count2 by 1 %
+ \expandafter\@tempa{\the\count2}%
+ \multiply\count1 by 10 %
+ \advance\count1 by \count0 %
+ \def\@tempa##1{\def\@tempb{#1=##1\relax}}
+ \expandafter\@tempa\expandafter{\the\count1}%
+ \expandafter
+ }\@tempb
+}
+% \end{macrocode}
+% Note: one myriad is ten thousand.
+% \DescribeMacro\fc@read@thousand Macro \cs{fc@read@myriad} is used to read a quatuor of digits and form an
+% integer in the range \([0 \intv 9999]\). First we check that the macro is not yet defined.
+% \begin{macrocode}
+\@ifundefined{fc@read@myriad}{}{%
+ \PackageError{fcnumparser}{Duplicate definition}{Redefinition of macro
+ `fc@read@myriad'}}
+% \end{macrocode}
+% Arguments as follows --- same interface as \cs{fc@read@unit}:\interface
+% \begin{macrocode}
+\def\fc@read@myriad#1#2{%
+ {%
+ \fc@read@hundred{\count0}{#2}%
+ \def\@tempa##1{\fc@read@hundred{\count1}{##1}}%
+ \count2=#2
+ \advance\count2 by 2
+ \expandafter\@tempa{\the\count2}%
+ \multiply\count1 by 100 %
+ \advance\count1 by \count0 %
+ \def\@tempa##1{\def\@tempb{#1=##1\relax}}%
+ \expandafter\@tempa\expandafter{\the\count1}%
+ \expandafter
+ }\@tempb
+}
+% \end{macrocode}
+% \DescribeMacro\fc@check@nonzeros Macro \cs{fc@check@nonzeros} is used to check whether the number
+% represented by digits \cs{fc@digit@}\meta{$n$}, with \(n\) in some interval, is zero, one, or more than one.
+% First we check that the macro is not yet defined.
+% \begin{macrocode}
+\@ifundefined{fc@check@nonzeros}{}{%
+ \PackageError{fcnumparser}{Duplicate definition}{Redefinition of macro
+ `fc@check@nonzeros'}}
+% \end{macrocode}
+% Arguments as follows:\newline\noindent
+% \begin{tabularx}{\linewidth}{@{}>{\raggedleft\arraybackslash\ttfamily}rX@{}}
+% \#1&input number: minimum unit unit weight at which start to search the non-zeros\\
+% \#2&input number: maximum unit weight at which end to seach the non-zeros\\
+% \#3&output macro: let \(n\) be the number represented by digits the weight of which span from \texttt{\#1}
+% to \texttt{\#2}, then \texttt{\#3} is set to the number min(n,9).\\
+% \end{tabularx}
+% Actually \cs{fc@check@nonzeros} is just a wrapper to collect arguments, and the real job is delegated to
+% \cs{fc@@check@nonzeros@inner} which is called inside a group.
+% \begin{macrocode}
+\def\fc@check@nonzeros#1#2#3{%
+ {%
+% \end{macrocode}
+% So first we save inputs into local macros used by \cs{fc@@check@nonzeros@inner} as input arguments
+% \begin{macrocode}
+ \edef\@@tempa{\number#1}%
+ \edef\@tempb{\number#2}%
+ \count0=\@@tempa
+ \count1=\@tempb\relax
+% \end{macrocode}
+% Then we do the real job
+% \begin{macrocode}
+ \fc@@check@nonzeros@inner
+% \end{macrocode}
+% And finally, we propagate the output after end of group --- i.e. closing brace.
+% \begin{macrocode}
+ \def\@tempd##1{\def\@tempa{\def#3{##1}}}%
+ \expandafter\@tempd\expandafter{\@tempc}%
+ \expandafter
+ }\@tempa
+}
+% \end{macrocode}
+% \DescribeMacro\fc@@check@nonzeros@inner Macro \cs{fc@@check@nonzeros@inner} Check wehther some part of the
+% parsed value contains some non-zero digit At the call of this macro we expect that:\newline\noindent
+% \begin{tabularx}{\linewidth}{@{}>{\raggedleft\arraybackslash}rX@{}}
+% \cs{@tempa}&input/output macro:\newline\noindent
+% \settowidth{\tabcolwidth}{output}%
+% \begin{tabular*}{\hsize}{@{}>{\raggedleft\arraybackslash\itshape}r%
+% p{\dimexpr\hsize-2\tabcolsep-\tabcolwidth}@{}}
+% input&minimum unit unit weight at which start to search the non-zeros\\
+% output&macro may have been redefined
+% \end{tabular*}\\
+% \cs{@tempb}&input/output macro:\newline\noindent
+% \settowidth{\tabcolwidth}{output}%
+% \begin{tabular*}{\hsize}{@{}>{\raggedleft\arraybackslash\itshape}r%
+% p{\dimexpr\hsize-2\tabcolsep-\tabcolwidth}@{}}
+% input&maximum unit weight at which end to seach the non-zeros\\
+% output&macro may have been redefined
+% \end{tabular*}\\
+% \cs{@tempc}&ouput macro: 0 if all-zeros, 1 if at least one zero is found\\
+% \cs{count0}&output counter: \(\mathrm{weight}+1\) of the first found non zero starting from minimum
+% \(\mathrm{weight}\).
+% \end{tabularx}
+% \begin{macrocode}
+\def\fc@@check@nonzeros@inner{%
+ \ifnum\count0<\fc@min@weight
+ \count0=\fc@min@weight\relax
+ \fi
+ \ifnum\count1>\fc@max@weight\relax
+ \count1=\fc@max@weight
+ \fi
+ \count2\count0 %
+ \advance\count2 by 1 %
+ \ifnum\count0>\count1 %
+ \PackageError{fcnumparser}{Unexpected arguments}{Number in argument 2 of macro
+ `fc@check@nonzeros' must be at least equal to number in argument 1}%
+ \else
+ \fc@@check@nonzeros@inner@loopbody
+ \ifnum\@tempc>0 %
+ \ifnum\@tempc<9 %
+ \ifnum\count0>\count1 %
+ \else
+ \let\@tempd\@tempc
+ \fc@@check@nonzeros@inner@loopbody
+ \ifnum\@tempc=0 %
+ \let\@tempc\@tempd
+ \else
+ \def\@tempc{9}%
+ \fi
+ \fi
+ \fi
+ \fi
+ \fi
+}
+% \end{macrocode}
+% \begin{macrocode}
+\def\fc@@check@nonzeros@inner@loopbody{%
+ % \@tempc <- digit of weight \count0
+ \expandafter\let\expandafter\@tempc\csname fc@digit@\the\count0\endcsname
+ \advance\count0 by 1 %
+ \ifnum\@tempc=0 %
+ \ifnum\count0>\count1 %
+ \let\next\relax
+ \else
+ \let\next\fc@@check@nonzeros@inner@loopbody
+ \fi
+ \else
+ \ifnum\count0>\count2 %
+ \def\@tempc{9}%
+ \fi
+ \let\next\relax
+ \fi
+ \next
+}
+% \end{macrocode}
+% \DescribeMacro\fc@intpart@find@last Macro \cs{fc@intpart@find@last} find the rightmost non zero digit in the
+% integer part. First check that the macro is not yet defined.
+% \begin{macrocode}
+\@ifundefined{fc@intpart@find@last}{}{%
+ \PackageError{fcnumparser}{Duplicate definition}{Redefinition of macro
+ `fc@intpart@find@last'}}
+% \end{macrocode}
+% When macro is called, the number of interest is already parsed, that is to say each digit of weight \(w\) is
+% stored in macro \cs{fc@digit@}\meta{$w$}. Macro \cs{fc@intpart@find@last} takes one single argument which
+% is a counter to set to the result.
+% \begin{macrocode}
+\def\fc@intpart@find@last#1{%
+ {%
+% \end{macrocode}
+% Counter \cs{count0} will hold the result. So we will loop on \cs{count0}, starting from
+% \(\min\{u,w_{\mathrm{min}}\}\), where \(u\triangleq\cs{fc@unit@weight}\), and
+% \(w_{\mathrm{min}}\triangleq\cs{fc@min@weight}\). So first set \cs{count0} to
+% \(\min\{u,w_{\mathrm{min}}\}\):
+% \begin{macrocode}
+ \count0=\fc@unit@weight\space
+ \ifnum\count0<\fc@min@weight\space
+ \count0=\fc@min@weight\space
+ \fi
+% \end{macrocode}
+% Now the loop. This is done by defining macro \cs{@templ} for final recursion.
+% \begin{macrocode}
+ \def\@templ{%
+ \ifnum\csname fc@digit@\the\count0\endcsname=0 %
+ \advance\count0 by 1 %
+ \ifnum\count0>\fc@max@weight\space
+ \let\next\relax
+ \fi
+ \else
+ \let\next\relax
+ \fi
+ \next
+ }%
+ \let\next\@templ
+ \@templ
+% \end{macrocode}
+% Now propagate result after closing bracket into counter \texttt{\#1}.
+% \begin{macrocode}
+ \toks0{#1}%
+ \edef\@tempa{\the\toks0=\the\count0}%
+ \expandafter
+ }\@tempa\space
+}
+% \end{macrocode}
+% \DescribeMacro\fc@get@last@word Getting last word. Arguments as follows:\newline\noindent
+% \begin{tabularx}{\linewidth}{@{}>{\raggedleft\arraybackslash\ttfamily}rX@{}}
+% \#1&input: full sequence\\
+% \#2&output macro 1: all sequence without last word\\
+% \#3&output macro 2: last word\\
+% \end{tabularx}
+% \begin{macrocode}
+\@ifundefined{fc@get@last@word}{}{\PackageError{fcnumparser}{Duplicate definition}{Redefinition
+ of macro `fc@get@last@word'}}%
+\def\fc@get@last@word#1#2#3{%
+ {%
+% \end{macrocode}
+% First we split \texttt{\#1} into two parts: everything that is upto \cs{fc@case} exclusive goes to
+% \cs{toks0}, and evrything from \cs{fc@case} exclusive upto the final \cs{@nil} exclusive goes to \cs{toks1}.
+% \begin{macrocode}
+ \def\@tempa##1\fc@case##2\@nil\fc@end{%
+ \toks0{##1}%
+% \end{macrocode}
+% Actually a dummy \cs{fc@case} is appended to \cs{toks1}, because that makes easier further checking that it
+% does not contains any other \cs{fc@case}.
+% \begin{macrocode}
+ \toks1{##2\fc@case}%
+ }%
+ \@tempa#1\fc@end
+% \end{macrocode}
+% Now leading part upto last word should be in \cs{toks0}, and last word should be in \cs{toks1}. However we
+% need to check that this is really the last word, i.e. we need to check that there is no \cs{fc@case} inside
+% \cs{toks1} other than the tailing dummy one. To that purpose we will loop while we find that \cs{toks1}
+% contains some \cs{fc@case}. First we define \cs{@tempa} to split \cs{the}\cs{toks1} between parts before and
+% after some potential \cs{fc@case}.
+% \begin{macrocode}
+ \def\@tempa##1\fc@case##2\fc@end{%
+ \toks2{##1}%
+ \def\@tempb{##2}%
+ \toks3{##2}%
+ }%
+% \end{macrocode}
+% \cs{@tempt} is just an aliases of \cs{toks0} to make its handling easier later on.
+% \begin{macrocode}
+ \toksdef\@tempt0 %
+% \end{macrocode}
+% Now the loop itself, this is done by terminal recursion with macro \cs{@templ}.
+% \begin{macrocode}
+ \def\@templ{%
+ \expandafter\@tempa\the\toks1 \fc@end
+ \ifx\@tempb\@empty
+% \end{macrocode}
+% \cs{@tempb} empty means that the only \cs{fc@case} found in \cs{the}\cs{toks1} is the dummy one. So we end
+% the loop here, \cs{toks2} contains the last word.
+% \begin{macrocode}
+ \let\next\relax
+ \else
+% \end{macrocode}
+% \cs{@tempb} is not empty, first we use
+% \begin{macrocode}
+ \expandafter\expandafter\expandafter\@tempt
+ \expandafter\expandafter\expandafter{%
+ \expandafter\the\expandafter\@tempt
+ \expandafter\fc@case\the\toks2}%
+ \toks1\toks3 %
+ \fi
+ \next
+ }%
+ \let\next\@templ
+ \@templ
+ \edef\@tempa{\def\noexpand#2{\the\toks0}\def\noexpand#3{\the\toks2}}%
+ \expandafter
+ }\@tempa
+}
+% \end{macrocode}
+% \DescribeMacro\fc@get@last@word Getting last letter. Arguments as follows:\newline\noindent
+% \begin{tabularx}{\linewidth}{@{}>{\raggedleft\arraybackslash\ttfamily}rX@{}}
+% \#1&input: full word\\
+% \#2&output macro 1: all word without last letter\\
+% \#3&output macro 2: last letter\\
+% \end{tabularx}
+% \begin{macrocode}
+\@ifundefined{fc@get@last@letter}{}{\PackageError{fcnumparser}{Duplicate definition}{Redefinition
+ of macro `fc@get@last@letter'}}%
+\def\fc@get@last@letter#1#2#3{%
+ {%
+% \end{macrocode}
+% First copy input to local \cs{toks1}. What we are going to to is to bubble one by one letters from
+% \cs{toks1} which initial contains the whole word, into \cs{toks0}. At the end of the macro \cs{toks0} will
+% therefore contain the whole work but the last letter, and the last letter will be in \cs{toks1}.
+% \begin{macrocode}
+ \toks1{#1}%
+ \toks0{}%
+ \toksdef\@tempt0 %
+% \end{macrocode}
+% We define \cs{@tempa} in order to pop the first letter from the remaining of word.
+% \begin{macrocode}
+ \def\@tempa##1##2\fc@nil{%
+ \toks2{##1}%
+ \toks3{##2}%
+ \def\@tempb{##2}%
+ }%
+% \end{macrocode}
+% Now we define \cs{@templ} to do the loop by terminal recursion.
+% \begin{macrocode}
+ \def\@templ{%
+ \expandafter\@tempa\the\toks1 \fc@nil
+ \ifx\@tempb\@empty
+% \end{macrocode}
+% Stop loop, as \cs{toks1} has been detected to be one single letter.
+% \begin{macrocode}
+ \let\next\relax
+ \else
+% \end{macrocode}
+% Here we append to \cs{toks0} the content of \cs{toks2}, i.e. the next letter.
+% \begin{macrocode}
+ \expandafter\expandafter\expandafter\@tempt
+ \expandafter\expandafter\expandafter{%
+ \expandafter\the\expandafter\@tempt
+ \the\toks2}%
+% \end{macrocode}
+% And the remaining letters go to \cs{toks1} for the next iteration.
+% \begin{macrocode}
+ \toks1\toks3 %
+ \fi
+ \next
+ }%
+% \end{macrocode}
+% Here run the loop.
+% \begin{macrocode}
+ \let\next\@templ
+ \next
+% \end{macrocode}
+% Now propagate the results into macros \texttt{\#2} and \texttt{\#3} after closing brace.
+% \begin{macrocode}
+ \edef\@tempa{\def\noexpand#2{\the\toks0}\def\noexpand#3{\the\toks1}}%
+ \expandafter
+ }\@tempa
+}%
+% \end{macrocode}
+\iffalse Local variables: \fi
+\iffalse mode: docTeX \fi
+\iffalse End: \fi
+%\iffalse
+% \begin{macrocode}
+%</fcnumparser.sty>
+% \end{macrocode}
+%\fi
+%\iffalse
+% \begin{macrocode}
+%<*fcprefix.sty>
+% \end{macrocode}
+%\fi
+%\subsection{fcprefix.sty}
+% Pseudo-latin prefixes.
+% \begin{macrocode}
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesPackage{fcprefix}
+\RequirePackage{ifthen}
+\RequirePackage{keyval}
+\RequirePackage{fcnumparser}
+% \end{macrocode}
+% Option `\texttt{use duode and unde}' is to select whether \(18\) and suchlikes (\(\meta{x}8\),
+% \(\meta{x}9\)) writes like duodevicies, or like octodecies. For French it should be `\texttt{below
+% 20}'. Possible values are `\texttt{below 20}' and `\texttt{never}'.
+% \begin{macrocode}
+\define@key{fcprefix}{use duode and unde}[below20]{%
+ \ifthenelse{\equal{#1}{below20}}{%
+ \def\fc@duodeandunde{2}%
+ }{%
+ \ifthenelse{\equal{#1}{never}}{%
+ \def\fc@duodeandunde{0}%
+ }{%
+ \PackageError{fcprefix}{Unexpected option}{%
+ Option `use duode and unde' expects `below 20' or `never' }%
+ }%
+ }%
+}
+% \end{macrocode}
+% Default is `\texttt{below 20}' like in French.
+% \begin{macrocode}
+\def\fc@duodeandunde{2}
+% \end{macrocode}
+% Option `\texttt{numeral u in duo}', this can be `\texttt{true}' or `\texttt{false}' and is used to select
+% whether 12 and suchlikes write like dodec\meta{xxx} or duodec\meta{xxx} for numerals.
+% \begin{macrocode}
+\define@key{fcprefix}{numeral u in duo}[false]{%
+ \ifthenelse{\equal{#1}{false}}{%
+ \let\fc@u@in@duo\@empty
+ }{%
+ \ifthenelse{\equal{#1}{true}}{%
+ \def\fc@u@in@duo{u}%
+ }{%
+ \PackageError{fcprefix}{Unexpected option}{%
+ Option `numeral u in duo' expects `true' or `false' }%
+ }%
+ }%
+}
+% \end{macrocode}
+% Option `\texttt{e accute}', this can be `\texttt{true}' or `\texttt{false}' and is used to select whether
+% letter `\texttt{e}' has an accute accent when it pronounce [e] in French.
+% \begin{macrocode}
+\define@key{fcprefix}{e accute}[false]{%
+ \ifthenelse{\equal{#1}{false}}{%
+ \let\fc@prefix@eaccute\@firstofone
+ }{%
+ \ifthenelse{\equal{#1}{true}}{%
+ \let\fc@prefix@eaccute\'%
+ }{%
+ \PackageError{fcprefix}{Unexpected option}{%
+ Option `e accute' expects `true' or `false' }%
+ }%
+ }%
+}
+% \end{macrocode}
+% Default is to set accute accent like in French.
+% \begin{macrocode}
+\let\fc@prefix@eaccute\'%
+% \end{macrocode}
+% Option `\texttt{power of millia}' tells how millia is raise to power n. It expects value:\newline\noindent
+% \begin{tabularx}{\linewidth}{@{}>{\raggedleft\arraybackslash\ttfamily}rX@{}}
+% recursive&for which millia squared is noted as `milliamillia'\\
+% arabic&for which millia squared is noted as `millia\^{}2'\\
+% prefix&for which millia squared is noted as `bismillia'
+% \end{tabularx}
+% \begin{macrocode}
+\define@key{fcprefix}{power of millia}[prefix]{%
+ \ifthenelse{\equal{#1}{prefix}}{%
+ \let\fc@power@of@millia@init\@gobbletwo
+ \let\fc@power@of@millia\fc@@prefix@millia
+ }{%
+ \ifthenelse{\equal{#1}{arabic}}{%
+ \let\fc@power@of@millia@init\@gobbletwo
+ \let\fc@power@of@millia\fc@@arabic@millia
+ }{%
+ \ifthenelse{\equal{#1}{recursive}}{%
+ \let\fc@power@of@millia@init\fc@@recurse@millia@init
+ \let\fc@power@of@millia\fc@@recurse@millia
+ }{%
+ \PackageError{fcprefix}{Unexpected option}{%
+ Option `power of millia' expects `recursive', `arabic', or `prefix' }%
+ }%
+ }%
+ }%
+}
+% \end{macrocode}
+% Arguments as follows:\def\interface{\newline\noindent
+% \begin{tabularx}{\linewidth}{@{}>{\raggedleft\arraybackslash\ttfamily}rX@{}}
+% \#1& output macro\\
+% \#2& number with current weight \(w\)
+% \end{tabularx}}\interface
+% \begin{macrocode}
+\def\fc@@recurse@millia#1#2{%
+ \let\@tempp#1%
+ \edef#1{millia\@tempp}%
+}
+% \end{macrocode}
+% Arguments as follows --- same interface as \cs{fc@@recurse@millia}: \interface
+% \begin{macrocode}
+\def\fc@@recurse@millia@init#1#2{%
+ {%
+% \end{macrocode}
+% Save input argument current weight \(w\) into local macro \cs{@tempb}.
+% \begin{macrocode}
+ \edef\@tempb{\number#2}%
+% \end{macrocode}
+% Now main loop from 0 to \(w\). Final value of \cs{@tempa} will be the result.
+% \begin{macrocode}
+ \count0=0 %
+ \let\@tempa\@empty
+ \loop
+ \ifnum\count0<\@tempb
+ \advance\count0 by 1 %
+ \expandafter\def
+ \expandafter\@tempa\expandafter{\@tempa millia}%
+ \repeat
+% \end{macrocode}
+% Now propagate the expansion of \cs{@tempa} into \texttt{\#1} after closing bace.
+% \begin{macrocode}
+ \edef\@tempb{\def\noexpand#1{\@tempa}}%
+ \expandafter
+ }\@tempb
+}
+% \end{macrocode}
+% Arguments as follows --- same interface as \cs{fc@@recurse@millia}: \interface
+% \begin{macrocode}
+\def\fc@@arabic@millia#1#2{%
+ \ifnnum#2=0 %
+ \let#1\@empty
+ \else
+ \edef#1{millia\^{}\the#2}%
+ \fi
+}
+% \end{macrocode}
+% Arguments as follows --- same interface as \cs{fc@@recurse@millia}: \interface
+% \begin{macrocode}
+\def\fc@@prefix@millia#1#2{%
+ \fc@@latin@numeral@pefix{#2}{#1}%
+}
+% \end{macrocode}
+% Default value of option `\texttt{power of millia}' is `\texttt{prefix}':
+% \begin{macrocode}
+\let\fc@power@of@millia@init\@gobbletwo
+\let\fc@power@of@millia\fc@@prefix@millia
+% \end{macrocode}
+% \DescribeMacro\fc@@latin@cardinal@pefix Compute a cardinal prefix for n-illion, like \(1 \Rightarrow
+% \textrm{`m'}\), \(2 \Rightarrow \textrm{`bi'}\), \(3 \Rightarrow \textrm{`tri'}\). The algorithm to derive
+% this prefix is that of Russ Rowlett I founds its documentation on Alain Lassine's site:
+% \url{http://www.alain.be/Boece/grands\_nombres.html}. First check that macro is not yet defined.
+% \begin{macrocode}
+\@ifundefined{fc@@latin@cardinal@pefix}{}{%
+ \PackageError{fmtcount}{Duplicate definition}{Redefinition of macro `fc@@latin@cardinal@pefix'}}
+% \end{macrocode}
+% Arguments as follows:\newline\noindent
+% \begin{tabularx}{\linewidth}{@{}>{\raggedleft\arraybackslash\ttfamily}rX@{}}
+% \#1&input number to be formated\\
+% \#2&outut macro name into which to place the formatted result
+% \end{tabularx}
+% \begin{macrocode}
+\def\fc@@latin@cardinal@pefix#1#2{%
+ {%
+% \end{macrocode}
+% First we put input argument into local macro @cs{@tempa} with full expansion.
+% \begin{macrocode}
+ \edef\@tempa{\number#1}%
+% \end{macrocode}
+% Now parse number from expanded input.
+% \begin{macrocode}
+ \expandafter\fc@number@parser\expandafter{\@tempa}%
+ \count2=0 %
+% \end{macrocode}
+% \cs{@tempt} will hold the optional final \texttt{t}, \cs{@tempu} is used to initialize \cs{@tempt} to `t'
+% when the firt non-zero 3digit group is met, which is the job made by \cs{@tempi}.
+% \begin{macrocode}
+ \let\@tempt\@empty
+ \def\@tempu{t}%
+% \end{macrocode}
+% \cs{@tempm} will hold the \texttt{millia\^}\(^{n\div 3}\)
+% \begin{macrocode}
+ \let\@tempm\@empty
+% \end{macrocode}
+% Loop by means of terminal recursion of herinafter defined macro \cs{@templ}. We loop by group of 3 digits.
+% \begin{macrocode}
+ \def\@templ{%
+ \ifnum\count2>\fc@max@weight
+ \let\next\relax
+ \else
+% \end{macrocode}
+% Loop body. Here we read a group of 3 consecutive digits \(d_2d_1d_0\) and place them respectively into
+% \cs{count3}, \cs{count4}, and \cs{count5}.
+% \begin{macrocode}
+ \fc@read@unit{\count3}{\count2}%
+ \advance\count2 by 1 %
+ \fc@read@unit{\count4}{\count2}%
+ \advance\count2 by 1 %
+ \fc@read@unit{\count5}{\count2}%
+ \advance\count2 by 1 %
+% \end{macrocode}
+% If the 3 considered digits \(d_2d_1d_0\) are not all zero, then set \cs{@tempt} to `\texttt{t}' for the
+% first time this event is met.
+% \begin{macrocode}
+ \edef\@tempn{%
+ \ifnum\count3=0\else 1\fi
+ \ifnum\count4=0\else 1\fi
+ \ifnum\count5=0\else 1\fi
+ }%
+ \ifx\@tempn\@empty\else
+ \let\@tempt\@tempu
+ \let\@tempu\@empty
+ \fi
+% \end{macrocode}
+% Now process the current group \(d_2d_1d_0\) of 3 digits.
+% \begin{macrocode}
+ \let\@tempp\@tempa
+ \edef\@tempa{%
+% \end{macrocode}
+% Here we process \(d_{2}\) held by \cs{count5}, that is to say hundreds.
+% \begin{macrocode}
+ \ifcase\count5 %
+ \or cen%
+ \or ducen%
+ \or trecen%
+ \or quadringen%
+ \or quingen%
+ \or sescen%
+ \or septigen%
+ \or octingen%
+ \or nongen%
+ \fi
+% \end{macrocode}
+% Here we process \(d_1d_0\) held by \cs{count4} \& \cs{count3}, that is to say tens and units.
+% \begin{macrocode}
+ \ifnum\count4=0 %
+ % x0(0..9)
+ \ifnum\count2=3 %
+ % Absolute weight zero
+ \ifcase\count3 \@tempt
+ \or m%
+ \or b%
+ \or tr%
+ \or quadr%
+ \or quin\@tempt
+ \or sex\@tempt
+ \or sep\@tempt
+ \or oc\@tempt
+ \or non%
+ \fi
+ \else
+% \end{macrocode}
+% Here the weight of \cs{count3} is \(3\times n\), with \(n>0\), i.e. this is followed by a
+% \texttt{millia\^}\(n\).
+% \begin{macrocode}
+ \ifcase\count3 %
+ \or \ifnum\count2>\fc@max@weight\else un\fi
+ \or d\fc@u@in@duo o%
+ \or tre%
+ \or quattuor%
+ \or quin%
+ \or sex%
+ \or septen%
+ \or octo%
+ \or novem%
+ \fi
+ \fi
+ \else
+ % x(10..99)
+ \ifcase\count3 %
+ \or un%
+ \or d\fc@u@in@duo o%
+ \or tre%
+ \or quattuor%
+ \or quin%
+ \or sex%
+ \or septen%
+ \or octo%
+ \or novem%
+ \fi
+ \ifcase\count4 %
+ \or dec%
+ \or vigin\@tempt
+ \or trigin\@tempt
+ \or quadragin\@tempt
+ \or quinquagin\@tempt
+ \or sexagin\@tempt
+ \or septuagin\@tempt
+ \or octogin\@tempt
+ \or nonagin\@tempt
+ \fi
+ \fi
+% \end{macrocode}
+% Insert the \texttt{millia\^}\(^{(n\div 3)}\) only if \(d_2d_1d_0\not=0\), i.e. if one of \cs{count3}
+% \cs{count4} or \cs{count5} is non zero.
+% \begin{macrocode}
+ \@tempm
+% \end{macrocode}
+% And append previous version of \cs{@tempa}.
+% \begin{macrocode}
+ \@tempp
+ }%
+% \end{macrocode}
+% ``Concatenate'' \texttt{millia} to \cs{@tempm}, so that \cs{@tempm} will expand to
+% \texttt{millia\^}\(^{(n\div 3)+1}\) at the next iteration. Actually whether this is a concatenation or some
+% \texttt{millia} prefixing depends of option `\texttt{power of millia}'.
+% \begin{macrocode}
+ \fc@power@of@millia\@tempm{\count2}%
+ \fi
+ \next
+ }%
+ \let\@tempa\@empty
+ \let\next\@templ
+ \@templ
+% \end{macrocode}
+% Propagate expansion of \cs{@tempa} into \texttt{\#2} after closing bracket.
+% \begin{macrocode}
+ \def\@tempb##1{\def\@tempa{\def#2{##1}}}%
+ \expandafter\@tempb\expandafter{\@tempa}%
+ \expandafter
+ }\@tempa
+}
+% \end{macrocode}
+% \DescribeMacro\fc@@latin@numeral@pefix Compute a numeral prefix
+% like `s\'emel', `bis', `ter', `quater',
+% etc\ldots I found the algorithm to derive this prefix on Alain Lassine's site:
+% \url{http://www.alain.be/Boece/nombres\_gargantuesques.html}. First check that the macro is not yet defined.
+% \begin{macrocode}
+\@ifundefined{fc@@latin@numeral@pefix}{}{%
+ \PackageError{fmtcount}{Duplicate definition}{Redefinition of macro
+ `fc@@latin@numeral@pefix'}}
+% \end{macrocode}
+% Arguments as follows:\newline\noindent
+% \begin{tabularx}{\linewidth}{@{}>{\raggedleft\arraybackslash\ttfamily}rX@{}}
+% \#1& input number to be formatted,\\
+% \#2& outut macro name into which to place the result
+% \end{tabularx}
+% \begin{macrocode}
+\def\fc@@latin@numeral@pefix#1#2{%
+ {%
+ \edef\@tempa{\number#1}%
+ \def\fc@unit@weight{0}%
+ \expandafter\fc@number@parser\expandafter{\@tempa}%
+ \count2=0 %
+% \end{macrocode}
+% Macro \cs{@tempm} will hold the \texttt{millies\^}\(^{n\div 3}\).
+% \begin{macrocode}
+ \let\@tempm\@empty
+% \end{macrocode}
+% Loop over digits. This is done by defining macro \cs{@templ} for terminal recursion.
+% \begin{macrocode}
+ \def\@templ{%
+ \ifnum\count2>\fc@max@weight
+ \let\next\relax
+ \else
+% \end{macrocode}
+% Loop body. Three consecutive digits \(d_{2}d_{1}d_{0}\) are read into counters \cs{count3}, \cs{count4}, and
+% \cs{count5}.
+% \begin{macrocode}
+ \fc@read@unit{\count3}{\count2}%
+ \advance\count2 by 1 %
+ \fc@read@unit{\count4}{\count2}%
+ \advance\count2 by 1 %
+ \fc@read@unit{\count5}{\count2}%
+ \advance\count2 by 1 %
+% \end{macrocode}
+% Check the use of \texttt{duodevicies} instead of \texttt{octodecies}.
+% \begin{macrocode}
+ \let\@tempn\@secondoftwo
+ \ifnum\count3>7 %
+ \ifnum\count4<\fc@duodeandunde
+ \ifnum\count4>0 %
+ \let\@tempn\@firstoftwo
+ \fi
+ \fi
+ \fi
+ \@tempn
+ {% use duodevicies for eighteen
+ \advance\count4 by 1 %
+ \let\@temps\@secondoftwo
+ }{% do not use duodevicies for eighteen
+ \let\@temps\@firstoftwo
+ }%
+ \let\@tempp\@tempa
+ \edef\@tempa{%
+ % hundreds
+ \ifcase\count5 %
+ \expandafter\@gobble
+ \or c%
+ \or duc%
+ \or trec%
+ \or quadring%
+ \or quing%
+ \or sesc%
+ \or septing%
+ \or octing%
+ \or nong%
+ \fi
+ {enties}%
+ \ifnum\count4=0 %
+% \end{macrocode}
+% Here \(d_{2}d_{1}d_{0}\) is such that \(d_{1} = 0\).
+% \begin{macrocode}
+ \ifcase\count3 %
+ \or
+ \ifnum\count2=3 %
+ s\fc@prefix@eaccute emel%
+ \else
+ \ifnum\count2>\fc@max@weight\else un\fi
+ \fi
+ \or bis%
+ \or ter%
+ \or quater%
+ \or quinquies%
+ \or sexies%
+ \or septies%
+ \or octies%
+ \or novies%
+ \fi
+ \else
+% \end{macrocode}
+% Here \(d_{2}d_{1}d_{0}\) is such that \(d_{1} \geq 1\).
+% \begin{macrocode}
+ \ifcase\count3 %
+ \or un%
+ \or d\fc@u@in@duo o%
+ \or ter%
+ \or quater%
+ \or quin%
+ \or sex%
+ \or septen%
+ \or \@temps{octo}{duod\fc@prefix@eaccute e}% x8 = two before next (x+1)0
+ \or \@temps{novem}{und\fc@prefix@eaccute e}% x9 = one before next (x+1)0
+ \fi
+ \ifcase\count4 %
+ % can't get here
+ \or d\fc@prefix@eaccute ec%
+ \or vic%
+ \or tric%
+ \or quadrag%
+ \or quinquag%
+ \or sexag%
+ \or septuag%
+ \or octog%
+ \or nonag%
+ \fi
+ ies%
+ \fi
+ % Insert the millies^(n/3) only if one of \count3 \count4 \count5 is non zero
+ \@tempm
+ % add up previous version of \@tempa
+ \@tempp
+ }%
+% \end{macrocode}
+% Concatenate \texttt{millies} to \cs{@tempm} so that it is equal to \texttt{millies\^}\(^{n\div 3}\) at the
+% next iteration. Here we just have plain concatenation, contrary to cardinal for which a prefix can be used
+% instead.
+% \begin{macrocode}
+ \let\@tempp\@tempp
+ \edef\@tempm{millies\@tempp}%
+ \fi
+ \next
+ }%
+ \let\@tempa\@empty
+ \let\next\@templ
+ \@templ
+% \end{macrocode}
+% Now propagate expansion of \@tempa into \texttt{\#2} after closing bracket.
+% \begin{macrocode}
+ \def\@tempb##1{\def\@tempa{\def#2{##1}}}%
+ \expandafter\@tempb\expandafter{\@tempa}%
+ \expandafter
+ }\@tempa
+}
+% \end{macrocode}
+% Stuff for calling macros. Construct \cs{fc@call}\meta{some macro} can be used to pass two arguments to
+% \meta{some macro} with a configurable calling convention:
+% \begin{itemize}
+% \item the calling convention is such that there is one mandatory argument \meta{marg} and an optional
+% argument \meta{oarg}
+% \item either \cs{fc@call} is \cs{let} to be equal to \cs{fc@call@opt@arg@second}, and then calling
+% convention is that the \meta{marg} is first and \meta{oarg} is second,
+% \item or \cs{fc@call} is \cs{let} to be equal to \cs{fc@call@opt@arg@first}, and then calling convention is
+% that the \meta{oarg} is first and \meta{aarg} is second,
+% \item if \meta{oarg} is absent, then it is by convention set empty,
+% \item \meta{some macro} is supposed to have two mandatory arguments of which \meta{oarg} is passed to the
+% first, and \meta{marg} is passed to the second, and
+% \item \meta{some macro} is called within a group.
+% \end{itemize}
+% \begin{macrocode}
+\def\fc@call@opt@arg@second#1#2{%
+ \def\@tempb{%
+ \ifx[\@tempa
+ \def\@tempc[####1]{%
+ {#1{####1}{#2}}%
+ }%
+ \else
+ \def\@tempc{{#1{}{#2}}}%
+ \fi
+ \@tempc
+ }%
+ \futurelet\@tempa
+ \@tempb
+}
+% \end{macrocode}
+% \begin{macrocode}
+\def\fc@call@opt@arg@first#1{%
+ \def\@tempb{%
+ \ifx[\@tempa
+ \def\@tempc[####1]####2{{#1{####1}{####2}}}%
+ \else
+ \def\@tempc####1{{#1{}{####1}}}%
+ \fi
+ \@tempc
+ }%
+ \futurelet\@tempa
+ \@tempb
+}
+
+\let\fc@call\fc@call@opt@arg@first
+% \end{macrocode}
+% User API.
+%
+% \DescribeMacro\@latinnumeralstringnum Macro \cs{@latinnumeralstringnum}. Arguments as
+% follows:\newline\noindent
+% \begin{tabularx}{\linewidth}{@{}>{\raggedleft\arraybackslash\ttfamily}rX@{}}
+% \#1&local options\\
+% \#2& input number
+% \end{tabularx}
+% \begin{macrocode}
+\newcommand*{\@latinnumeralstringnum}[2]{%
+ \setkeys{fcprefix}{#1}%
+ \fc@@latin@numeral@pefix{#2}\@tempa
+ \@tempa
+}
+% \end{macrocode}
+% Arguments as follows:\newline\noindent
+% \begin{tabularx}{\linewidth}{@{}>{\raggedleft\arraybackslash\ttfamily}rX@{}}
+% \#1&local options\\
+% \#2&input counter
+% \end{tabularx}
+% \begin{macrocode}
+\newcommand*{\@latinnumeralstring}[2]{%
+ \setkeys{fcprefix}{#1}%
+ \expandafter\let\expandafter
+ \@tempa\expandafter\csname c@#2\endcsname
+ \expandafter\fc@@latin@numeral@pefix\expandafter{\the\@tempa}\@tempa
+ \@tempa
+}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*{\latinnumeralstring}{%
+ \fc@call\@latinnumeralstring
+}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*{\latinnumeralstringnum}{%
+ \fc@call\@latinnumeralstringnum
+}
+% \end{macrocode}
+\iffalse Local variables: \fi
+\iffalse mode: docTeX \fi
+\iffalse End: \fi
+%\iffalse
+% \begin{macrocode}
+%</fcprefix.sty>
+% \end{macrocode}
+%\fi
+%\iffalse
+% \begin{macrocode}
%<*fmtcount.sty>
% \end{macrocode}
%\fi
@@ -621,9 +2007,10 @@
% This section deals with the code for |fmtcount.sty|
% \begin{macrocode}
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{fmtcount}[2009/10/02 v1.31]
+\ProvidesPackage{fmtcount}[2012/06/18 v2.0]
\RequirePackage{ifthen}
\RequirePackage{keyval}
+\RequirePackage{etoolbox}
% \end{macrocode}
% \changes{1.3}{2007/7/19}{no
%longer using xspace package}
@@ -657,21 +2044,82 @@
\providecommand*{\padzeroes}[1][17]{\c@padzeroesN=#1}
% \end{macrocode}
%\end{macro}
+%
+%\begin{macro}{\FCloadlang}
+%changes{2.0}{2012-06-18}{new}
+%\begin{definition}
+%\cs{FCloadlang}\marg{language}
+%\end{definition}
+% Load \styfmt{fmtcount} language file,
+% \texttt{fc-}\meta{language}\texttt{.def}, unless already loaded.
+% \begin{macrocode}
+\newcommand*{\FCloadlang}[1]{%
+ \@FC@iflangloaded{#1}{}%
+ {%
+ \input{fc-#1.def}%
+ }%
+}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\@FC@iflangloaded}
+%changes{2.0}{2012-06-18}{new}
+%\begin{definition}
+%\cs{@FC@iflangloaded}\marg{language}\marg{true}\marg{false}
+%\end{definition}
+%If fmtcount language definition file \texttt{fc-}\meta{language}\texttt{.def} has
+%been loaded, do \meta{true} otherwise do \meta{false}
+% \begin{macrocode}
+\newcommand{\@FC@iflangloaded}[3]{%
+ \ifcsundef{ver@fc-#1.def}{#3}{#2}%
+}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\ProvidesFCLanguage}
+%changes{2.0}{2012-06-18}{new}
+% Declare fmtcount language definition file. Adapted from
+% \ics{ProvidesFile}.
+% \begin{macrocode}
+\newcommand*{\ProvidesFCLanguage}[1]{%
+ \ProvidesFile{fc-#1.def}%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\@fc@loadifbabelldf}
+%\begin{definition}
+%\cs{@fc@loadigbabelldf}\marg{language}
+%\end{definition}
+%Loads fmtcount language file,
+%\texttt{fc-}\meta{language}\texttt{.def},
+% if babel language definition file
+% \meta{language}\texttt{.ldf} has been loaded.
+% \begin{macrocode}
+\newcommand*{\@fc@loadifbabelldf}[1]{%
+ \ifcsundef{ver@#1.ldf}{}{\FCloadlang{#1}}%
+}
+% \end{macrocode}
+%\end{macro}
+%
% Load appropriate language definition files:
-%\changes{v1.1}{14 June 2007}{added check for UKenglish,
+%\changes{1.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}}
+%\changes{2.0}{2012-06-18}{changed check for \cs{l@}\meta{language}
+% to check for \cs{date}\meta{language}}
+% \begin{macrocode}
+\@fc@loadifbabelldf{english}
+\@fc@loadifbabelldf{UKenglish}
+\@fc@loadifbabelldf{british}
+\@fc@loadifbabelldf{USenglish}
+\@fc@loadifbabelldf{american}
+\@fc@loadifbabelldf{spanish}
+\@fc@loadifbabelldf{portuges}
+\@fc@loadifbabelldf{french}
+\@fc@loadifbabelldf{frenchb}
+\@fc@loadifbabelldf{german}%
+\@fc@loadifbabelldf{germanb}%
+\@fc@loadifbabelldf{ngerman}%
+\@fc@loadifbabelldf{ngermanb}%
+\@fc@loadifbabelldf{italian}
% \end{macrocode}
%\begin{macro}{\fmtcount@french}
% Define keys for use with |\fmtcountsetoptions|.
@@ -679,31 +2127,42 @@
%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}
+%\begin{option}{french}
+% \begin{macrocode}
+\define@key{fmtcount}{french}[france]{%
+ \@ifundefined{datefrench}%
+ {%
+ \PackageError{fmtcount}%
+ {Language `french' not defined}%
+ {You need to load babel before loading fmtcount}%
+ }%
+ {%
+ \setkeys{fcfrench}{#1}%
+ }%
+}
+% \end{macrocode}
+%\end{option}
+%\begin{option}{fmtord}
% 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'}}}
+ \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}
+%\end{option}
%\begin{macro}{\iffmtord@abbrv}
% Key to determine whether the ordinal should be abbreviated
% (language dependent, currently only affects French ordinals.)
@@ -711,61 +2170,92 @@ or `user'}}}
\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'}}}
+ \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{option}{prefix}
+%\changes{2.0}{2012-06-18}{new}
+% \begin{macrocode}
+\define@key{fmtcount}{prefix}[scale=long]{%
+ \RequirePackage{fmtprefix}%
+ \fmtprefixsetoption{#1}%
+}
+% \end{macrocode}
+%\end{option}
%\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}}}{%
-}}
+ \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.
+%\changes{2.0}{2012-06-18}{Now no message if fmtcount.cfg not found}
% \begin{macrocode}
-\InputIfFileExists{fmtcount.cfg}{%
-\typeout{Using configuration file fmtcount.cfg}}{%
-\typeout{No configuration file fmtcount.cfg found.}}
+\InputIfFileExists{fmtcount.cfg}%
+{%
+ \PackageInfo{fmtcount}{Using configuration file fmtcount.cfg}%
+}%
+{%
+}
% \end{macrocode}
-%Declare options
+%\begin{option}{level}
% \begin{macrocode}
\DeclareOption{level}{\def\fmtcount@fmtord{level}%
-\def\fmtord#1{#1}}
+ \def\fmtord#1{#1}}
+% \end{macrocode}
+%\end{option}
+%\begin{option}{raise}
+% \begin{macrocode}
\DeclareOption{raise}{\def\fmtcount@fmtord{raise}%
-\def\fmtord#1{\textsuperscript{#1}}}
+ \def\fmtord#1{\textsuperscript{#1}}}
% \end{macrocode}
+%\end{option}
% Process package options
% \begin{macrocode}
\ProcessOptions
@@ -776,15 +2266,17 @@ or `user'}}}
%\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.)
+% date, time, ordinal and numberstring commands. (The
+% \styfmt{fmtcount} package was originally part of the
+% \sty{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}
+ \@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
@@ -805,24 +2297,29 @@ or `user'}}}
% 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}
+ \@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}
@@ -831,87 +2328,111 @@ or `user'}}}
% 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}
+ \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 number from 0 to 15 into lowercase hexadecimal notation.
+% \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
+}
+% \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}
-
+ \@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}
+% Converts number from 0 to 15 into uppercase hexadecimal notation.
+% \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
+}
+% \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}
+ \@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}
@@ -920,21 +2441,21 @@ or `user'}}}
% 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
+ \@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
@@ -944,21 +2465,21 @@ or `user'}}}
% 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
+ \@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
@@ -968,28 +2489,31 @@ or `user'}}}
% 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}
+ \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}
@@ -998,42 +2522,45 @@ or `user'}}}
% 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}
+ \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.
+% \cs{@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}
+ \if\relax#1%
+ \else
+ \advance\@strctr by 1\relax
+ \@fmtc@count#2\relax
+ \fi
+}
% \end{macrocode}
%\end{macro}
%\begin{macro}{\@decimal}
@@ -1041,15 +2568,15 @@ or `user'}}}
% 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
+ \@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
@@ -1076,8 +2603,9 @@ or `user'}}}
% to prevent it clashing with the memoir class.
% \begin{macrocode}
\newcommand{\FCordinal}[1]{%
-\expandafter\protect\expandafter\ordinalnum{%
-\expandafter\the\csname c@#1\endcsname}}
+ \expandafter\protect\expandafter\ordinalnum{%
+ \expandafter\the\csname c@#1\endcsname}%
+}
% \end{macrocode}
%\end{macro}
%\begin{macro}{\ordinal}
@@ -1085,9 +2613,13 @@ or `user'}}}
% 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.}}
+\@ifundefined{ordinal}
+ {\let\ordinal\FCordinal}%
+ {%
+ \PackageWarning{fmtcount}%
+ {\string\ordinal \space already defined use
+ \string\FCordinal \space instead.}
+ }
% \end{macrocode}
%\end{macro}
%\begin{macro}{\ordinalnum}
@@ -1096,8 +2628,11 @@ or `user'}}}
%\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]}}
+\newcommand*{\ordinalnum}[1]{%
+ \new@ifnextchar[%
+ {\@ordinalnum{#1}}%
+ {\@ordinalnum{#1}[m]}%
+}
% \end{macrocode}
%\end{macro}
%\begin{macro}{\@ordinalnum}
@@ -1106,22 +2641,31 @@ or `user'}}}
%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}%
+\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}%
}%
- \protect\@ordinalM{#1}{\@fc@ordstr}%
}%
- }%
-\@fc@ordstr
-}}
+ \@fc@ordstr
+ }%
+}
% \end{macrocode}
%\end{macro}
%\begin{macro}{\storeordinal}
@@ -1129,8 +2673,9 @@ or `user'}}}
% is identifying name, second argument is a counter.)
% \begin{macrocode}
\newcommand*{\storeordinal}[2]{%
-\expandafter\protect\expandafter\storeordinalnum{#1}{%
-\expandafter\the\csname c@#2\endcsname}}
+ \expandafter\protect\expandafter\storeordinalnum{#1}{%
+ \expandafter\the\csname c@#2\endcsname}%
+}
% \end{macrocode}
%\end{macro}
%\begin{macro}{\storeordinalnum}
@@ -1139,23 +2684,38 @@ or `user'}}}
% count register.)
% \begin{macrocode}
\newcommand*{\storeordinalnum}[2]{%
-\@ifnextchar[{\@storeordinalnum{#1}{#2}}{%
-\@storeordinalnum{#1}{#2}[m]}}
+ \@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}
+ \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}
@@ -1168,8 +2728,9 @@ Available options are m or f}}%
% Display ordinal as a string (argument is a counter)
% \begin{macrocode}
\newcommand*{\ordinalstring}[1]{%
-\expandafter\protect\expandafter\ordinalstringnum{%
-\expandafter\the\csname c@#1\endcsname}}
+ \expandafter\protect\expandafter\ordinalstringnum{%
+ \expandafter\the\csname c@#1\endcsname}%
+}
% \end{macrocode}
%\end{macro}
%\begin{macro}{\ordinalstringnum}
@@ -1177,23 +2738,43 @@ Available options are m or f}}%
% number.)
%\changes{1.31}{2009/10/02}{replaced \cs{@ifnextchar} with
%\cs{new@ifnextchar}}
+%\changes{1.33}{2009/10/15}{Made robust}
% \begin{macrocode}
\newcommand{\ordinalstringnum}[1]{%
-\new@ifnextchar[{\@ordinal@string{#1}}{\@ordinal@string{#1}[m]}}
+ \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}}
+\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}
@@ -1202,8 +2783,9 @@ Available options are m or f}}%
% required number.
% \begin{macrocode}
\newcommand*{\storeordinalstring}[2]{%
-\expandafter\protect\expandafter\storeordinalstringnum{#1}{%
-\expandafter\the\csname c@#2\endcsname}}
+ \expandafter\protect\expandafter\storeordinalstringnum{#1}{%
+ \expandafter\the\csname c@#2\endcsname}%
+}
% \end{macrocode}
%\end{macro}
%\begin{macro}{\storeordinalstringnum}
@@ -1211,23 +2793,38 @@ Available options are m or f}}%
% 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]}}
+ \@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}
+ \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}
@@ -1235,8 +2832,9 @@ Available options are m or f}}%
% (argument is a counter)
% \begin{macrocode}
\newcommand*{\Ordinalstring}[1]{%
-\expandafter\protect\expandafter\Ordinalstringnum{%
-\expandafter\the\csname c@#1\endcsname}}
+ \expandafter\protect\expandafter\Ordinalstringnum{%
+ \expandafter\the\csname c@#1\endcsname}%
+}
% \end{macrocode}
%\end{macro}
%\begin{macro}{\Ordinalstringnum}
@@ -1246,22 +2844,41 @@ Available options are m or f}}%
%\cs{new@ifnextchar}}
% \begin{macrocode}
\newcommand*{\Ordinalstringnum}[1]{%
-\new@ifnextchar[{\@Ordinal@string{#1}}{\@Ordinal@string{#1}[m]}}
+ \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}}
+\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}
@@ -1271,8 +2888,9 @@ Available options are m, f or n}}%
% required number.
% \begin{macrocode}
\newcommand*{\storeOrdinalstring}[2]{%
-\expandafter\protect\expandafter\storeOrdinalstringnum{#1}{%
-\expandafter\the\csname c@#2\endcsname}}
+ \expandafter\protect\expandafter\storeOrdinalstringnum{#1}{%
+ \expandafter\the\csname c@#2\endcsname}%
+}
% \end{macrocode}
%\end{macro}
%\begin{macro}{\storeOrdinalstringnum}
@@ -1281,8 +2899,10 @@ Available options are m, f or n}}%
% is a count register or number.
% \begin{macrocode}
\newcommand*{\storeOrdinalstringnum}[2]{%
-\@ifnextchar[{\@store@Ordinal@string{#1}{#2}}{%
-\@store@Ordinal@string{#1}{#2}[m]}}
+ \@ifnextchar[%
+ {\@store@Ordinal@string{#1}{#2}}%
+ {\@store@Ordinal@string{#1}{#2}[m]}%
+}
% \end{macrocode}
%\end{macro}
%\begin{macro}{\@store@Ordinal@string}
@@ -1290,15 +2910,28 @@ Available options are m, f or n}}%
% 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}
+ \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}
%
@@ -1307,8 +2940,9 @@ Available options are m or f}}%
% 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}}
+ \expandafter\protect\expandafter\storeORDINALstringnum{#1}{%
+ \expandafter\the\csname c@#2\endcsname}%
+}
% \end{macrocode}
%\end{macro}
%\begin{macro}{\storeORDINALstringnum}
@@ -1316,24 +2950,40 @@ Available options are m or f}}%
% number.
% \begin{macrocode}
\newcommand*{\storeORDINALstringnum}[2]{%
-\@ifnextchar[{\@store@ORDINAL@string{#1}{#2}}{%
-\@store@ORDINAL@string{#1}{#2}[m]}}
+ \@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}}}
+ \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}
@@ -1341,8 +2991,10 @@ Available options are m or f}}%
% argument must be a counter.
% \begin{macrocode}
\newcommand*{\ORDINALstring}[1]{%
-\expandafter\protect\expandafter\ORDINALstringnum{%
-\expandafter\the\csname c@#1\endcsname}}
+ \expandafter\protect\expandafter\ORDINALstringnum{%
+ \expandafter\the\csname c@#1\endcsname
+ }%
+}
% \end{macrocode}
%\end{macro}
%\begin{macro}{\ORDINALstringnum}
@@ -1351,22 +3003,40 @@ Available options are m or f}}%
%\cs{new@ifnextchar}}
% \begin{macrocode}
\newcommand*{\ORDINALstringnum}[1]{%
-\new@ifnextchar[{\@ORDINAL@string{#1}}{\@ORDINAL@string{#1}[m]}}
+ \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}}}
+\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}
@@ -1375,31 +3045,47 @@ Available options are m, f or n}}%
% containing the number.
% \begin{macrocode}
\newcommand*{\storenumberstring}[2]{%
-\expandafter\protect\expandafter\storenumberstringnum{#1}{%
-\expandafter\the\csname c@#2\endcsname}}
+ \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]}}
+ \@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}
+ \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}
@@ -1407,8 +3093,9 @@ Available options are m, f or n}}%
% must be a counter.
% \begin{macrocode}
\newcommand*{\numberstring}[1]{%
-\expandafter\protect\expandafter\numberstringnum{%
-\expandafter\the\csname c@#1\endcsname}}
+ \expandafter\protect\expandafter\numberstringnum{%
+ \expandafter\the\csname c@#1\endcsname}%
+}
% \end{macrocode}
%\end{macro}
%\begin{macro}{\numberstringnum}
@@ -1417,7 +3104,9 @@ Available options are m, f or n}}%
%\cs{new@ifnextchar}}
% \begin{macrocode}
\newcommand*{\numberstringnum}[1]{%
-\new@ifnextchar[{\@number@string{#1}}{\@number@string{#1}[m]}%
+ \new@ifnextchar[%
+ {\@number@string{#1}}%
+ {\@number@string{#1}[m]}%
}
% \end{macrocode}
%\end{macro}
@@ -1425,15 +3114,31 @@ Available options are m, f or n}}%
%\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}}
+\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}
@@ -1441,31 +3146,47 @@ Available options are m, f or n}}%
% identifying name, second argument is a counter.
% \begin{macrocode}
\newcommand*{\storeNumberstring}[2]{%
-\expandafter\protect\expandafter\storeNumberstringnum{#1}{%
-\expandafter\the\csname c@#2\endcsname}}
+ \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]}}
+ \@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}
+ \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}
@@ -1473,8 +3194,9 @@ Available options are m, f or n}}%
% a counter.
% \begin{macrocode}
\newcommand*{\Numberstring}[1]{%
-\expandafter\protect\expandafter\Numberstringnum{%
-\expandafter\the\csname c@#1\endcsname}}
+ \expandafter\protect\expandafter\Numberstringnum{%
+ \expandafter\the\csname c@#1\endcsname}%
+}
% \end{macrocode}
%\end{macro}
%\begin{macro}{\Numberstringnum}
@@ -1483,21 +3205,40 @@ Available options are m, f or n}}%
%\cs{new@ifnextchar}}
% \begin{macrocode}
\newcommand*{\Numberstringnum}[1]{%
-\new@ifnextchar[{\@Number@string{#1}}{\@Number@string{#1}[m]}}
+ \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}}
+\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}
@@ -1505,8 +3246,9 @@ Available options are m, f or n}}%
% 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}}
+ \expandafter\protect\expandafter\storeNUMBERstringnum{#1}{%
+ \expandafter\the\csname c@#2\endcsname}%
+}
% \end{macrocode}
%\end{macro}
%\begin{macro}{\storeNUMBERstringnum}
@@ -1514,24 +3256,40 @@ Available options are m, f or n}}%
% number.
% \begin{macrocode}
\newcommand{\storeNUMBERstringnum}[2]{%
-\@ifnextchar[{\@store@NUMBER@string{#1}{#2}}{%
-\@store@NUMBER@string{#1}{#2}[m]}}
+ \@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}}}
+ \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}
@@ -1539,8 +3297,9 @@ Available options are m or f}}%
% argument must be a counter.
% \begin{macrocode}
\newcommand*{\NUMBERstring}[1]{%
-\expandafter\protect\expandafter\NUMBERstringnum{%
-\expandafter\the\csname c@#1\endcsname}}
+ \expandafter\protect\expandafter\NUMBERstringnum{%
+ \expandafter\the\csname c@#1\endcsname}%
+}
% \end{macrocode}
%\end{macro}
%\begin{macro}{\NUMBERstringnum}
@@ -1549,96 +3308,123 @@ Available options are m or f}}%
%\cs{new@ifnextchar}}
% \begin{macrocode}
\newcommand*{\NUMBERstringnum}[1]{%
-\new@ifnextchar[{\@NUMBER@string{#1}}{\@NUMBER@string{#1}[m]}}
+ \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}}}
+\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}}
+ \expandafter\protect\expandafter\@binary{%
+ \expandafter\the\csname c@#1\endcsname}%
+}
% \end{macrocode}
%\end{macro}
%\begin{macro}{\aaalph}
-% Like \verb"\alph", but goes beyond 26.
+% Like \ics{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}}
+ \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}}
+ \expandafter\protect\expandafter\@AAAlph{%
+ \expandafter\the\csname c@#1\endcsname}%
+}
% \end{macrocode}
%\end{macro}
%\begin{macro}{\abalph}
-% Like \verb"\alph", but goes beyond 26.
+% Like \ics{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}}
+ \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}}
+ \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}}
+ \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}}
+ \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}}
+ \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}}
+ \expandafter\protect\expandafter\@decimal{%
+ \expandafter\the\csname c@#1\endcsname}%
+}
% \end{macrocode}
%\end{macro}
%
@@ -1649,165 +3435,277 @@ Available options are m, f or n}}%
% 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
+\def\@setdef@ultfmtcount{%
+ \@ifundefined{@ordinalMenglish}{\FCloadlang{english}}{}%
+ \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}:
+%\changes{2.0}{2012-06-18}{changed errors to warnings for
+%unsupported languages}
% \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}}%
+ \def\@numberstringM{%
+ \@ifundefined{@numberstringM\languagename}%
+ {%
+ \PackageWarning{fmtcount}%
+ {No support for \string\numberstring\space for
+ language '\languagename'}%
+ \@numberstringMenglish
+ }%
+ {%
+ \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}}%
+ \def\@numberstringF{%
+ \@ifundefined{@numberstringF\languagename}%
+ {%
+ \PackageWarning{fmtcount}%
+ {No support for \string\numberstring\space for
+ language '\languagename'}%
+ \@numberstringMenglish
+ }%
+ {%
+ \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}}%
+ \def\@numberstringN{%
+ \@ifundefined{@numberstringN\languagename}%
+ {%
+ \PackageWarning{fmtcount}%
+ {No support for \string\numberstring\space for
+ language '\languagename'}%
+ \@numberstringMenglish
+ }%
+ {%
+ \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}}%
+ \def\@NumberstringM{%
+ \@ifundefined{@NumberstringM\languagename}%
+ {%
+ \PackageWarning{fmtcount}%
+ {No support for \string\Numberstring\space
+ for language '\languagename'}%
+ \@NumberstringMenglish
+ }%
+ {%
+ \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}}%
+ \def\@NumberstringF{%
+ \@ifundefined{@NumberstringF\languagename}%
+ {%
+ \PackageWarning{fmtcount}%
+ {No support for \string\Numberstring\space
+ for language '\languagename'}%
+ \@NumberstringMenglish
+ }%
+ {%
+ \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}}%
+ \def\@NumberstringN{%
+ \@ifundefined{@NumberstringN\languagename}%
+ {%
+ \PackageWarning{fmtcount}%
+ {No support for \string\Numberstring\space
+ for language '\languagename'}%
+ \@NumberstringMenglish
+ }%
+ {%
+ \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}}%
+ \def\@ordinalM{%
+ \@ifundefined{@ordinalM\languagename}%
+ {%
+ \PackageWarning{fmtcount}%
+ {No support for \string\ordinal\space
+ for language '\languagename'}%
+ \@ordinalMenglish
+ }%
+ {%
+ \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}}%
+ \def\@ordinalF{%
+ \@ifundefined{@ordinalF\languagename}%
+ {%
+ \PackageWarning{fmtcount}%
+ {No support for \string\ordinal\space
+ for language '\languagename'}%
+ \@ordinalMenglish
+ }%
+ {%
+ \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}}%
+ \def\@ordinalN{%
+ \@ifundefined{@ordinalN\languagename}%
+ {%
+ \PackageWarning{fmtcount}%
+ {No support for \string\ordinal\space
+ for language '\languagename'}%
+ \@ordinalMenglish
+ }%
+ {%
+ \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}}%
+ \def\@ordinalstringM{%
+ \@ifundefined{@ordinalstringM\languagename}%
+ {%
+ \PackageWarning{fmtcount}%
+ {No support for \string\ordinalstring\space
+ for language '\languagename'}%
+ \@ordinalstringMenglish
+ }%
+ {%
+ \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}}%
+ \def\@ordinalstringF{%
+ \@ifundefined{@ordinalstringF\languagename}%
+ {%
+ \PackageWarning{fmtcount}%
+ {No support for \string\ordinalstring\space
+ for language '\languagename'}%
+ \@ordinalstringMenglish
+ }%
+ {%
+ \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}}%
+ \def\@ordinalstringN{%
+ \@ifundefined{@ordinalstringN\languagename}%
+ {%
+ \PackageWarning{fmtcount}%
+ {No support for \string\ordinalstring\space
+ for language '\languagename'}%
+ \@ordinalstringMenglish
+ }%
+ {%
+ \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}}%
+ \def\@OrdinalstringM{%
+ \@ifundefined{@OrdinalstringM\languagename}%
+ {%
+ \PackageWarning{fmtcount}%
+ {No support for \string\Ordinalstring\space
+ for language '\languagename'}%
+ \@OrdinalstringMenglish
+ }%
+ {%
+ \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}}%
+ \def\@OrdinalstringF{%
+ \@ifundefined{@OrdinalstringF\languagename}%
+ {%
+ \PackageWarning{fmtcount}%
+ {No support for \string\Ordinalstring\space
+ for language '\languagename'}%
+ \@OrdinalstringMenglish
+ }%
+ {%
+ \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}}
+ \def\@OrdinalstringN{%
+ \@ifundefined{@OrdinalstringN\languagename}%
+ {%
+ \PackageWarning{fmtcount}%
+ {No support for \string\Ordinalstring\space
+ for language '\languagename'}%
+ \@OrdinalstringMenglish
+ }%
+ {%
+ \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}}
+\@ifpackageloaded{babel}%
+{%
+ \@set@mulitling@fmtcount
+}%
+{%
+ \@ifpackageloaded{ngerman}%
+ {%
+ \FCloadlang{ngerman}%
+ \@set@mulitling@fmtcount
+ }%
+ {%
+ \@setdef@ultfmtcount
+ }%
+}
% \end{macrocode}
% Backwards compatibility:
% \begin{macrocode}
@@ -1817,6 +3715,7 @@ The fmtcount package currently does not support language
\let\@numberstring=\@numberstringM
\let\@Numberstring=\@NumberstringM
% \end{macrocode}
+
%\iffalse
% \begin{macrocode}
%</fmtcount.sty>
@@ -1824,17 +3723,55 @@ The fmtcount package currently does not support language
%\fi
%\iffalse
% \begin{macrocode}
+%<*fc-american.def>
+% \end{macrocode}
+%\fi
+% \subsubsection{fc-american.def}
+% American English definitions
+% \begin{macrocode}
+\ProvidesFCLanguage{american}[2012/06/18]
+% \end{macrocode}
+% Loaded fc-USenglish.def if not already loaded
+% \begin{macrocode}
+\FCloadlang{USenglish}
+% \end{macrocode}
+% These are all just synonyms for the commands provided by
+% fc-USenglish.def.
+% \begin{macrocode}
+\let\@ordinalMamerican\@ordinalMUSenglish
+\let\@ordinalFamerican\@ordinalMUSenglish
+\let\@ordinalNamerican\@ordinalMUSenglish
+\let\@numberstringMamerican\@numberstringMUSenglish
+\let\@numberstringFamerican\@numberstringMUSenglish
+\let\@numberstringNamerican\@numberstringMUSenglish
+\let\@NumberstringMamerican\@NumberstringMUSenglish
+\let\@NumberstringFamerican\@NumberstringMUSenglish
+\let\@NumberstringNamerican\@NumberstringMUSenglish
+\let\@ordinalstringMamerican\@ordinalstringMUSenglish
+\let\@ordinalstringFamerican\@ordinalstringMUSenglish
+\let\@ordinalstringNamerican\@ordinalstringMUSenglish
+\let\@OrdinalstringMamerican\@OrdinalstringMUSenglish
+\let\@OrdinalstringFamerican\@OrdinalstringMUSenglish
+\let\@OrdinalstringNamerican\@OrdinalstringMUSenglish
+% \end{macrocode}
+%\iffalse
+% \begin{macrocode}
+%</fc-american.def>
+% \end{macrocode}
+%\fi
+%\iffalse
+% \begin{macrocode}
%<*fc-british.def>
% \end{macrocode}
%\fi
% \subsubsection{fc-british.def}
% British definitions
% \begin{macrocode}
-\ProvidesFile{fc-british}[2007/06/14]
+\ProvidesFCLanguage{british}[2012/06/18]
% \end{macrocode}
-% Check that fc-english.def has been loaded
+% Load fc-english.def, if not already loaded
% \begin{macrocode}
-\@ifundefined{@ordinalMenglish}{\input{fc-english.def}}{}
+\FCloadlang{english}
% \end{macrocode}
% These are all just synonyms for the commands provided by
% fc-english.def.
@@ -1868,7 +3805,7 @@ The fmtcount package currently does not support language
% \subsubsection{fc-english.def}
% English definitions
% \begin{macrocode}
-\ProvidesFile{fc-english}[2007/05/26]
+\ProvidesFCLanguage{english}[2012/06/18]
% \end{macrocode}
% Define macro that converts a number or count register (first
% argument) to an ordinal, and stores the result in the
@@ -2035,7 +3972,6 @@ this number}%
\def#2{}%
\@strctr=#1\relax \divide\@strctr by 1000\relax
\ifnum\@strctr>9
-% #1 is greater or equal to 10000
\divide\@strctr by 10
\ifnum\@strctr>1\relax
\let\@@fc@numstr#2\relax
@@ -2110,15 +4046,16 @@ this number}%
% control sequence.
% \begin{macrocode}
\DeclareRobustCommand{\@numberstringMenglish}[2]{%
-\let\@unitstring=\@@unitstringenglish
-\let\@teenstring=\@@teenstringenglish
+\let\@unitstring=\@@unitstringenglish
+\let\@teenstring=\@@teenstringenglish
\let\@tenstring=\@@tenstringenglish
\def\@hundred{hundred}\def\@thousand{thousand}%
\def\@andname{and}%
\@@numberstringenglish{#1}{#2}%
}
% \end{macrocode}
-% There is no gender in English, so make feminine and neuter the same
+% There is no gender in English, so make feminine and neuter the
+% same
% as the masculine.
% \begin{macrocode}
\let\@numberstringFenglish=\@numberstringMenglish
@@ -2129,14 +4066,15 @@ this number}%
% sequence.
% \begin{macrocode}
\newcommand*{\@NumberstringMenglish}[2]{%
-\let\@unitstring=\@@Unitstringenglish
-\let\@teenstring=\@@Teenstringenglish
+\let\@unitstring=\@@Unitstringenglish
+\let\@teenstring=\@@Teenstringenglish
\let\@tenstring=\@@Tenstringenglish
\def\@hundred{Hundred}\def\@thousand{Thousand}%
\def\@andname{and}%
\@@numberstringenglish{#1}{#2}}
% \end{macrocode}
-% There is no gender in English, so make feminine and neuter the same
+% There is no gender in English, so make feminine and neuter the
+% same
% as the masculine.
% \begin{macrocode}
\let\@NumberstringFenglish=\@NumberstringMenglish
@@ -2175,9 +4113,9 @@ zeroth%
\or ninetieth%
\fi
}
-% \end{macrocode}
+% \end{macrocode}
% The teens:
-% \begin{macrocode}
+% \begin{macrocode}
\newcommand*{\@@teenthstringenglish}[1]{%
\ifcase#1\relax
tenth%
@@ -2192,9 +4130,9 @@ tenth%
\or nineteenth%
\fi
}
-% \end{macrocode}
+% \end{macrocode}
% As before, but with the first letter in upper case. The units:
-% \begin{macrocode}
+% \begin{macrocode}
\newcommand*{\@@Unitthstringenglish}[1]{%
\ifcase#1\relax
Zeroth%
@@ -2264,7 +4202,9 @@ this number}%
\fi
\@strctr=#1\relax \divide\@strctr by 1000\relax
\ifnum\@strctr>9\relax
-% #1 is greater or equal to 10000
+% \end{macrocode}
+% \#1 is greater or equal to 10000
+% \begin{macrocode}
\divide\@strctr by 10
\ifnum\@strctr>1\relax
\let\@@fc@ordstr#2\relax
@@ -2365,10 +4305,10 @@ this number}%
% control sequence in which the resulting text is stored.
% \begin{macrocode}
\DeclareRobustCommand{\@ordinalstringMenglish}[2]{%
-\let\@unitthstring=\@@unitthstringenglish
-\let\@teenthstring=\@@teenthstringenglish
+\let\@unitthstring=\@@unitthstringenglish
+\let\@teenthstring=\@@teenthstringenglish
\let\@tenthstring=\@@tenthstringenglish
-\let\@unitstring=\@@unitstringenglish
+\let\@unitstring=\@@unitstringenglish
\let\@teenstring=\@@teenstringenglish
\let\@tenstring=\@@tenstringenglish
\def\@andname{and}%
@@ -2376,7 +4316,8 @@ this number}%
\def\@hundredth{hundredth}\def\@thousandth{thousandth}%
\@@ordinalstringenglish{#1}{#2}}
% \end{macrocode}
-% No gender in English, so make feminine and neuter same as masculine:
+% No gender in English, so make feminine and neuter same as
+% masculine:
% \begin{macrocode}
\let\@ordinalstringFenglish=\@ordinalstringMenglish
\let\@ordinalstringNenglish=\@ordinalstringMenglish
@@ -2395,7 +4336,8 @@ this number}%
\def\@hundredth{Hundredth}\def\@thousandth{Thousandth}%
\@@ordinalstringenglish{#1}{#2}}
% \end{macrocode}
-% No gender in English, so make feminine and neuter same as masculine:
+% No gender in English, so make feminine and neuter same as
+% masculine:
% \begin{macrocode}
\let\@OrdinalstringFenglish=\@OrdinalstringMenglish
\let\@OrdinalstringNenglish=\@OrdinalstringMenglish
@@ -2407,17 +4349,259 @@ this number}%
%\fi
%\iffalse
% \begin{macrocode}
+%<*fc-francais.def>
+% \end{macrocode}
+%\fi
+% \subsubsection{fc-francais.def}
+% \begin{macrocode}
+\ProvidesFCLanguage{francais}[2012/06/18]
+\FCloadlang{french}
+% \end{macrocode}
+% Set |francais| to be equivalent to |french|.
+% \begin{macrocode}
+\let\@ordinalMfrancais=\@ordinalMfrench
+\let\@ordinalFfrancais=\@ordinalFfrench
+\let\@ordinalNfrancais=\@ordinalNfrench
+\let\@numberstringMfrancais=\@numberstringMfrench
+\let\@numberstringFfrancais=\@numberstringFfrench
+\let\@numberstringNfrancais=\@numberstringNfrench
+\let\@NumberstringMfrancais=\@NumberstringMfrench
+\let\@NumberstringFfrancais=\@NumberstringFfrench
+\let\@NumberstringNfrancais=\@NumberstringNfrench
+\let\@ordinalstringMfrancais=\@ordinalstringMfrench
+\let\@ordinalstringFfrancais=\@ordinalstringFfrench
+\let\@ordinalstringNfrancais=\@ordinalstringNfrench
+\let\@OrdinalstringMfrancais=\@OrdinalstringMfrench
+\let\@OrdinalstringFfrancais=\@OrdinalstringFfrench
+\let\@OrdinalstringNfrancais=\@OrdinalstringNfrench
+% \end{macrocode}
+
+%\iffalse
+% \begin{macrocode}
+%</fc-francais.def>
+% \end{macrocode}
+%\fi
+%\iffalse
+% \begin{macrocode}
%<*fc-french.def>
% \end{macrocode}
%\fi
% \subsubsection{fc-french.def}
-% French definitions
+% Definitions for French.
+% \begin{macrocode}
+\ProvidesFCLanguage{french}[2012/06/18]
+% \end{macrocode}
+% Package \styfmt{fcprefix} is needed to format the prefix \meta{$n$} in \meta{$n$}illion or
+% \meta{$n$}illiard. Big numbers were developped based reference:
+% \uref{http://www.alain.be/boece/noms\_de\_nombre.html}
+% \begin{macrocode}
+\RequirePackage{fcprefix}
+% \end{macrocode}
+% Options for controlling plural mark. First of all we define some temporary macro \cs{fc@french@set@plural}
+% in order to factorize code that defines an plural mark option:\newline\noindent
+% \begin{tabularx}{\linewidth}{@{}>{\raggedleft\arraybackslash\ttfamily}rX@{}}
+% \#1&key name,\\
+% \#2&key value,\\
+% \#3&configuration index for `\texttt{reformed}', \\
+% \#4&configuration index for `\texttt{traditional}',\\
+% \#5&configuration index for `\texttt{reformed o}', and\\
+% \#6&configuration index for `\texttt{traditional o}'.
+% \end{tabularx}
+% \begin{macrocode}
+\def\fc@french@set@plural#1#2#3#4#5#6{%
+ \ifthenelse{\equal{#2}{reformed}}{%
+ \expandafter\def\csname fc@frenchoptions@#1@plural\endcsname{#3}%
+ }{%
+ \ifthenelse{\equal{#2}{traditional}}{%
+ \expandafter\def\csname fc@frenchoptions@#1@plural\endcsname{#4}%
+ }{%
+ \ifthenelse{\equal{#2}{reformed o}}{%
+ \expandafter\def\csname fc@frenchoptions@#1@plural\endcsname{#5}%
+ }{%
+ \ifthenelse{\equal{#2}{traditional o}}{%
+ \expandafter\def\csname fc@frenchoptions@#1@plural\endcsname{#6}%
+ }{%
+ \ifthenelse{\equal{#2}{always}}{%
+ \expandafter\def\csname fc@frenchoptions@#1@plural\endcsname{0}%
+ }{%
+ \ifthenelse{\equal{#2}{never}}{%
+ \expandafter\def\csname fc@frenchoptions@#1@plural\endcsname{1}%
+ }{%
+ \ifthenelse{\equal{#2}{multiple}}{%
+ \expandafter\def\csname fc@frenchoptions@#1@plural\endcsname{2}%
+ }{%
+ \ifthenelse{\equal{#2}{multiple g-last}}{%
+ \expandafter\def\csname fc@frenchoptions@#1@plural\endcsname{3}%
+ }{%
+ \ifthenelse{\equal{#2}{multiple l-last}}{%
+ \expandafter\def\csname fc@frenchoptions@#1@plural\endcsname{4}%
+ }{%
+ \ifthenelse{\equal{#2}{multiple lng-last}}{%
+ \expandafter\def\csname fc@frenchoptions@#1@plural\endcsname{5}%
+ }{%
+ \ifthenelse{\equal{#2}{multiple ng-last}}{%
+ \expandafter\def\csname fc@frenchoptions@#1@plural\endcsname{6}%
+ }{%
+ \PackageError{fmtcount}{Unexpected argument}{%
+ `#2' was unexpected: french option `#1 plural' expects `reformed', `traditional',
+ `reformed o', `traditional o', `always', `never', `multiple', `multiple g-last',
+ `multiple l-last', `multiple lng-last', or `multiple ng-last'.%
+ }}}}}}}}}}}}}
+% \end{macrocode}
+% Now a shorthand \cs{@tempa} is defined just to define all the options controlling plural mark. This
+% shorthand takes into account that `\texttt{reformed}' and `\texttt{traditional}' have the same effect, and
+% so do `\texttt{reformed o}' and `\texttt{traditional o}'.
+% \begin{macrocode}
+\def\@tempa#1#2#3{%
+ \define@key{fcfrench}{#1 plural}[reformed]{%
+ \fc@french@set@plural{#1}{##1}{#2}{#2}{#3}{#3}%
+ }%
+}
+\@tempa{vingt}{4}{5}
+\@tempa{cent}{4}{5}
+\@tempa{mil}{0}{0}
+\@tempa{n-illion}{2}{6}
+\@tempa{n-illiard}{2}{6}
+% \end{macrocode}
+% For option `\texttt{all plural}' we cannot use the \cs{@tempa} shorthand, because `\texttt{all plural}'
+% is just a multiplexer.
+% \begin{macrocode}
+\define@key{fcfrench}{all plural}[reformed]{%
+ \csname KV@fcfrench@vingt plural\endcsname{#1}%
+ \csname KV@fcfrench@cent plural\endcsname{#1}%
+ \csname KV@fcfrench@mil plural\endcsname{#1}%
+ \csname KV@fcfrench@n-illion plural\endcsname{#1}%
+ \csname KV@fcfrench@n-illiard plural\endcsname{#1}%
+}
+% \end{macrocode}
+% Now options `\texttt{dash or space}', we have three possible key values:\newline\noindent
+% \begin{tabularx}{\linewidth}{@{}>{\raggedleft\arraybackslash\ttfamily}rX@{}}
+% traditional& use dash for numbers below 100, except when `et' is used, and space otherwise\\
+% reformed& reform of 1990, use dash except with million \& milliard, and suchlikes,
+% i.e. \meta{$n$}illion and \meta{$n$}illiard,\\
+% always& always use dashes to separate all words
+% \end{tabularx}
+% \begin{macrocode}
+\define@key{fcfrench}{dash or space}[reformed]{%
+ \ifthenelse{\equal{#1}{traditional}}{%
+ \let\fc@frenchoptions@supermillion@dos\space%
+ \let\fc@frenchoptions@submillion@dos\space
+ }{%
+ \ifthenelse{\equal{#1}{reformed}\or\equal{#1}{1990}}{%
+ \let\fc@frenchoptions@supermillion@dos\space
+ \def\fc@frenchoptions@submillion@dos{-}%
+ }{%
+ \ifthenelse{\equal{#1}{always}}{%
+ \def\fc@frenchoptions@supermillion@dos{-}%
+ \def\fc@frenchoptions@submillion@dos{-}%
+ }{%
+ \PackageError{fmtcount}{Unexpected argument}{%
+ French option `dash or space' expects `always', `reformed' or `traditional'
+ }
+ }%
+ }%
+ }%
+}
+% \end{macrocode}
+% Option `\texttt{scale}', can take 3 possible values:\newline\noindent
+% \begin{tabularx}{\linewidth}{@{}>{\raggedleft\arraybackslash\ttfamily}rX@{}}
+% long& for which \meta{\(n\)}illions \& \meta{\(n\)}illiards are used with \(10^{6\times n} = 1
+% \textrm{\meta{$n$}}illion\), and \(10^{6\times n+3} = 1 \textrm{\meta{$n$}}illiard\)\\
+% short& for which \meta{$n$}illions only are used with \(10^{3\times n+3} = 1
+% \textrm{\meta{$n$}illion}\)\\
+% recursive& for which \(10^{18} = \textrm{un milliard de milliards}\)
+% \end{tabularx}
% \begin{macrocode}
-\ProvidesFile{fc-french.def}[2007/05/26]
+\define@key{fcfrench}{scale}[recursive]{%
+ \ifthenelse{\equal{#1}{long}}{%
+ \let\fc@poweroften\fc@@pot@longscalefrench
+ }{%
+ \ifthenelse{\equal{#1}{recursive}}{%
+ \let\fc@poweroften\fc@@pot@recursivefrench
+ }{%
+ \ifthenelse{\equal{#1}{short}}{%
+ \let\fc@poweroften\fc@@pot@shortscalefrench
+ }{%
+ \PackageError{fmtcount}{Unexpected argument}{%
+ French option `scale' expects `long', `recursive' or `short'
+ }
+ }%
+ }%
+ }%
+}
% \end{macrocode}
-% Define macro that converts a number or count register (first
-% argument) to an ordinal, and store the result in the second
-% argument, which must be a control sequence. Masculine:
+% Option `\texttt{n-illiard upto}' is ignored if `\texttt{scale}' is different from `\texttt{long}'. It can
+% take the following values:\newline\noindent
+% \begin{tabularx}{\linewidth}{@{}>{\raggedleft\arraybackslash\ttfamily}rX@{}}
+% infinity&in that case \meta{$n$}illard are never disabled,\\
+% infty&this is just a shorthand for `\texttt{infinity}', and\\
+% \textrm{\(n\)}& any integer that is such that \(n>0\), and that \(\forall k\in\mathbb{N}, k\geq n\),
+% number \(10^{6\times k+3}\) will be formatted as ``mille \meta{$n$}illions''
+% \end{tabularx}
+% \begin{macrocode}
+\define@key{fcfrench}{n-illiard upto}[infinity]{%
+ \ifthenelse{\equal{#1}{infinity}}{%
+ \def\fc@longscale@nilliard@upto{0}%
+ }{%
+ \ifthenelse{\equal{#1}{infty}}{%
+ \def\fc@longscale@nilliard@upto{0}%
+ }{%
+ \if Q\ifnum9<1#1Q\fi\else
+ \PackageError{fmtcount}{Unexpected argument}{%
+ French option `milliard threshold' expects `infinity', or equivalently `infty', or a non negative
+ integer.}%
+ \fi
+ \def\fc@longscale@nilliard@upto{#1}%
+ }}%
+}
+% \end{macrocode}
+% Now, the options `\texttt{france}', `\texttt{swiss}' and `\texttt{belgian}' are defined to select the
+% dialect to use. Macro \cs{@tempa} is just a local shorthand to define each one of this option.
+% \begin{macrocode}
+\def\@tempa#1{%
+ \define@key{fcfrench}{#1}[]{%
+ \PackageError{fmtcount}{Unexpected argument}{French option with key `#1' does not take
+ any value}}%
+ \expandafter\def\csname KV@fcfrench@#1@default\endcsname{%
+ \def\fmtcount@french{#1}}%
+}%
+\@tempa{france}\@tempa{swiss}\@tempa{belgian}%
+% \end{macrocode}
+% Now, option `\texttt{dialect}' is now defined so that `\texttt{france}', `\texttt{swiss}' and
+% `\texttt{belgian}' can also be used as key values, which is more conventional although less concise.
+% \begin{macrocode}
+\define@key{fcfrench}{dialect}[france]{%
+ \ifthenelse{\equal{#1}{france}
+ \or\equal{#1}{swiss}
+ \or\equal{#1}{belgian}}{%
+ \def\fmtcount@french{#1}}{%
+ \PackageError{fmtcount}{Invalid value `#1' to french option dialect key}
+ {Option `french' can only take the values `france',
+ `belgian' or `swiss'}}}
+% \end{macrocode}
+% The option \texttt{mil plural mark} allows to make the plural of \texttt{mil} to be regular,
+% i.e. \texttt{mils}, instead of \texttt{mille}. By default it is `\texttt{le}'.
+% \begin{macrocode}
+\define@key{fcfrench}{mil plural mark}[le]{%
+ \def\fc@frenchoptions@mil@plural@mark{#1}}
+% \end{macrocode}
+% Definition of case handling macros. This should be moved somewhere else to be commonalized between all
+% languages.
+% \begin{macrocode}
+\def\fc@UpperCaseFirstLetter#1#2\@nil{%
+ \uppercase{#1}#2}
+
+\def\fc@CaseIden#1\@nil{%
+ #1%
+}
+\def\fc@UpperCaseAll#1\@nil{%
+ \uppercase{#1}%
+}
+
+\let\fc@case\fc@CaseIden
+
+% \end{macrocode}
+% \DescribeMacro\@ordinalMfrench
% \begin{macrocode}
\newcommand*{\@ordinalMfrench}[2]{%
\iffmtord@abbrv
@@ -2430,29 +4614,29 @@ this number}%
\fi
\fi}
% \end{macrocode}
-% Feminine:
+% \DescribeMacro\@ordinalFfrench
% \begin{macrocode}
\newcommand*{\@ordinalFfrench}[2]{%
\iffmtord@abbrv
\edef#2{\number#1\relax\noexpand\fmtord{e}}%
\else
- \ifnum#1=1\relax
- \edef#2{\number#1\relax\noexpand\fmtord{ere}}%
+ \ifnum#1=1 %
+ \edef#2{\number#1\relax\noexpand\fmtord{i\`ere}}%
\else
- \edef#2{\number#1\relax\noexpand\fmtord{eme}}%
+ \edef#2{\number#1\relax\noexpand\fmtord{i\`eme}}%
\fi
\fi}
% \end{macrocode}
-% Make neuter same as masculine:
+% In French neutral gender and masculine gender are formally identical.
% \begin{macrocode}
\let\@ordinalNfrench\@ordinalMfrench
% \end{macrocode}
-% Textual representation of a number. To make it easier break it
-% into units, tens and teens. First the units:
-% \begin{macrocode}
+% \DescribeMacro\@@unitstringfrench
+% \begin{macrocode}
\newcommand*{\@@unitstringfrench}[1]{%
-\ifcase#1\relax
-zero%
+\noexpand\fc@case
+\ifcase#1 %
+z\'ero%
\or un%
\or deux%
\or trois%
@@ -2463,1165 +4647,1373 @@ zero%
\or huit%
\or neuf%
\fi
+\noexpand\@nil
}
% \end{macrocode}
-% Feminine only changes for 1:
-% \begin{macrocode}
-\newcommand*{\@@unitstringFfrench}[1]{%
-\ifnum#1=1\relax
-une%
-\else\@@unitstringfrench{#1}%
-\fi
-}
-% \end{macrocode}
-% Tens (this includes the Belgian and Swiss variants, special
-% cases employed lower down.)
+% \DescribeMacro\@@tenstringfrench
% \begin{macrocode}
\newcommand*{\@@tenstringfrench}[1]{%
-\ifcase#1\relax
+\noexpand\fc@case
+\ifcase#1 %
\or dix%
\or vingt%
\or trente%
\or quarante%
\or cinquante%
\or soixante%
-\or septente%
+\or septante%
\or huitante%
-\or nonente%
+\or nonante%
\or cent%
\fi
+\noexpand\@nil
}
% \end{macrocode}
-% Teens:
+% \DescribeMacro\@@teenstringfrench
% \begin{macrocode}
\newcommand*{\@@teenstringfrench}[1]{%
-\ifcase#1\relax
-dix%
+\noexpand\fc@case
+\ifcase#1 %
+ dix%
\or onze%
\or douze%
\or treize%
\or quatorze%
\or quinze%
\or seize%
-\or dix-sept%
-\or dix-huit%
-\or dix-neuf%
+\or dix\noexpand\@nil-\noexpand\fc@case sept%
+\or dix\noexpand\@nil-\noexpand\fc@case huit%
+\or dix\noexpand\@nil-\noexpand\fc@case neuf%
\fi
+\noexpand\@nil
}
% \end{macrocode}
-% Seventies are a special case, depending on dialect:
+% \DescribeMacro\@@seventiesfrench
% \begin{macrocode}
\newcommand*{\@@seventiesfrench}[1]{%
\@tenstring{6}%
-\ifnum#1=1\relax
-\ \@andname\
+\ifnum#1=1 %
+\fc@frenchoptions@submillion@dos\@andname\fc@frenchoptions@submillion@dos
\else
-%
\fi
\@teenstring{#1}%
}
% \end{macrocode}
-% Eighties are a special case, depending on dialect:
-% \begin{macrocode}
-\newcommand*{\@@eightiesfrench}[1]{%
-\@unitstring{4}-\@tenstring{2}%
-\ifnum#1>0
--\@unitstring{#1}%
+% \DescribeMacro\@@eightiesfrench Macro \cs{@@eightiesfrench} is used to format numbers in the interval
+% \([80\intv 89]\). Argument as follows:\newline
+% \begin{tabularx}{\linewidth}{@{}>{\raggedleft\arraybackslash\ttfamily}rX@{}}
+% \#1&digit \(d_{w}\) such that the number to be formatted is \(80 + d_{w}\)\\
+% \end{tabularx}
+% Implicit arguments as:\newline
+% \begin{tabularx}{\linewidth}{@{}>{\raggedleft\arraybackslash\ttfamily}rX@{}}
+% \cs{count0}&weight \(w\) of the number \(d_{w+1}d_{w}\) to be formatted\\
+% \cs{count1}&same as \cs{\#1}\\
+% \cs{count6}&input, counter giving the least weight of non zero digits in top level formatted number
+% integral part, with rounding down to a multiple of 3,\\
+% \cs{count9}&input, counter giving the power type of the power of ten following the eighties to be
+% formatted; that is `1' for ``mil'' and `2' for ``\meta{$n$}illion\textbar \meta{$n$}illiard''.
+% \end{tabularx}
+% \begin{macrocode}
+\newcommand*\@@eightiesfrench[1]{%
+\fc@case quatre\@nil-\noexpand\fc@case vingt%
+\ifnum#1>0 %
+ \ifnum\fc@frenchoptions@vingt@plural=0 % vingt plural=always
+ s%
+ \fi
+ \noexpand\@nil
+ -\@unitstring{#1}%
\else
-s%
+ \ifcase\fc@frenchoptions@vingt@plural\space
+ s% 0: always
+ \or
+ % 1: never
+ \or
+ s% 2: multiple
+ \or
+ % 3: multiple g-last
+ \ifnum\count0=\count6\ifnum\count9=0 s\fi\fi
+ \or
+ % 4: multiple l-last
+ \ifnum\count9=1 %
+ \else
+ s%
+ \fi
+ \or
+ % 5: multiple lng-last
+ \ifnum\count9=1 %
+ \else
+ \ifnum\count0>0 %
+ s%
+ \fi
+ \fi
+ \or
+ % or 6: multiple ng-last
+ \ifnum\count0>0 %
+ s%
+ \fi
+ \fi
+ \noexpand\@nil
\fi
}
-% \end{macrocode}
-% Nineties are a special case, depending on dialect:
-% \begin{macrocode}
\newcommand*{\@@ninetiesfrench}[1]{%
-\@unitstring{4}-\@tenstring{2}-\@teenstring{#1}%
+\fc@case quatre\@nil-\noexpand\fc@case vingt%
+\ifnum\fc@frenchoptions@vingt@plural=0 % vingt plural=always
+ s%
+\fi
+\noexpand\@nil
+-\@teenstring{#1}%
}
-% \end{macrocode}
-% Swiss seventies:
-% \begin{macrocode}
\newcommand*{\@@seventiesfrenchswiss}[1]{%
\@tenstring{7}%
\ifnum#1=1\ \@andname\ \fi
\ifnum#1>1-\fi
-\ifnum#1>0\@unitstring{#1}\fi
+\ifnum#1>0 \@unitstring{#1}\fi
}
-% \end{macrocode}
-% Swiss eighties:
-% \begin{macrocode}
\newcommand*{\@@eightiesfrenchswiss}[1]{%
\@tenstring{8}%
\ifnum#1=1\ \@andname\ \fi
\ifnum#1>1-\fi
-\ifnum#1>0\@unitstring{#1}\fi
+\ifnum#1>0 \@unitstring{#1}\fi
}
-% \end{macrocode}
-% Swiss nineties:
-% \begin{macrocode}
\newcommand*{\@@ninetiesfrenchswiss}[1]{%
\@tenstring{9}%
\ifnum#1=1\ \@andname\ \fi
\ifnum#1>1-\fi
-\ifnum#1>0\@unitstring{#1}\fi
+\ifnum#1>0 \@unitstring{#1}\fi
}
% \end{macrocode}
-% Units with initial letter in upper case:
+% \DescribeMacro\fc@french@common Macro \cs{fc@french@common} does all the preliminary settings common to all
+% French dialects \& formatting options.
% \begin{macrocode}
-\newcommand*{\@@Unitstringfrench}[1]{%
-\ifcase#1\relax
-Zero%
-\or Un%
-\or Deux%
-\or Trois%
-\or Quatre%
-\or Cinq%
-\or Six%
-\or Sept%
-\or Huit%
-\or Neuf%
-\fi
-}
-% \end{macrocode}
-% As above, but feminine:
-% \begin{macrocode}
-\newcommand*{\@@UnitstringFfrench}[1]{%
-\ifnum#1=1\relax
-Une%
-\else \@@Unitstringfrench{#1}%
-\fi
-}
-% \end{macrocode}
-% Tens, with initial letter in upper case (includes Swiss and
-% Belgian variants):
-% \begin{macrocode}
-\newcommand*{\@@Tenstringfrench}[1]{%
-\ifcase#1\relax
-\or Dix%
-\or Vingt%
-\or Trente%
-\or Quarante%
-\or Cinquante%
-\or Soixante%
-\or Septente%
-\or Huitante%
-\or Nonente%
-\or Cent%
-\fi
-}
-% \end{macrocode}
-% Teens, with initial letter in upper case:
-% \begin{macrocode}
-\newcommand*{\@@Teenstringfrench}[1]{%
-\ifcase#1\relax
-Dix%
-\or Onze%
-\or Douze%
-\or Treize%
-\or Quatorze%
-\or Quinze%
-\or Seize%
-\or Dix-Sept%
-\or Dix-Huit%
-\or Dix-Neuf%
-\fi
+\newcommand*\fc@french@common{%
+ \let\@unitstring=\@@unitstringfrench
+ \let\@teenstring=\@@teenstringfrench
+ \let\@tenstring=\@@tenstringfrench
+ \def\@hundred{cent}%
+ \def\@andname{et}%
}
% \end{macrocode}
-% This has changed in version 1.09, so that it now stores the
-% result in the second argument, but doesn't display anything.
-% Since it only affects internal macros, it shouldn't affect
-% documents created with older versions. (These internal macros
-% are not defined for use in documents.) Firstly, the Swiss
-% version:
% \begin{macrocode}
\DeclareRobustCommand{\@numberstringMfrenchswiss}[2]{%
-\let\@unitstring=\@@unitstringfrench
-\let\@teenstring=\@@teenstringfrench
-\let\@tenstring=\@@tenstringfrench
+\let\fc@case\fc@CaseIden
+\fc@french@common
\let\@seventies=\@@seventiesfrenchswiss
\let\@eighties=\@@eightiesfrenchswiss
\let\@nineties=\@@ninetiesfrenchswiss
-\def\@hundred{cent}\def\@thousand{mille}%
-\def\@andname{et}%
+\let\fc@nbrstr@preamble\@empty
+\let\fc@nbrstr@postamble\@empty
\@@numberstringfrench{#1}{#2}}
-% \end{macrocode}
-% Same as above, but for French as spoken in France:
-% \begin{macrocode}
\DeclareRobustCommand{\@numberstringMfrenchfrance}[2]{%
-\let\@unitstring=\@@unitstringfrench
-\let\@teenstring=\@@teenstringfrench
-\let\@tenstring=\@@tenstringfrench
+\let\fc@case\fc@CaseIden
+\fc@french@common
\let\@seventies=\@@seventiesfrench
\let\@eighties=\@@eightiesfrench
\let\@nineties=\@@ninetiesfrench
-\def\@hundred{cent}\def\@thousand{mille}%
-\def\@andname{et}%
+\let\fc@nbrstr@preamble\@empty
+\let\fc@nbrstr@postamble\@empty
\@@numberstringfrench{#1}{#2}}
-% \end{macrocode}
-% Same as above, but for Belgian dialect:
-% \begin{macrocode}
\DeclareRobustCommand{\@numberstringMfrenchbelgian}[2]{%
-\let\@unitstring=\@@unitstringfrench
-\let\@teenstring=\@@teenstringfrench
-\let\@tenstring=\@@tenstringfrench
+\let\fc@case\fc@CaseIden
+\fc@french@common
\let\@seventies=\@@seventiesfrenchswiss
\let\@eighties=\@@eightiesfrench
\let\@nineties=\@@ninetiesfrench
-\def\@hundred{cent}\def\@thousand{mille}%
-\def\@andname{et}%
+\let\fc@nbrstr@preamble\@empty
+\let\fc@nbrstr@postamble\@empty
\@@numberstringfrench{#1}{#2}}
-% \end{macrocode}
-% Set default dialect:
-% \begin{macrocode}
\let\@numberstringMfrench=\@numberstringMfrenchfrance
-% \end{macrocode}
-% As above, but for feminine version. Swiss:
-% \begin{macrocode}
\DeclareRobustCommand{\@numberstringFfrenchswiss}[2]{%
-\let\@unitstring=\@@unitstringFfrench
-\let\@teenstring=\@@teenstringfrench
-\let\@tenstring=\@@tenstringfrench
+\let\fc@case\fc@CaseIden
+\fc@french@common
\let\@seventies=\@@seventiesfrenchswiss
\let\@eighties=\@@eightiesfrenchswiss
\let\@nineties=\@@ninetiesfrenchswiss
-\def\@hundred{cent}\def\@thousand{mille}%
-\def\@andname{et}%
+\let\fc@nbrstr@preamble\fc@@nbrstr@Fpreamble
+\let\fc@nbrstr@postamble\@empty
\@@numberstringfrench{#1}{#2}}
-% \end{macrocode}
-% French:
-% \begin{macrocode}
\DeclareRobustCommand{\@numberstringFfrenchfrance}[2]{%
-\let\@unitstring=\@@unitstringFfrench
-\let\@teenstring=\@@teenstringfrench
-\let\@tenstring=\@@tenstringfrench
+\let\fc@case\fc@CaseIden
+\fc@french@common
\let\@seventies=\@@seventiesfrench
\let\@eighties=\@@eightiesfrench
\let\@nineties=\@@ninetiesfrench
-\def\@hundred{cent}\def\@thousand{mille}%
-\def\@andname{et}%
+\let\fc@nbrstr@preamble\fc@@nbrstr@Fpreamble
+\let\fc@nbrstr@postamble\@empty
\@@numberstringfrench{#1}{#2}}
-% \end{macrocode}
-% Belgian:
-% \begin{macrocode}
\DeclareRobustCommand{\@numberstringFfrenchbelgian}[2]{%
-\let\@unitstring=\@@unitstringFfrench
-\let\@teenstring=\@@teenstringfrench
-\let\@tenstring=\@@tenstringfrench
+\let\fc@case\fc@CaseIden
+\fc@french@common
\let\@seventies=\@@seventiesfrenchswiss
\let\@eighties=\@@eightiesfrench
\let\@nineties=\@@ninetiesfrench
-\def\@hundred{cent}\def\@thousand{mille}%
-\def\@andname{et}%
+\let\fc@nbrstr@preamble\fc@@nbrstr@Fpreamble
+\let\fc@nbrstr@postamble\@empty
\@@numberstringfrench{#1}{#2}}
-% \end{macrocode}
-% Set default dialect:
-% \begin{macrocode}
\let\@numberstringFfrench=\@numberstringFfrenchfrance
-% \end{macrocode}
-% Make neuter same as masculine:
-% \begin{macrocode}
\let\@ordinalstringNfrench\@ordinalstringMfrench
-% \end{macrocode}
-% As above, but with initial letter in upper case. Swiss (masculine):
-% \begin{macrocode}
\DeclareRobustCommand{\@NumberstringMfrenchswiss}[2]{%
-\let\@unitstring=\@@Unitstringfrench
-\let\@teenstring=\@@Teenstringfrench
-\let\@tenstring=\@@Tenstringfrench
+\let\fc@case\fc@UpperCaseFirstLetter
+\fc@french@common
\let\@seventies=\@@seventiesfrenchswiss
\let\@eighties=\@@eightiesfrenchswiss
\let\@nineties=\@@ninetiesfrenchswiss
-\def\@hundred{Cent}\def\@thousand{Mille}%
-\def\@andname{et}%
+\let\fc@nbrstr@preamble\@empty
+\let\fc@nbrstr@postamble\@empty
\@@numberstringfrench{#1}{#2}}
-% \end{macrocode}
-% French:
-% \begin{macrocode}
\DeclareRobustCommand{\@NumberstringMfrenchfrance}[2]{%
-\let\@unitstring=\@@Unitstringfrench
-\let\@teenstring=\@@Teenstringfrench
-\let\@tenstring=\@@Tenstringfrench
+\let\fc@case\fc@UpperCaseFirstLetter
+\fc@french@common
\let\@seventies=\@@seventiesfrench
\let\@eighties=\@@eightiesfrench
\let\@nineties=\@@ninetiesfrench
-\def\@hundred{Cent}\def\@thousand{Mille}%
-\def\@andname{et}%
+\let\fc@nbrstr@preamble\@empty
+\let\fc@nbrstr@postamble\@empty
\@@numberstringfrench{#1}{#2}}
-% \end{macrocode}
-% Belgian:
-% \begin{macrocode}
\DeclareRobustCommand{\@NumberstringMfrenchbelgian}[2]{%
-\let\@unitstring=\@@Unitstringfrench
-\let\@teenstring=\@@Teenstringfrench
-\let\@tenstring=\@@Tenstringfrench
+\let\fc@case\fc@UpperCaseFirstLetter
+\fc@french@common
\let\@seventies=\@@seventiesfrenchswiss
\let\@eighties=\@@eightiesfrench
\let\@nineties=\@@ninetiesfrench
-\def\@hundred{Cent}\def\@thousand{Mille}%
-\def\@andname{et}%
+\let\fc@nbrstr@preamble\@empty
+\let\fc@nbrstr@postamble\@empty
\@@numberstringfrench{#1}{#2}}
-% \end{macrocode}
-% Set default dialect:
-% \begin{macrocode}
\let\@NumberstringMfrench=\@NumberstringMfrenchfrance
-% \end{macrocode}
-% As above, but feminine. Swiss:
-% \begin{macrocode}
\DeclareRobustCommand{\@NumberstringFfrenchswiss}[2]{%
-\let\@unitstring=\@@UnitstringFfrench
-\let\@teenstring=\@@Teenstringfrench
-\let\@tenstring=\@@Tenstringfrench
+\let\fc@case\fc@UpperCaseFirstLetter
+\fc@french@common
\let\@seventies=\@@seventiesfrenchswiss
\let\@eighties=\@@eightiesfrenchswiss
\let\@nineties=\@@ninetiesfrenchswiss
-\def\@hundred{Cent}\def\@thousand{Mille}%
-\def\@andname{et}%
+\let\fc@nbrstr@preamble\fc@@nbrstr@Fpreamble
+\let\fc@nbrstr@postamble\@empty
\@@numberstringfrench{#1}{#2}}
-% \end{macrocode}
-% French (feminine):
-% \begin{macrocode}
\DeclareRobustCommand{\@NumberstringFfrenchfrance}[2]{%
-\let\@unitstring=\@@UnitstringFfrench
-\let\@teenstring=\@@Teenstringfrench
-\let\@tenstring=\@@Tenstringfrench
+\let\fc@case\fc@UpperCaseFirstLetter
+\fc@french@common
\let\@seventies=\@@seventiesfrench
\let\@eighties=\@@eightiesfrench
\let\@nineties=\@@ninetiesfrench
-\def\@hundred{Cent}\def\@thousand{Mille}%
-\def\@andname{et}%
+\let\fc@nbrstr@preamble\fc@@nbrstr@Fpreamble
+\let\fc@nbrstr@postamble\@empty
\@@numberstringfrench{#1}{#2}}
-% \end{macrocode}
-% Belgian (feminine):
-% \begin{macrocode}
\DeclareRobustCommand{\@NumberstringFfrenchbelgian}[2]{%
-\let\@unitstring=\@@UnitstringFfrench
-\let\@teenstring=\@@Teenstringfrench
-\let\@tenstring=\@@Tenstringfrench
+\let\fc@case\fc@UpperCaseFirstLetter
+\fc@french@common
\let\@seventies=\@@seventiesfrenchswiss
\let\@eighties=\@@eightiesfrench
\let\@nineties=\@@ninetiesfrench
-\def\@hundred{Cent}\def\@thousand{Mille}%
-\def\@andname{et}%
+\let\fc@nbrstr@preamble\fc@@nbrstr@Fpreamble
+\let\fc@nbrstr@postamble\@empty
\@@numberstringfrench{#1}{#2}}
-% \end{macrocode}
-% Set default dialect:
-% \begin{macrocode}
\let\@NumberstringFfrench=\@NumberstringFfrenchfrance
-% \end{macrocode}
-% Make neuter same as masculine:
-% \begin{macrocode}
\let\@NumberstringNfrench\@NumberstringMfrench
-% \end{macrocode}
-% Again, as from version 1.09, this has been changed to take
-% two arguments, where the second argument is a control
-% sequence, and nothing is displayed. Store textual representation
-% of an ordinal in the given control sequence. Swiss dialect (masculine):
-% \begin{macrocode}
\DeclareRobustCommand{\@ordinalstringMfrenchswiss}[2]{%
-\ifnum#1=1\relax
-\def#2{premier}%
-\else
-\let\@unitthstring=\@@unitthstringfrench
-\let\@unitstring=\@@unitstringfrench
-\let\@teenthstring=\@@teenthstringfrench
-\let\@teenstring=\@@teenstringfrench
-\let\@tenthstring=\@@tenthstringfrench
-\let\@tenstring=\@@tenstringfrench
-\let\@seventieths=\@@seventiethsfrenchswiss
-\let\@eightieths=\@@eightiethsfrenchswiss
-\let\@ninetieths=\@@ninetiethsfrenchswiss
+\let\fc@case\fc@CaseIden
+\let\fc@first=\fc@@firstfrench
+\fc@french@common
\let\@seventies=\@@seventiesfrenchswiss
\let\@eighties=\@@eightiesfrenchswiss
\let\@nineties=\@@ninetiesfrenchswiss
-\def\@hundredth{centi\`eme}\def\@hundred{cent}%
-\def\@thousandth{mili\`eme}\def\@thousand{mille}%
-\def\@andname{et}%
\@@ordinalstringfrench{#1}{#2}%
-\fi}
-% \end{macrocode}
-% French (masculine):
-% \begin{macrocode}
+}
+\newcommand*\fc@@firstfrench{premier}
+\newcommand*\fc@@firstFfrench{premi\`ere}
\DeclareRobustCommand{\@ordinalstringMfrenchfrance}[2]{%
-\ifnum#1=1\relax
-\def#2{premier}%
-\else
-\let\@unitthstring=\@@unitthstringfrench
-\let\@unitstring=\@@unitstringfrench
-\let\@teenthstring=\@@teenthstringfrench
-\let\@teenstring=\@@teenstringfrench
-\let\@tenthstring=\@@tenthstringfrench
-\let\@tenstring=\@@tenstringfrench
-\let\@seventieths=\@@seventiethsfrench
-\let\@eightieths=\@@eightiethsfrench
-\let\@ninetieths=\@@ninetiethsfrench
+\let\fc@case\fc@CaseIden
+\let\fc@first=\fc@@firstfrench
+\fc@french@common
\let\@seventies=\@@seventiesfrench
\let\@eighties=\@@eightiesfrench
\let\@nineties=\@@ninetiesfrench
-\let\@teenstring=\@@teenstringfrench
-\def\@hundredth{centi\`eme}\def\@hundred{cent}%
-\def\@thousandth{mili\`eme}\def\@thousand{mille}%
-\def\@andname{et}%
-\@@ordinalstringfrench{#1}{#2}%
-\fi}
-% \end{macrocode}
-% Belgian dialect (masculine):
-% \begin{macrocode}
+\@@ordinalstringfrench{#1}{#2}}
\DeclareRobustCommand{\@ordinalstringMfrenchbelgian}[2]{%
-\ifnum#1=1\relax
-\def#2{premier}%
-\else
-\let\@unitthstring=\@@unitthstringfrench
-\let\@unitstring=\@@unitstringfrench
-\let\@teenthstring=\@@teenthstringfrench
-\let\@teenstring=\@@teenstringfrench
-\let\@tenthstring=\@@tenthstringfrench
-\let\@tenstring=\@@tenstringfrench
-\let\@seventieths=\@@seventiethsfrenchswiss
-\let\@eightieths=\@@eightiethsfrench
-\let\@ninetieths=\@@ninetiethsfrenchswiss
+\let\fc@case\fc@CaseIden
+\let\fc@first=\fc@@firstfrench
+\fc@french@common
\let\@seventies=\@@seventiesfrench
\let\@eighties=\@@eightiesfrench
\let\@nineties=\@@ninetiesfrench
-\let\@teenstring=\@@teenstringfrench
-\def\@hundredth{centi\`eme}\def\@hundred{cent}%
-\def\@thousandth{mili\`eme}\def\@thousand{mille}%
-\def\@andname{et}%
\@@ordinalstringfrench{#1}{#2}%
-\fi}
-% \end{macrocode}
-% Set up default dialect:
-% \begin{macrocode}
+}
\let\@ordinalstringMfrench=\@ordinalstringMfrenchfrance
-% \end{macrocode}
-% As above, but feminine. Swiss:
-% \begin{macrocode}
\DeclareRobustCommand{\@ordinalstringFfrenchswiss}[2]{%
-\ifnum#1=1\relax
-\def#2{premi\`ere}%
-\else
-\let\@unitthstring=\@@unitthstringfrench
-\let\@unitstring=\@@unitstringFfrench
-\let\@teenthstring=\@@teenthstringfrench
-\let\@teenstring=\@@teenstringfrench
-\let\@tenthstring=\@@tenthstringfrench
-\let\@tenstring=\@@tenstringfrench
-\let\@seventieths=\@@seventiethsfrenchswiss
-\let\@eightieths=\@@eightiethsfrenchswiss
-\let\@ninetieths=\@@ninetiethsfrenchswiss
+\let\fc@case\fc@CaseIden
+\let\fc@first=\fc@@firstFfrench
+\fc@french@common
\let\@seventies=\@@seventiesfrenchswiss
\let\@eighties=\@@eightiesfrenchswiss
\let\@nineties=\@@ninetiesfrenchswiss
-\def\@hundredth{centi\`eme}\def\@hundred{cent}%
-\def\@thousandth{mili\`eme}\def\@thousand{mille}%
-\def\@andname{et}%
\@@ordinalstringfrench{#1}{#2}%
-\fi}
-% \end{macrocode}
-% French (feminine):
-% \begin{macrocode}
+}
\DeclareRobustCommand{\@ordinalstringFfrenchfrance}[2]{%
-\ifnum#1=1\relax
-\def#2{premi\`ere}%
-\else
-\let\@unitthstring=\@@unitthstringfrench
-\let\@unitstring=\@@unitstringFfrench
-\let\@teenthstring=\@@teenthstringfrench
-\let\@teenstring=\@@teenstringfrench
-\let\@tenthstring=\@@tenthstringfrench
-\let\@tenstring=\@@tenstringfrench
-\let\@seventieths=\@@seventiethsfrench
-\let\@eightieths=\@@eightiethsfrench
-\let\@ninetieths=\@@ninetiethsfrench
+\let\fc@case\fc@CaseIden
+\let\fc@first=\fc@@firstFfrench
+\fc@french@common
\let\@seventies=\@@seventiesfrench
\let\@eighties=\@@eightiesfrench
\let\@nineties=\@@ninetiesfrench
-\let\@teenstring=\@@teenstringfrench
-\def\@hundredth{centi\`eme}\def\@hundred{cent}%
-\def\@thousandth{mili\`eme}\def\@thousand{mille}%
-\def\@andname{et}%
\@@ordinalstringfrench{#1}{#2}%
-\fi}
-% \end{macrocode}
-% Belgian (feminine):
-% \begin{macrocode}
+}
\DeclareRobustCommand{\@ordinalstringFfrenchbelgian}[2]{%
-\ifnum#1=1\relax
-\def#2{premi\`ere}%
-\else
-\let\@unitthstring=\@@unitthstringfrench
-\let\@unitstring=\@@unitstringFfrench
-\let\@teenthstring=\@@teenthstringfrench
-\let\@teenstring=\@@teenstringfrench
-\let\@tenthstring=\@@tenthstringfrench
-\let\@tenstring=\@@tenstringfrench
-\let\@seventieths=\@@seventiethsfrenchswiss
-\let\@eightieths=\@@eightiethsfrench
-\let\@ninetieths=\@@ninetiethsfrench
+\let\fc@case\fc@CaseIden
+\let\fc@first=\fc@@firstFfrench
+\fc@french@common
\let\@seventies=\@@seventiesfrench
\let\@eighties=\@@eightiesfrench
\let\@nineties=\@@ninetiesfrench
-\let\@teenstring=\@@teenstringfrench
-\def\@hundredth{centi\`eme}\def\@hundred{cent}%
-\def\@thousandth{mili\`eme}\def\@thousand{mille}%
-\def\@andname{et}%
\@@ordinalstringfrench{#1}{#2}%
-\fi}
-% \end{macrocode}
-% Set up default dialect:
-% \begin{macrocode}
+}
\let\@ordinalstringFfrench=\@ordinalstringFfrenchfrance
-% \end{macrocode}
-% Make neuter same as masculine:
-% \begin{macrocode}
\let\@ordinalstringNfrench\@ordinalstringMfrench
-% \end{macrocode}
-% As above, but with initial letters in upper case. Swiss (masculine):
-% \begin{macrocode}
\DeclareRobustCommand{\@OrdinalstringMfrenchswiss}[2]{%
-\ifnum#1=1\relax
-\def#2{Premi\`ere}%
-\else
-\let\@unitthstring=\@@Unitthstringfrench
-\let\@unitstring=\@@Unitstringfrench
-\let\@teenthstring=\@@Teenthstringfrench
-\let\@teenstring=\@@Teenstringfrench
-\let\@tenthstring=\@@Tenthstringfrench
-\let\@tenstring=\@@Tenstringfrench
-\let\@seventieths=\@@seventiethsfrenchswiss
-\let\@eightieths=\@@eightiethsfrenchswiss
-\let\@ninetieths=\@@ninetiethsfrenchswiss
+\let\fc@case\fc@UpperCaseFirstLetter
+\let\fc@first=\fc@@firstfrench
+\fc@french@common
\let\@seventies=\@@seventiesfrenchswiss
\let\@eighties=\@@eightiesfrenchswiss
\let\@nineties=\@@ninetiesfrenchswiss
-\def\@hundredth{Centi\`eme}\def\@hundred{Cent}%
-\def\@thousandth{Mili\`eme}\def\@thousand{Mille}%
-\def\@andname{et}%
\@@ordinalstringfrench{#1}{#2}%
-\fi}
-% \end{macrocode}
-% French (masculine):
-% \begin{macrocode}
+}
\DeclareRobustCommand{\@OrdinalstringMfrenchfrance}[2]{%
-\ifnum#1=1\relax
-\def#2{Premi\`ere}%
-\else
-\let\@unitthstring=\@@Unitthstringfrench
-\let\@unitstring=\@@Unitstringfrench
-\let\@teenthstring=\@@Teenthstringfrench
-\let\@teenstring=\@@Teenstringfrench
-\let\@tenthstring=\@@Tenthstringfrench
-\let\@tenstring=\@@Tenstringfrench
-\let\@seventieths=\@@seventiethsfrench
-\let\@eightieths=\@@eightiethsfrench
-\let\@ninetieths=\@@ninetiethsfrench
+\let\fc@case\fc@UpperCaseFirstLetter
+\let\fc@first=\fc@@firstfrench
+\fc@french@common
\let\@seventies=\@@seventiesfrench
\let\@eighties=\@@eightiesfrench
\let\@nineties=\@@ninetiesfrench
-\let\@teenstring=\@@Teenstringfrench
-\def\@hundredth{Centi\`eme}\def\@hundred{Cent}%
-\def\@thousandth{Mili\`eme}\def\@thousand{Mille}%
-\def\@andname{et}%
\@@ordinalstringfrench{#1}{#2}%
-\fi}
-% \end{macrocode}
-% Belgian (masculine):
-% \begin{macrocode}
+}
\DeclareRobustCommand{\@OrdinalstringMfrenchbelgian}[2]{%
-\ifnum#1=1\relax
-\def#2{Premi\`ere}%
-\else
-\let\@unitthstring=\@@Unitthstringfrench
-\let\@unitstring=\@@Unitstringfrench
-\let\@teenthstring=\@@Teenthstringfrench
-\let\@teenstring=\@@Teenstringfrench
-\let\@tenthstring=\@@Tenthstringfrench
-\let\@tenstring=\@@Tenstringfrench
-\let\@seventieths=\@@seventiethsfrenchswiss
-\let\@eightieths=\@@eightiethsfrench
-\let\@ninetieths=\@@ninetiethsfrench
+\let\fc@case\fc@UpperCaseFirstLetter
+\let\fc@first=\fc@@firstfrench
+\fc@french@common
\let\@seventies=\@@seventiesfrench
\let\@eighties=\@@eightiesfrench
\let\@nineties=\@@ninetiesfrench
-\let\@teenstring=\@@Teenstringfrench
-\def\@hundredth{Centi\`eme}\def\@hundred{Cent}%
-\def\@thousandth{Mili\`eme}\def\@thousand{Mille}%
-\def\@andname{et}%
\@@ordinalstringfrench{#1}{#2}%
-\fi}
-% \end{macrocode}
-% Set up default dialect:
-% \begin{macrocode}
+}
\let\@OrdinalstringMfrench=\@OrdinalstringMfrenchfrance
-% \end{macrocode}
-% As above, but feminine form. Swiss:
-% \begin{macrocode}
\DeclareRobustCommand{\@OrdinalstringFfrenchswiss}[2]{%
-\ifnum#1=1\relax
-\def#2{Premi\`ere}%
-\else
-\let\@unitthstring=\@@Unitthstringfrench
-\let\@unitstring=\@@UnitstringFfrench
-\let\@teenthstring=\@@Teenthstringfrench
-\let\@teenstring=\@@Teenstringfrench
-\let\@tenthstring=\@@Tenthstringfrench
-\let\@tenstring=\@@Tenstringfrench
-\let\@seventieths=\@@seventiethsfrenchswiss
-\let\@eightieths=\@@eightiethsfrenchswiss
-\let\@ninetieths=\@@ninetiethsfrenchswiss
+\let\fc@case\fc@UpperCaseFirstLetter
+\let\fc@first=\fc@@firstfrench
+\fc@french@common
\let\@seventies=\@@seventiesfrenchswiss
\let\@eighties=\@@eightiesfrenchswiss
\let\@nineties=\@@ninetiesfrenchswiss
-\def\@hundredth{Centi\`eme}\def\@hundred{Cent}%
-\def\@thousandth{Mili\`eme}\def\@thousand{Mille}%
-\def\@andname{et}%
\@@ordinalstringfrench{#1}{#2}%
-\fi}
-% \end{macrocode}
-% French (feminine):
-% \begin{macrocode}
+}
\DeclareRobustCommand{\@OrdinalstringFfrenchfrance}[2]{%
-\ifnum#1=1\relax
-\def#2{Premi\`ere}%
-\else
-\let\@unitthstring=\@@Unitthstringfrench
-\let\@unitstring=\@@UnitstringFfrench
-\let\@teenthstring=\@@Teenthstringfrench
-\let\@teenstring=\@@Teenstringfrench
-\let\@tenthstring=\@@Tenthstringfrench
-\let\@tenstring=\@@Tenstringfrench
-\let\@seventieths=\@@seventiethsfrench
-\let\@eightieths=\@@eightiethsfrench
-\let\@ninetieths=\@@ninetiethsfrench
+\let\fc@case\fc@UpperCaseFirstLetter
+\let\fc@first=\fc@@firstFfrench
+\fc@french@common
\let\@seventies=\@@seventiesfrench
\let\@eighties=\@@eightiesfrench
\let\@nineties=\@@ninetiesfrench
-\let\@teenstring=\@@Teenstringfrench
-\def\@hundredth{Centi\`eme}\def\@hundred{Cent}%
-\def\@thousandth{Mili\`eme}\def\@thousand{Mille}%
-\def\@andname{et}%
\@@ordinalstringfrench{#1}{#2}%
-\fi}
-% \end{macrocode}
-% Belgian (feminine):
-% \begin{macrocode}
+}
\DeclareRobustCommand{\@OrdinalstringFfrenchbelgian}[2]{%
-\ifnum#1=1\relax
-\def#2{Premi\`ere}%
-\else
-\let\@unitthstring=\@@Unitthstringfrench
-\let\@unitstring=\@@UnitstringFfrench
-\let\@teenthstring=\@@Teenthstringfrench
-\let\@teenstring=\@@Teenstringfrench
-\let\@tenthstring=\@@Tenthstringfrench
-\let\@tenstring=\@@Tenstringfrench
-\let\@seventieths=\@@seventiethsfrenchswiss
-\let\@eightieths=\@@eightiethsfrench
-\let\@ninetieths=\@@ninetiethsfrench
+\let\fc@case\fc@UpperCaseFirstLetter
+\let\fc@first=\fc@@firstFfrench
+\fc@french@common
\let\@seventies=\@@seventiesfrench
\let\@eighties=\@@eightiesfrench
\let\@nineties=\@@ninetiesfrench
-\let\@teenstring=\@@Teenstringfrench
-\def\@hundredth{Centi\`eme}\def\@hundred{Cent}%
-\def\@thousandth{Mili\`eme}\def\@thousand{Mille}%
-\def\@andname{et}%
\@@ordinalstringfrench{#1}{#2}%
-\fi}
-% \end{macrocode}
-% Set up default dialect:
-% \begin{macrocode}
+}
\let\@OrdinalstringFfrench=\@OrdinalstringFfrenchfrance
+\let\@OrdinalstringNfrench\@OrdinalstringMfrench
% \end{macrocode}
-% Make neuter same as masculine:
+% \DescribeMacro\fc@@do@plural@mark Macro \cs{fc@@do@plural@mark} will expand to the plural mark of
+% \meta{$n$}illiard, \meta{$n$}illion, mil, cent or vingt, whichever is applicable. First check that the macro
+% is not yet defined.
+% \begin{macrocode}
+\@ifundefined{fc@@do@plural@mark}{}{\PackageError{fmtcount}{Duplicate definition}{Redefinition of macro
+ `fc@@do@plural@mark'}}
+% \end{macrocode}
+% Arguments as follows:\newline
+% \begin{tabularx}{\linewidth}{@{}>{\raggedleft\arraybackslash\ttfamily}rX@{}}
+% \#1&plural mark, `s' in general, but for mil it is \cs{fc@frenchoptions@mil@plural@mark1}\\
+% \end{tabularx}
+% Implicit arguments as follows:\newline
+% \begin{tabularx}{\linewidth}{@{}>{\raggedleft\arraybackslash\ttfamily}rX@{}}
+% \cs{count0}&input, counter giving the weight \(w\), this is expected to be multiple of 3,\\
+% \cs{count1}&input, counter giving the plural value of multiplied object \meta{$n$}illiard,
+% \meta{$n$}illion, mil, cent or vingt, whichever is applicable, that is to say it is 1 when the considered
+% objet is not multiplied, and 2 or more when it is multiplied,\\
+% \cs{count6}&input, counter giving the least weight of non zero digits in top level formatted number
+% integral part, with rounding down to a multiple of 3,\\
+% \cs{count10}&input, counter giving the plural mark control option.\\
+% \end{tabularx}
+% \begin{macrocode}
+\def\fc@@do@plural@mark#1{%
+ \ifcase\count10 %
+ #1% 0=always
+ \or% 1=never
+ \or% 2=multiple
+ \ifnum\count1>1 %
+ #1%
+ \fi
+ \or% 3= multiple g-last
+ \ifnum\count1>1 %
+ \ifnum\count0=\count6 %
+ #1%
+ \fi
+ \fi
+ \or% 4= multiple l-last
+ \ifnum\count1>1 %
+ \ifnum\count9=1 %
+ \else
+ #1%
+ \fi
+ \fi
+ \or% 5= multiple lng-last
+ \ifnum\count1>1 %
+ \ifnum\count9=1 %
+ \else
+ \if\count0>\count6 %
+ #1%
+ \fi
+ \fi
+ \fi
+ \or% 6= multiple ng-last
+ \ifnum\count1>1 %
+ \ifnum\count0>\count6 %
+ #1%
+ \fi
+ \fi
+ \fi
+}
+% \end{macrocode}
+% \DescribeMacro\fc@@nbrstr@Fpreamble Macro \cs{fc@@nbrstr@Fpreamble} do the necessary preliminaries before
+% formatting a cardinal with feminine gender.
% \begin{macrocode}
-\let\@OrdinalstringNfrench\@OrdinalstringMfrench
+\@ifundefined{fc@@nbrstr@Fpreamble}{}{%
+ \PackageError{fmtcount}{Duplicate definition}{Redefinition of macro
+ `fc@@nbrstr@Fpreamble'}}
% \end{macrocode}
-% In order to convert numbers into textual ordinals, need
-% to break it up into units, tens and teens. First the units.
-% The argument must be a number or count register between 0
-% and 9.
+% \DescribeMacro\fc@@nbrstr@Fpreamble
% \begin{macrocode}
-\newcommand*{\@@unitthstringfrench}[1]{%
-\ifcase#1\relax
-zero%
-\or uni\`eme%
-\or deuxi\`eme%
-\or troisi\`eme%
-\or quatri\`eme%
-\or cinqui\`eme%
-\or sixi\`eme%
-\or septi\`eme%
-\or huiti\`eme%
-\or neuvi\`eme%
-\fi
+\def\fc@@nbrstr@Fpreamble{%
+ \fc@read@unit{\count1}{0}%
+ \ifnum\count1=1 %
+ \let\fc@case@save\fc@case
+ \def\fc@case{\noexpand\fc@case}%
+ \def\@nil{\noexpand\@nil}%
+ \let\fc@nbrstr@postamble\fc@@nbrstr@Fpostamble
+ \fi
}
% \end{macrocode}
-% Tens (includes Swiss and Belgian variants, special cases are
-% dealt with later.)
+% \DescribeMacro\fc@@nbrstr@Fpostamble
% \begin{macrocode}
-\newcommand*{\@@tenthstringfrench}[1]{%
-\ifcase#1\relax
-\or dixi\`eme%
-\or vingti\`eme%
-\or trentri\`eme%
-\or quaranti\`eme%
-\or cinquanti\`eme%
-\or soixanti\`eme%
-\or septenti\`eme%
-\or huitanti\`eme%
-\or nonenti\`eme%
-\fi
+\def\fc@@nbrstr@Fpostamble{%
+ \let\fc@case\fc@case@save
+ \expandafter\fc@get@last@word\expandafter{\@tempa}\@tempb\@tempc
+ \def\@tempd{un}%
+ \ifx\@tempc\@tempd
+ \let\@tempc\@tempa
+ \edef\@tempa{\@tempb\fc@case une\@nil}%
+ \fi
}
% \end{macrocode}
-% Teens:
+% \DescribeMacro\fc@@pot@longscalefrench Macro \cs{fc@@pot@longscalefrench} is used to produce
+% powers of ten with long scale convention. The long scale convention is correct for French and elsewhere in
+% Europe. First we check that the macro is not yet defined.
% \begin{macrocode}
-\newcommand*{\@@teenthstringfrench}[1]{%
-\ifcase#1\relax
-dixi\`eme%
-\or onzi\`eme%
-\or douzi\`eme%
-\or treizi\`eme%
-\or quatorzi\`eme%
-\or quinzi\`eme%
-\or seizi\`eme%
-\or dix-septi\`eme%
-\or dix-huiti\`eme%
-\or dix-neuvi\`eme%
-\fi
-}
+\@ifundefined{fc@@pot@longscalefrench}{}{%
+ \PackageError{fmtcount}{Duplicate definition}{Redefinition of macro
+ `fc@@pot@longscalefrench'}}
% \end{macrocode}
-% Seventies vary depending on dialect. Swiss:
+% Argument are as follows:\def\interface{\newline\noindent
+% \begin{tabularx}{\linewidth}{@{}>{\raggedleft\arraybackslash\ttfamily}rX@{}}
+% \#1&input, plural value of \(d\), that is to say: let \(d\) be the number multiplying the considered power
+% of ten, then the plural value \texttt{\#2} is expected to be \(0\) if \(d=0\), \(1\) if \(d=1\), or \(>1\)
+% if \(d>1\)\\
+% \#2&output, counter, maybe \(0\) when power of ten is \(1\), \(1\) when power of ten starts with
+% ``mil(le)'', or \(2\) when power of ten is a ``\meta{$n$}illion(s)\textbar\meta{$n$}illiard(s)''\\
+% \#3&output, macro into which to place the formatted power of ten
+% \end{tabularx}
+% Implicit arguments as follows:\newline
+% \begin{tabularx}{\linewidth}{@{}>{\raggedleft\arraybackslash\ttfamily}rX@{}}
+% \cs{count0}&input, counter giving the weight \(w\), this is expected to be multiple of 3\\
+% \end{tabularx}
+% }\interface
% \begin{macrocode}
-\newcommand*{\@@seventiethsfrenchswiss}[1]{%
-\ifcase#1\relax
-\@tenthstring{7}%
-\or
-\@tenstring{7} \@andname\ \@unitthstring{1}%
-\else
-\@tenstring{7}-\@unitthstring{#1}%
-\fi}
+\def\fc@@pot@longscalefrench#1#2#3{%
+ {%
% \end{macrocode}
-% Eighties vary depending on dialect. Swiss:
+% First the input arguments are saved into local objects: \texttt{\#1} and \texttt{\#1} are respectively saved
+% into \cs{@tempa} and \cs{@tempb}.
% \begin{macrocode}
-\newcommand*{\@@eightiethsfrenchswiss}[1]{%
-\ifcase#1\relax
-\@tenthstring{8}%
-\or
-\@tenstring{8} \@andname\ \@unitthstring{1}%
-\else
-\@tenstring{8}-\@unitthstring{#1}%
-\fi}
+ \edef\@tempb{\number#1}%
% \end{macrocode}
-% Nineties vary depending on dialect. Swiss:
+% Let \cs{count1} be the plural value.
% \begin{macrocode}
-\newcommand*{\@@ninetiethsfrenchswiss}[1]{%
-\ifcase#1\relax
-\@tenthstring{9}%
-\or
-\@tenstring{9} \@andname\ \@unitthstring{1}%
-\else
-\@tenstring{9}-\@unitthstring{#1}%
-\fi}
+ \count1=\@tempb
% \end{macrocode}
-% French (as spoken in France) version:
+% Let \(n\) and \(r\) the the quotient and remainder of division of weight \(w\) by \(6\), that is to say \(w
+% = n\times 6 + r\) and \(0\leq r < 6\), then \cs{count2} is set to \(n\) and \cs{count3} is set to \(r\).
% \begin{macrocode}
-\newcommand*{\@@seventiethsfrench}[1]{%
-\ifnum#1=0\relax
-\@tenstring{6}%
--%
-\else
-\@tenstring{6}%
-\ \@andname\
-\fi
-\@teenthstring{#1}%
-}
+ \count2\count0 %
+ \divide\count2 by 6 %
+ \count3\count2 %
+ \multiply\count3 by 6 %
+ \count3-\count3 %
+ \advance\count3 by \count0 %
+ \ifnum\count0>0 %
% \end{macrocode}
-% Eighties (as spoken in France):
+% If weight \(w\) (a.k.a. \cs{count0}) is such that \(w>0\), then \(w\geq 3\) because \(w\) is a multiple of
+% \(3\). So we \emph{may} have to append ``mil(le)'' or ``\meta{$n$}illion(s)'' or ``\meta{$n$}illiard(s)''.
% \begin{macrocode}
-\newcommand*{\@@eightiethsfrench}[1]{%
-\ifnum#1>0\relax
-\@unitstring{4}-\@tenstring{2}%
--\@unitthstring{#1}%
-\else
-\@unitstring{4}-\@tenthstring{2}%
-\fi
-}
+ \ifnum\count1>0 %
% \end{macrocode}
-% Nineties (as spoken in France):
+% Plural value is \(>0\) so have at least one ``mil(le)'' or ``\meta{$n$}illion(s)'' or
+% ``\meta{$n$}illiard(s)''. We need to distinguish between the case of ``mil(le)'' and that of
+% ``\meta{$n$}illion(s)'' or ``\meta{$n$}illiard(s)'', so we \cs{def}ine \cs{@temph} to `\texttt{1}' for
+% ``mil(le)'', and to `\texttt{2}' otherwise.
% \begin{macrocode}
-\newcommand*{\@@ninetiethsfrench}[1]{%
-\@unitstring{4}-\@tenstring{2}-\@teenthstring{#1}%
-}
+ \edef\@temph{%
+ \ifnum\count2=0 % weight=3
% \end{macrocode}
-% As above, but with initial letter in upper case. Units:
+% Here \(n=0\), with \(n=w\div 6\),but we also know that \(w\geq 3\), so we have \(w=3\) which means we are in
+% the ``mil(le)'' case.
% \begin{macrocode}
-\newcommand*{\@@Unitthstringfrench}[1]{%
-\ifcase#1\relax
-Zero%
-\or Uni\`eme%
-\or Deuxi\`eme%
-\or Troisi\`eme%
-\or Quatri\`eme%
-\or Cinqui\`eme%
-\or Sixi\`eme%
-\or Septi\`eme%
-\or Huiti\`eme%
-\or Neuvi\`eme%
-\fi
-}
+ 1%
+ \else
+ \ifnum\count3>2 %
% \end{macrocode}
-% Tens (includes Belgian and Swiss variants):
+% Here we are in the case of \(3\leq r < 6\), with \(r\) the remainder of division of weight \(w\) by \(6\),
+% we should have ``\meta{$n$}illiard(s)'', but that may also be ``mil(le)'' instead depending on
+% option `\texttt{n-illiard upto}', known as \cs{fc@longscale@nilliard@upto}.
% \begin{macrocode}
-\newcommand*{\@@Tenthstringfrench}[1]{%
-\ifcase#1\relax
-\or Dixi\`eme%
-\or Vingti\`eme%
-\or Trentri\`eme%
-\or Quaranti\`eme%
-\or Cinquanti\`eme%
-\or Soixanti\`eme%
-\or Septenti\`eme%
-\or Huitanti\`eme%
-\or Nonenti\`eme%
-\fi
-}
+ \ifnum\fc@longscale@nilliard@upto=0 %
% \end{macrocode}
-% Teens:
+% Here option `\texttt{n-illiard upto}' is `\texttt{infinity}', so we always use ``\meta{$n$}illiard(s)''.
% \begin{macrocode}
-\newcommand*{\@@Teenthstringfrench}[1]{%
-\ifcase#1\relax
-Dixi\`eme%
-\or Onzi\`eme%
-\or Douzi\`eme%
-\or Treizi\`eme%
-\or Quatorzi\`eme%
-\or Quinzi\`eme%
-\or Seizi\`eme%
-\or Dix-Septi\`eme%
-\or Dix-Huiti\`eme%
-\or Dix-Neuvi\`eme%
-\fi
-}
+ 2%
+ \else
% \end{macrocode}
-% Store textual representation of number (first argument) in given control
-% sequence (second argument).
+% Here option `\texttt{n-illiard upto}' indicate some threshold to which to compare \(n\)
+% (a.k.a. \cs{count2}).
% \begin{macrocode}
-\newcommand*{\@@numberstringfrench}[2]{%
-\ifnum#1>99999
-\PackageError{fmtcount}{Out of range}%
-{This macro only works for values less than 100000}%
-\else
-\ifnum#1<0
-\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
-\def#2{}%
-\@strctr=#1\relax \divide\@strctr by 1000\relax
-\ifnum\@strctr>9\relax
-% #1 is greater or equal to 10000
- \@tmpstrctr=\@strctr
- \divide\@strctr by 10\relax
- \ifnum\@strctr>1\relax
- \ifthenelse{\(\@strctr>6\)\and\(\@strctr<10\)}{%
- \@modulo{\@tmpstrctr}{10}%
- \ifnum\@strctr<8\relax
- \let\@@fc@numstr#2\relax
- \edef#2{\@@fc@numstr\@seventies{\@tmpstrctr}}%
- \else
- \ifnum\@strctr<9\relax
- \let\@@fc@numstr#2\relax
- \edef#2{\@@fc@numstr\@eighties{\@tmpstrctr}}%
+ \ifnum\count2>\fc@longscale@nilliard@upto
+ 1%
+ \else
+ 2%
+ \fi
+ \fi
+ \else
+ 2%
+ \fi
+ \fi
+ }%
+ \ifnum\@temph=1 %
+% \end{macrocode}
+% Here \(10^w\) is formatted as ``mil(le)''.
+% \begin{macrocode}
+ \count10=\fc@frenchoptions@mil@plural\space
+ \edef\@tempe{%
+ \noexpand\fc@case
+ mil%
+ \fc@@do@plural@mark\fc@frenchoptions@mil@plural@mark
+ \noexpand\@nil
+ }%
\else
- \ifnum\@strctr<10\relax
- \let\@@fc@numstr#2\relax
- \edef#2{\@@fc@numstr\@nineties{\@tmpstrctr}}%
+ % weight >= 6
+ \expandafter\fc@@latin@cardinal@pefix\expandafter{\the\count2}\@tempg
+ % now form the xxx-illion(s) or xxx-illiard(s) word
+ \ifnum\count3>2 %
+ \toks10{illiard}%
+ \count10=\csname fc@frenchoptions@n-illiard@plural\endcsname\space
+ \else
+ \toks10{illion}%
+ \count10=\csname fc@frenchoptions@n-illion@plural\endcsname\space
\fi
+ \edef\@tempe{%
+ \noexpand\fc@case
+ \@tempg
+ \the\toks10 %
+ \fc@@do@plural@mark s%
+ \noexpand\@nil
+ }%
\fi
+ \else
+% \end{macrocode}
+% Here plural indicator of \(d\) indicates that \(d = 0\), so we have \(0\times10^{w}\), and it is not worth
+% to format \(10^{w}\), because there are none of them.
+% \begin{macrocode}
+ \let\@tempe\@empty
+ \def\@temph{0}%
\fi
- }{%
- \let\@@fc@numstr#2\relax
- \edef#2{\@@fc@numstr\@tenstring{\@strctr}}%
- \@strctr=#1\relax
- \divide\@strctr by 1000\relax
- \@modulo{\@strctr}{10}%
- \ifnum\@strctr>0\relax
- \let\@@fc@numstr#2\relax
- \edef#2{\@@fc@numstr\ \@unitstring{\@strctr}}%
- \fi
- }%
- \else
- \@strctr=#1\relax
- \divide\@strctr by 1000
- \@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
-\ifnum\@strctr>0\relax
- \ifnum#1>1000\relax
- \let\@@fc@numstr#2\relax
- \edef#2{\@@fc@numstr\ }%
- \fi
- \@tmpstrctr=#1\relax
- \@modulo{\@tmpstrctr}{1000}\relax
- \ifnum\@tmpstrctr=100\relax
- \let\@@fc@numstr#2\relax
- \edef#2{\@@fc@numstr\@tenstring{10}}%
- \else
- \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\@hundred}%
- \fi
-\fi
-\@strctr=#1\relax \@modulo{\@strctr}{100}%
-%\@tmpstrctr=#1\relax
-%\divide\@tmpstrctr by 100\relax
-\ifnum#1>100\relax
- \ifnum\@strctr>0\relax
- \let\@@fc@numstr#2\relax
- \edef#2{\@@fc@numstr\ }%
- \else
- \ifnum\@tmpstrctr>0\relax
- \let\@@fc@numstr#2\relax
- \edef#2{\@@fc@numstr s}%
- \fi%
- \fi
-\fi
-\ifnum\@strctr>19\relax
- \@tmpstrctr=\@strctr
- \divide\@strctr by 10\relax
- \ifthenelse{\@strctr>6}{%
- \@modulo{\@tmpstrctr}{10}%
- \ifnum\@strctr<8\relax
- \let\@@fc@numstr#2\relax
- \edef#2{\@@fc@numstr\@seventies{\@tmpstrctr}}%
\else
- \ifnum\@strctr<9\relax
- \let\@@fc@numstr#2\relax
- \edef#2{\@@fc@numstr\@eighties{\@tmpstrctr}}%
+% \end{macrocode}
+% Case of \(w=0\).
+% \begin{macrocode}
+ \let\@tempe\@empty
+ \def\@temph{0}%
+ \fi
+% \end{macrocode}
+% Now place into \@cs{@tempa} the assignment of results \cs{@temph} and \cs{@tempe} to \texttt{\#2} and
+% \texttt{\#3} for further propagation after closing brace.
+% \begin{macrocode}
+ \expandafter\toks\expandafter1\expandafter{\@tempe}%
+ \toks0{#2}%
+ \edef\@tempa{\the\toks0 \@temph \def\noexpand#3{\the\toks1}}%
+ \expandafter
+ }\@tempa
+}
+% \end{macrocode}
+% \DescribeMacro\fc@@pot@shortscalefrench Macro \cs{fc@@pot@shortscalefrench} is used to produce
+% powers of ten with short scale convention. This convention is the US convention and is not correct for
+% French and elsewhere in Europe. First we check that the macro is not yet defined.
+% \begin{macrocode}
+\@ifundefined{fc@@pot@shortscalefrench}{}{%
+ \PackageError{fmtcount}{Duplicate definition}{Redefinition of macro
+ `fc@@pot@shortscalefrench'}}
+% \end{macrocode}
+% Arguments as follows --- same interface as for \cs{fc@@pot@longscalefrench}:\interface
+% \begin{macrocode}
+\def\fc@@pot@shortscalefrench#1#2#3{%
+ {%
+% \end{macrocode}
+% First save input arguments \texttt{\#1}, \texttt{\#2}, and \texttt{\#3} into local macros
+% respectively \cs{@tempa}, \cs{@tempb}, \cs{@tempc} and \cs{@tempd}.
+% \begin{macrocode}
+ \edef\@tempb{\number#1}%
+% \end{macrocode}
+% And let \cs{count1} be the plural value.
+% \begin{macrocode}
+ \count1=\@tempb
+% \end{macrocode}
+% Now, let \cs{count2} be the integer \(n\) generating the pseudo latin prefix, i.e. \(n\) is such that \(w =
+% 3\times n + 3\).
+% \begin{macrocode}
+ \count2\count0 %
+ \divide\count2 by 3 %
+ \advance\count2 by -1 %
+% \end{macrocode}
+% Here is the real job, the formatted power of ten will go to \cs{@tempe}, and its power type will go to
+% \cs{@temph}. Please remember that the power type is an index in \([0\intv 2]\) indicating whether \(10^w\)
+% is formatted as \meta{nothing}, ``mil(le)'' or ``\meta{$n$}illion(s)\textbar\meta{$n$}illiard(s)''.
+% \begin{macrocode}
+ \ifnum\count0>0 % If weight>=3, i.e we do have to append thousand or n-illion(s)/n-illiard(s)
+ \ifnum\count1>0 % we have at least one thousand/n-illion/n-illiard
+ \ifnum\count2=0 %
+ \def\@temph{1}%
+ \count1=\fc@frenchoptions@mil@plural\space
+ \edef\@tempe{%
+ mil%
+ \fc@@do@plural@mark\fc@frenchoptions@mil@plural@mark
+ }%
+ \else
+ \def\@temph{2}%
+ % weight >= 6
+ \expandafter\fc@@latin@cardinal@pefix\expandafter{\the\count2}\@tempg
+ \count10=\csname fc@frenchoptions@n-illion@plural\endcsname\space
+ \edef\@tempe{%
+ \noexpand\fc@case
+ \@tempg
+ illion%
+ \fc@@do@plural@mark s%
+ \noexpand\@nil
+ }%
+ \fi
\else
- \let\@@fc@numstr#2\relax
- \edef#2{\@@fc@numstr\@nineties{\@tmpstrctr}}%
+% \end{macrocode}
+% Here we have \(d=0\), so nothing is to be formatted for \(d\times 10^w\).
+% \begin{macrocode}
+ \def\@temph{0}%
+ \let\@tempe\@empty
\fi
+ \else
+% \end{macrocode}
+% Here \(w=0\).
+% \begin{macrocode}
+ \def\@temph{0}%
+ \let\@tempe\@empty
\fi
- }{%
- \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
- \ifnum\@strctr=1\relax
- \edef#2{\@@fc@numstr\ \@andname\ }%
- \else
- \edef#2{\@@fc@numstr-}%
+% now place into \@cs{@tempa} the assignment of results \cs{@temph} and \cs{@tempe} to to \texttt{\#2} and
+% \texttt{\#3} for further propagation after closing brace.
+% \begin{macrocode}
+ \expandafter\toks\expandafter1\expandafter{\@tempe}%
+ \toks0{#2}%
+ \edef\@tempa{\the\toks0 \@temph \def\noexpand#3{\the\toks1}}%
+ \expandafter
+ }\@tempa
+}
+% \end{macrocode}
+% \DescribeMacro\fc@@pot@recursivefrench Macro \cs{fc@@pot@recursivefrench} is used to produce
+% power of tens that are of the form ``million de milliards de milliards'' for \(10^{24}\). First we check
+% that the macro is not yet defined.
+% \begin{macrocode}
+\@ifundefined{fc@@pot@recursivefrench}{}{%
+ \PackageError{fmtcount}{Duplicate definition}{Redefinition of macro
+ `fc@@pot@recursivefrench'}}
+% \end{macrocode}
+% The arguments are as follows --- same interface as for \cs{fc@@pot@longscalefrench}:\interface
+% \begin{macrocode}
+\def\fc@@pot@recursivefrench#1#2#3{%
+ {%
+% \end{macrocode}
+% First the input arguments are saved into local objects: \texttt{\#1} and \texttt{\#1} are respectively saved
+% into \cs{@tempa} and \cs{@tempb}.
+% \begin{macrocode}
+ \edef\@tempb{\number#1}%
+ \let\@tempa\@@tempa
+% \end{macrocode}
+% New get the inputs \texttt{\#1} and \texttt{\#1} into counters \cs{count0} and \cs{count1} as this is more
+% practical.
+% \begin{macrocode}
+ \count1=\@tempb\space
+% \end{macrocode}
+% Now compute into \cs{count2} how many times ``de milliards'' has to be repeated.
+% \begin{macrocode}
+ \ifnum\count1>0 %
+ \count2\count0 %
+ \divide\count2 by 9 %
+ \advance\count2 by -1 %
+ \let\@tempe\@empty
+ \edef\@tempf{\fc@frenchoptions@supermillion@dos
+ de\fc@frenchoptions@supermillion@dos\fc@case milliards\@nil}%
+ \count11\count0 %
+ \ifnum\count2>0 %
+ \count3\count2 %
+ \count3-\count3 %
+ \multiply\count3 by 9 %
+ \advance\count11 by \count3 %
+ \loop
+ % (\count2, \count3) <- (\count2 div 2, \count2 mod 2)
+ \count3\count2 %
+ \divide\count3 by 2 %
+ \multiply\count3 by 2 %
+ \count3-\count3 %
+ \advance\count3 by \count2 %
+ \divide\count2 by 2 %
+ \ifnum\count3=1 %
+ \let\@tempg\@tempe
+ \edef\@tempe{\@tempg\@tempf}%
+ \fi
+ \let\@tempg\@tempf
+ \edef\@tempf{\@tempg\@tempg}%
+ \ifnum\count2>0 %
+ \repeat
\fi
- \let\@@fc@numstr#2\relax
- \edef#2{\@@fc@numstr\@unitstring{\@strctr}}%
+ \divide\count11 by 3 %
+ \ifcase\count11 % 0 .. 5
+ % 0 => d milliard(s) (de milliards)*
+ \def\@temph{2}%
+ \count10=\csname fc@frenchoptions@n-illiard@plural\endcsname\space
+ \or % 1 => d mille milliard(s) (de milliards)*
+ \def\@temph{1}%
+ \count10=\fc@frenchoptions@mil@plural\space
+ \or % 2 => d million(s) (de milliards)*
+ \def\@temph{2}%
+ \count10=\csname fc@frenchoptions@n-illion@plural\endcsname\space
+ \or % 3 => d milliard(s) (de milliards)*
+ \def\@temph{2}%
+ \count10=\csname fc@frenchoptions@n-illiard@plural\endcsname\space
+ \or % 4 => d mille milliards (de milliards)*
+ \def\@temph{1}%
+ \count10=\fc@frenchoptions@mil@plural\space
+ \else % 5 => d million(s) (de milliards)*
+ \def\@temph{2}%
+ \count10=\csname fc@frenchoptions@n-illion@plural\endcsname\space
+ \fi
+ \let\@tempg\@tempe
+ \edef\@tempf{%
+ \ifcase\count11 % 0 .. 5
+ \or
+ mil\fc@@do@plural@mark \fc@frenchoptions@mil@plural@mark
+ \or
+ million\fc@@do@plural@mark s%
+ \or
+ milliard\fc@@do@plural@mark s%
+ \or
+ mil\fc@@do@plural@mark\fc@frenchoptions@mil@plural@mark
+ \noexpand\@nil\fc@frenchoptions@supermillion@dos
+ \noexpand\fc@case milliards% 4
+ \or
+ million\fc@@do@plural@mark s%
+ \noexpand\@nil\fc@frenchoptions@supermillion@dos
+ de\fc@frenchoptions@supermillion@dos\noexpand\fc@case milliards% 5
+ \fi
+ }%
+ \edef\@tempe{%
+ \ifx\@tempf\@empty\else
+ \expandafter\fc@case\@tempf\@nil
+ \fi
+ \@tempg
+ }%
+ \else
+ \def\@temph{0}%
+ \let\@tempe\@empty
\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}}%
+% \end{macrocode}
+% now place into \@cs{@tempa} the assignment of results \cs{@temph} and \cs{@tempe} to to \texttt{\#2} and
+% \texttt{\#3} for further propagation after closing brace.
+% \begin{macrocode}
+ \expandafter\toks\expandafter1\expandafter{\@tempe}%
+ \toks0{#2}%
+ \edef\@tempa{\the\toks0 \@temph \def\noexpand#3{\the\toks1}}%
+ \expandafter
+ }\@tempa
+}
+% \end{macrocode}
+% \DescribeMacro\fc@muladdfrench Macro \cs{fc@muladdfrench} is used to format the sum of a number \(a\) and
+% the product of a number \(d\) by a power of ten \(10^w\). Number \(d\) is made of three consecutive digits
+% \(d_{w+2}d_{w+1}d_w\) of respective weights \(w+2\), \(w+1\), and \(w\), while number \(a\) is made of all
+% digits with weight \(w' > w+2\) that have already been formatted. First check that the macro is not yet
+% defined.
+% \begin{macrocode}
+\@ifundefined{fc@muladdfrench}{}{%
+ \PackageError{fmtcount}{Duplicate definition}{Redefinition of macro
+ `fc@muladdfrench'}}
+% \end{macrocode}
+% Arguments as follows:\newline\noindent
+% \begin{tabularx}{\linewidth}{@{}>{\raggedleft\arraybackslash\ttfamily}rX@{}}
+% \#2&input, plural indicator for number \(d\)\\
+% \#3&input, formatted number \(d\)\\
+% \#5&input, formatted number \(10^w\), i.e. power of ten which is multiplied by \(d\)\\
+% \end{tabularx}
+% Implicit arguments from context:\newline\noindent
+% \begin{tabularx}{\linewidth}{@{}>{\raggedleft\arraybackslash\ttfamily}rX@{}}
+% \cs{@tempa}&input, formatted number \(a\)\\
+% &output, macro to which place the mul-add result\\
+% \cs{count8}&input, power type indicator for \(10^{w'}\), where \(w'\) is a weight of \(a\), this is an
+% index in \([0\intv 2]\) that reflects whether \(10^{w'}\) is formatted by ``mil(le)'' --- for index \(=1\)
+% --- or by ``\meta{$n$}illion(s)\textbar\meta{$n$}illiard(s)'' --- for index \(=2\)\\
+% \cs{count9}&input, power type indicator for \(10^w\), this is an index in \([0\intv 2]\) that reflect
+% whether the weight \(w\) of \(d\) is formatted by ``meta{nothing}'' --- for index \(=0\), ``mil(le)'' ---
+% for index
+% \(=1\) --- or by ``\meta{$n$}illion(s)\textbar \meta{$n$}illiard(s)'' --- for index \(=2\)\\
+% \end{tabularx}
+% \begin{macrocode}
+\def\fc@muladdfrench#1#2#3{%
+ {%
+% \end{macrocode}
+% First we save input arguments \texttt{\#1} -- \texttt{\#3} to local macros \cs{@tempc}, \cs{@tempd} and
+% \cs{@tempf}.
+% \begin{macrocode}
+ \edef\@@tempc{#1}%
+ \edef\@@tempd{#2}%
+ \edef\@tempf{#3}%
+ \let\@tempc\@@tempc
+ \let\@tempd\@@tempd
+% \end{macrocode}
+% First we want to do the ``multiplication'' of \(d \Rightarrow \cs{@tempd}\) and of \(10^w \Rightarrow
+% \cs{@tempf}\). So, prior to this we do some preprocessing of \(d \Rightarrow \cs{@tempd}\): we force
+% \cs{@tempd} to \meta{empty} if both \(d=1\) and \(10^w\Rightarrow\) ``mil(le)'', this is because we,
+% French, we do not say ``un mil'', but just ``mil''.
+% \begin{macrocode}
+ \ifnum\@tempc=1 %
+ \ifnum\count9=1 %
+ \let\@tempd\@empty
\fi
- \else%(>0,<10)
- \let\@@fc@numstr#2\relax
- \edef#2{\@@fc@numstr\@unitstring{\@strctr}}%
\fi
- \else%>10
- \@modulo{\@strctr}{10}%
- \let\@@fc@numstr#2\relax
- \edef#2{\@@fc@numstr\@teenstring{\@strctr}}%
- \fi
-\fi
-}
% \end{macrocode}
-% Store textual representation of an ordinal (from number
-% specified in first argument) in given control
-% sequence (second argument).
+% Now we do the ``multiplication'' of \(d = \cs{@tempd}\) and of \(10^w = \cs{@tempf}\), and place the result
+% into \cs{@tempg}.
+% \begin{macrocode}
+ \edef\@tempg{%
+ \@tempd
+ \ifx\@tempd\@empty\else
+ \ifx\@tempf\@empty\else
+ \ifcase\count9 %
+ \or
+ \fc@frenchoptions@submillion@dos
+ \or
+ \fc@frenchoptions@supermillion@dos
+ \fi
+ \fi
+ \fi
+ \@tempf
+ }%
+% \end{macrocode}
+% Now to the ``addition'' of \(a\Rightarrow \cs{@tempa}\) and \(d\times 10^w\Rightarrow \cs{@tempg}\), and
+% place the results into \cs{@temph}.
+% \begin{macrocode}
+ \edef\@temph{%
+ \@tempa
+ \ifx\@tempa\@empty\else
+ \ifx\@tempg\@empty\else
+ \ifcase\count8 %
+ \or
+ \fc@frenchoptions@submillion@dos
+ \or
+ \fc@frenchoptions@supermillion@dos
+ \fi
+ \fi
+ \fi
+ \@tempg
+ }%
+% \end{macrocode}
+% Now propagate the result --- i.e. the expansion of \cs{@temph} --- into macro \cs{@tempa} after closing
+% brace.
% \begin{macrocode}
-\newcommand*{\@@ordinalstringfrench}[2]{%
-\ifnum#1>99999
-\PackageError{fmtcount}{Out of range}%
-{This macro only works for values less than 100000}%
-\else
-\ifnum#1<0
-\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
-\def#2{}%
-\@strctr=#1\relax \divide\@strctr by 1000\relax
-\ifnum\@strctr>9
-% #1 is greater or equal to 10000
- \@tmpstrctr=\@strctr
- \divide\@strctr by 10\relax
- \ifnum\@strctr>1\relax
- \ifthenelse{\@strctr>6}{%
- \@modulo{\@tmpstrctr}{10}%
- \ifnum\@strctr=7\relax
- \let\@@fc@ordstr#2\relax
- \edef#2{\@@fc@ordstr\@seventies{\@tmpstrctr}}%
+ \def\@tempb##1{\def\@tempa{\def\@tempa{##1}}}%
+ \expandafter\@tempb\expandafter{\@temph}%
+ \expandafter
+ }\@tempa
+}%
+% \end{macrocode}
+% \DescribeMacro\fc@lthundredstringfrench Macro \cs{fc@lthundredstringfrench} is used to format a number in
+% interval \([0 \intv 99]\). First we check that it is not already defined.
+% \begin{macrocode}
+\@ifundefined{fc@lthundredstringfrench}{}{%
+ \PackageError{fmtcount}{Duplicate definition}{Redefinition of macro
+ `fc@lthundredstringfrench'}}
+% \end{macrocode}
+% The number to format is not passed as an argument to this macro, instead each digits of it is in a
+% \cs{fc@digit@\meta{w}} macro after this number has been parsed. So the only thing that
+% \cs{fc@lthundredstringfrench} needs is to know \meta{w} which is passed as \cs{count0} for the less
+% significant digit.\newline
+% \begin{tabularx}{\linewidth}{@{}>{\raggedleft\arraybackslash\ttfamily}rX@{}}
+% \#1&intput/output macro to which append the result
+% \end{tabularx}
+% Implicit input arguments as follows:\newline
+% \begin{tabularx}{\linewidth}{@{}>{\raggedleft\arraybackslash\ttfamily}rX@{}}
+% \cs{count0}&weight \(w\) of least significant digit \(d_{w}\).
+% \end{tabularx}
+% The formatted number is appended to the content of \#1, and the result is placed into \#1.
+% \begin{macrocode}
+\def\fc@lthundredstringfrench#1{%
+ {%
+% \end{macrocode}
+% First save arguments into local temporary macro.
+% \begin{macrocode}
+ \let\@tempc#1%
+% \end{macrocode}
+% Read units \(d_w\) to \cs{count1}.
+% \begin{macrocode}
+ \fc@read@unit{\count1}{\count0}%
+% \end{macrocode}
+% Read tens \(d_{w+1}\) to \cs{count2}.
+% \begin{macrocode}
+ \count3\count0 %
+ \advance\count3 1 %
+ \fc@read@unit{\count2}{\count3}%
+% \end{macrocode}
+% Now do the real job, set macro \cs{@tempa} to \texttt{\#1} followed by \(d_{w+1}d_w\) formatted.
+% \begin{macrocode}
+ \edef\@tempa{%
+ \@tempc
+ \ifnum\count2>1 %
+ % 20 .. 99
+ \ifnum\count2>6 %
+ % 70 .. 99
+ \ifnum\count2<8 %
+ % 70 .. 79
+ \@seventies{\count1}%
+ \else
+ % 80..99
+ \ifnum\count2<9 %
+ % 80 .. 89
+ \@eighties{\count1}%
+ \else
+ % 90 .. 99
+ \@nineties{\count1}%
+ \fi
+ \fi
+ \else
+ % 20..69
+ \@tenstring{\count2}%
+ \ifnum\count1>0 %
+ % x1 .. x0
+ \ifnum\count1=1 %
+ % x1
+ \fc@frenchoptions@submillion@dos\@andname\fc@frenchoptions@submillion@dos
+ \else
+ % x2 .. x9
+ -%
+ \fi
+ \@unitstring{\count1}%
+ \fi
+ \fi
\else
- \ifnum\@strctr=8\relax
- \let\@@fc@ordstr#2\relax
- \edef#2{\@@fc@ordstr\@eighties{\@tmpstrctr}}%
+ % 0 .. 19
+ \ifnum\count2=0 % when tens = 0
+ % 0 .. 9
+ \ifnum\count1=0 % when units = 0
+ % \count3=1 when #1 = 0, i.e. only for the unit of the top level number
+ \ifnum\count3=1 %
+ \ifnum\fc@max@weight=0 %
+ \@unitstring{0}%
+ \fi
+ \fi
+ \else
+ % 1 .. 9
+ \@unitstring{\count1}%
+ \fi
\else
- \let\@@fc@ordstr#2\relax
- \edef#2{\@@fc@ordstr\@nineties{\@tmpstrctr}}%
+ % 10 .. 19
+ \@teenstring{\count1}%
\fi
\fi
- }{%
- \let\@@fc@ordstr#2\relax
- \edef#2{\@@fc@ordstr\@tenstring{\@strctr}}%
- \@strctr=#1\relax
- \divide\@strctr by 1000\relax
- \@modulo{\@strctr}{10}%
- \ifnum\@strctr=1\relax
- \let\@@fc@ordstr#2\relax
- \edef#2{\@@fc@ordstr\ \@andname}%
- \fi
- \ifnum\@strctr>0\relax
- \let\@@fc@ordstr#2\relax
- \edef#2{\@@fc@ordstr\ \@unitstring{\@strctr}}%
- \fi
}%
- \else
- \@strctr=#1\relax
- \divide\@strctr by 1000\relax
- \@modulo{\@strctr}{10}%
- \let\@@fc@ordstr#2\relax
- \edef#2{\@@fc@ordstr\@teenstring{\@strctr}}%
- \fi
- \@strctr=#1\relax \@modulo{\@strctr}{1000}%
- \ifnum\@strctr=0\relax
- \let\@@fc@ordstr#2\relax
- \edef#2{\@@fc@ordstr\ \@thousandth}%
- \else
- \let\@@fc@ordstr#2\relax
- \edef#2{\@@fc@ordstr\ \@thousand}%
- \fi
-\else
- \ifnum\@strctr>0\relax
- \let\@@fc@ordstr#2\relax
- \edef#2{\@@fc@ordstr\@unitstring{\@strctr}}%
- \@strctr=#1\relax \@modulo{\@strctr}{1000}%
- \ifnum\@strctr=0\relax
- \let\@@fc@ordstr#2\relax
- \edef#2{\@@fc@ordstr\ \@thousandth}%
- \else
- \let\@@fc@ordstr#2\relax
- \edef#2{\@@fc@ordstr\ \@thousand}%
- \fi
- \fi
-\fi
-\@strctr=#1\relax \@modulo{\@strctr}{1000}%
-\divide\@strctr by 100\relax
-\ifnum\@strctr>0\relax
- \ifnum#1>1000\relax
- \let\@@fc@ordstr#2\relax
- \edef#2{\@@fc@ordstr\ }%
- \fi
- \let\@@fc@ordstr#2\relax
- \edef#2{\@@fc@ordstr\@unitstring{\@strctr}}%
- \@strctr=#1\relax \@modulo{\@strctr}{100}%
- \let\@@fc@ordstr#2\relax
- \ifnum\@strctr=0\relax
- \edef#2{\@@fc@ordstr\ \@hundredth}%
- \else
- \edef#2{\@@fc@ordstr\ \@hundred}%
- \fi
-\fi
-\@tmpstrctr=\@strctr
-\@strctr=#1\relax \@modulo{\@strctr}{100}%
-\ifnum#1>100\relax
- \ifnum\@strctr>0\relax
- \let\@@fc@ordstr#2\relax
- \edef#2{\@@fc@ordstr\ \@andname\ }%
- \fi
-\fi
-\ifnum\@strctr>19\relax
- \@tmpstrctr=\@strctr
- \divide\@strctr by 10\relax
- \@modulo{\@tmpstrctr}{10}%
- \ifthenelse{\@strctr>6}{%
- \ifnum\@strctr=7\relax
- \let\@@fc@ordstr#2\relax
- \edef#2{\@@fc@ordstr\@seventieths{\@tmpstrctr}}%
- \else
- \ifnum\@strctr=8\relax
- \let\@@fc@ordstr#2\relax
- \edef#2{\@@fc@ordstr\@eightieths{\@tmpstrctr}}%
- \else
- \let\@@fc@ordstr#2\relax
- \edef#2{\@@fc@ordstr\@ninetieths{\@tmpstrctr}}%
+% \end{macrocode}
+% Now propagate the expansion of \cs{@tempa} into \texttt{\#2} after closing brace.
+% \begin{macrocode}
+ \def\@tempb##1{\def\@tempa{\def#1{##1}}}%
+ \expandafter\@tempb\expandafter{\@tempa}%
+ \expandafter
+ }\@tempa
+}
+% \end{macrocode}
+% \DescribeMacro\fc@ltthousandstringfrench Macro \cs{fc@ltthousandstringfrench} is used to format a number in
+% interval \([0 \intv 999]\). First we check that it is not already defined.
+% \begin{macrocode}
+\@ifundefined{fc@ltthousandstringfrench}{}{%
+ \PackageError{fmtcount}{Duplicate definition}{Redefinition of macro
+ `fc@ltthousandstringfrench'}}
+% \end{macrocode}
+% Output is empty for 0. Arguments as follows:\newline\noindent
+% \begin{tabularx}{\linewidth}{@{}>{\raggedleft\arraybackslash\ttfamily}rX@{}}
+% \#2&output, macro, formatted number \(d = d_{w+2}d_{w+1}d_w\)
+% \end{tabularx}
+% Implicit input arguments as follows:\newline\noindent
+% \begin{tabularx}{\linewidth}{@{}>{\raggedleft\arraybackslash\ttfamily}rX@{}}
+% \cs{count0}&input weight \(10^{w}\) of number \(d_{w+2}d_{w+1}d_w\) to be formatted.\\
+% \cs{count5}&least weight of formatted number with a non null digit.\\
+% \cs{count9}&input, power type indicator of \(10^{w}\) \(0\Rightarrow\varnothing\), \(1\Rightarrow\textrm {
+% ``mil(le)''}\), \(2\Rightarrow\textrm {\meta{$n$}illion(s)\textbar\meta{$n$}illiard(s)}\)\\
+% \end{tabularx}
+% \begin{macrocode}
+\def\fc@ltthousandstringfrench#1{%
+ {%
+% \end{macrocode}
+% Set counter \cs{count2} to digit \(d_{w+2}\), i.e. hundreds.
+% \begin{macrocode}
+ \count4\count0 %
+ \advance\count4 by 2 %
+ \fc@read@unit{\count2 }{\count4 }%
+% \end{macrocode}
+% Check that the two subsequent digits \(d_{w+1}d_w\) are non zero, place check-result into \cs{@tempa}.
+% \begin{macrocode}
+ \advance\count4 by -1 %
+ \count3\count4 %
+ \advance\count3 by -1 %
+ \fc@check@nonzeros{\count3 }{\count4 }\@tempa
+% \end{macrocode}
+% Compute plural mark of `cent' into \cs{@temps}.
+% \begin{macrocode}
+ \edef\@temps{%
+ \ifcase\fc@frenchoptions@cent@plural\space
+ % 0 => always
+ s%
+ \or
+ % 1 => never
+ \or
+ % 2 => multiple
+ \ifnum\count2>1s\fi
+ \or
+ % 3 => multiple g-last
+ \ifnum\count2>1 \ifnum\@tempa=0 \ifnum\count0=\count6s\fi\fi\fi
+ \or
+ % 4 => multiple l-last
+ \ifnum\count2>1 \ifnum\@tempa=0 \ifnum\count9=0s\else\ifnum\count9=2s\fi\fi\fi\fi
\fi
+ }%
+ % compute spacing after cent(s?) into \@tempb
+ \expandafter\let\expandafter\@tempb
+ \ifnum\@tempa>0 \fc@frenchoptions@submillion@dos\else\@empty\fi
+ % now place into \@tempa the hundreds
+ \edef\@tempa{%
+ \ifnum\count2=0 %
+ \else
+ \ifnum\count2=1 %
+ \expandafter\fc@case\@hundred\@nil
+ \else
+ \@unitstring{\count2}\fc@frenchoptions@submillion@dos
+ \noexpand\fc@case\@hundred\@temps\noexpand\@nil
+ \fi
+ \@tempb
+ \fi
+ }%
+ % now append to \@tempa the ten and unit
+ \fc@lthundredstringfrench\@tempa
+% \end{macrocode}
+% Propagate expansion of \cs{@tempa} into macro \texttt{\#2} after closing brace.
+% \begin{macrocode}
+ \def\@tempb##1{\def\@tempa{\def#1{##1}}}%
+ \expandafter\@tempb\expandafter{\@tempa}%
+ \expandafter
+ }\@tempa
+}
+% \end{macrocode}
+% \DescribeMacro\@@numberstringfrench Macro \cs{@@numberstringfrench} is the main engine for formatting
+% cadinal numbers in French. First we check that the control sequence is not yet defined.
+% \begin{macrocode}
+\@ifundefined{@@numberstringfrench}{}{%
+ \PackageError{fmtcount}{Duplicate definition}{Redefinition of macro `@@numberstringfrench'}}
+% \end{macrocode}
+% Arguments are as follows:\newline\noindent
+% \begin{tabularx}{\linewidth}{@{}>{\raggedleft\arraybackslash\ttfamily}rX@{}}
+% \#1&number to convert to string\\
+% \#2&macro into which to place the result
+% \end{tabularx}
+% \begin{macrocode}
+\def\@@numberstringfrench#1#2{%
+ {%
+% \end{macrocode}
+% First parse input number to be formatted and do some error handling.
+% \begin{macrocode}
+ \edef\@tempa{#1}%
+ \expandafter\fc@number@parser\expandafter{\@tempa}%
+ \ifnum\fc@min@weight<0 %
+ \PackageError{fmtcount}{Out of range}%
+ {This macro does not work with fractional numbers}%
\fi
- }{%
- \ifnum\@tmpstrctr=0\relax
- \let\@@fc@ordstr#2\relax
- \edef#2{\@@fc@ordstr\@tenthstring{\@strctr}}%
- \else
- \let\@@fc@ordstr#2\relax
- \edef#2{\@@fc@ordstr\@tenstring{\@strctr}}%
- \fi
- \@strctr=#1\relax \@modulo{\@strctr}{10}%
- \ifnum\@strctr=1\relax
- \let\@@fc@ordstr#2\relax
- \edef#2{\@@fc@ordstr\ \@andname}%
+% \end{macrocode}
+% In the sequel, \cs{@tempa} is used to accumulate the formatted number. Please note that \cs{space} after
+% \cs{fc@sign@case} is eaten by preceding number collection. This \cs{space} is needed so that when
+% \cs{fc@sign@case} expands to `\texttt{0}', then \cs{@tempa} is defined to `' (i.e. empty) rather than to
+% `\cs{relax}'.
+% \begin{macrocode}
+ \edef\@tempa{\ifcase\fc@sign@case\space\or\fc@case plus\@nil\or\fc@case moins\@nil\fi}%
+ \fc@nbrstr@preamble
+ \fc@@nbrstrfrench@inner
+ \fc@nbrstr@postamble
+% \end{macrocode}
+% Propagate the result --- i.e. expansion of \cs{@tempa} --- into macro \texttt{\#2} after closing brace.
+% \begin{macrocode}
+ \def\@tempb##1{\def\@tempa{\def#2{##1}}}%
+ \expandafter\@tempb\expandafter{\@tempa}%
+ \expandafter
+ }\@tempa
+}
+% \end{macrocode}
+% \DescribeMacro\fc@@nbrstrfrench@inner Common part of \cs{@@numberstringfrench} and \cs
+% {@@ordinalstringfrench}. Arguments are as follows:\newline\noindent
+% \begin{tabularx}{\linewidth}{@{}>{\raggedleft\arraybackslash\ttfamily}rX@{}}
+% \cs{@tempa}&input/output, macro to which the result is to be aggregated, initially empty or contains the
+% sign indication.\\
+% \end{tabularx}
+% \begin{macrocode}
+\def\fc@@nbrstrfrench@inner{%
+% \end{macrocode}
+% Now loop, first we compute starting weight as
+% \(3\times\left\lfloor\frac{\cs{fc@max@weight}}{3}\right\rfloor\) into \cs{count0}.
+% \begin{macrocode}
+ \count0=\fc@max@weight
+ \divide\count0 by 3 %
+ \multiply\count0 by 3 %
+% \end{macrocode}
+% Now we compute final weight into \cs{count5}, and round down too multiple of \(3\) into
+% \cs{count6}. Warning: \cs{count6} is an implicit input argument to macro \cs{fc@ltthousandstringfrench}.
+% \begin{macrocode}
+ \fc@intpart@find@last{\count5 }%
+ \count6\count5 %
+ \divide\count6 3 %
+ \multiply\count6 3 %
+ \count8=0 %
+ \loop
+% \end{macrocode}
+% First we check whether digits in weight interval \([w \intv (w+2)]\) are all zero and place check result
+% into macro \cs{@tempt}.
+% \begin{macrocode}
+ \count1\count0 %
+ \advance\count1 by 2 %
+ \fc@check@nonzeros{\count0 }{\count1 }\@tempt
+% \end{macrocode}
+% Now we generate the power of ten \(10^w\), formatted power of ten goes to \cs{@tempb}, while power type
+% indicator goes to \cs{count9}.
+% \begin{macrocode}
+ \fc@poweroften\@tempt{\count9 }\@tempb
+% \end{macrocode}
+% Now we generate the formatted number \(d\) into macro \cs{@tempd} by which we need to multiply
+% \(10^w\). Implicit input argument is \cs{count9} for power type of \(10^9\), and \cs{count6}
+% \begin{macrocode}
+ \fc@ltthousandstringfrench\@tempd
+% \end{macrocode}
+% Finally do the multiplication-addition. Implicit arguments are \cs{@tempa} for input/output growing
+% formatted number, \cs{count8} for input previous power type, i.e. power type of \(10^{w+3}\), \cs{count9}
+% for input current power type, i.e. power type of \(10^w\).
+% \begin{macrocode}
+ \fc@muladdfrench\@tempt\@tempd\@tempb
+% \end{macrocode}
+% Then iterate.
+% \begin{macrocode}
+ \count8\count9 %
+ \advance\count0 by -3 %
+ \ifnum\count6>\count0 \else
+ \repeat
+}
+% \end{macrocode}
+% \DescribeMacro\@@ordinalstringfrench Macro \cs{@@ordinalstringfrench} is the main engine for formatting
+% ordinal numbers in French. First check it is not yet defined.
+% \begin{macrocode}
+\@ifundefined{@@ordinalstringfrench}{}{%
+ \PackageError{fmtcount}{Duplicate definition}{Redefinition of macro
+ `@@ordinalstringfrench'}}
+% \end{macrocode}
+% Arguments are as follows:\newline\noindent
+% \begin{tabularx}{\linewidth}{@{}>{\raggedleft\arraybackslash\ttfamily}rX@{}}
+% \#1&number to convert to string\\
+% \#2&macro into which to place the result
+% \end{tabularx}
+% \begin{macrocode}
+\def\@@ordinalstringfrench#1#2{%
+ {%
+% \end{macrocode}
+% First parse input number to be formatted and do some error handling.
+% \begin{macrocode}
+ \edef\@tempa{#1}%
+ \expandafter\fc@number@parser\expandafter{\@tempa}%
+ \ifnum\fc@min@weight<0 %
+ \PackageError{fmtcount}{Out of range}%
+ {This macro does not work with fractional numbers}%
\fi
- \ifnum\@strctr>0\relax
- \let\@@fc@ordstr#2\relax
- \edef#2{\@@fc@ordstr\ \@unitthstring{\@strctr}}%
+ \ifnum\fc@sign@case>0 %
+ \PackageError{fmtcount}{Out of range}%
+ {This macro does with negative or explicitly marked as positive numbers}%
\fi
- }%
-\else
- \ifnum\@strctr<10\relax
- \ifnum\@strctr=0\relax
- \ifnum#1<100\relax
- \let\@@fc@ordstr#2\relax
- \edef#2{\@@fc@ordstr\@unitthstring{\@strctr}}%
+% \end{macrocode}
+% Now handle the special case of first. We set \cs{count0} to \texttt{1} if we are in this case, and to
+% \texttt{0} otherwise
+% \begin{macrocode}
+ \ifnum\fc@max@weight=0 %
+ \ifnum\csname fc@digit@0\endcsname=1 %
+ \count0=1 %
+ \else
+ \count0=0 %
\fi
\else
- \let\@@fc@ordstr#2\relax
- \edef#2{\@@fc@ordstr\@unitthstring{\@strctr}}%
+ \count0=0 %
\fi
- \else
- \@modulo{\@strctr}{10}%
- \let\@@fc@ordstr#2\relax
- \edef#2{\@@fc@ordstr\@teenthstring{\@strctr}}%
- \fi
-\fi
+ \ifnum\count0=1 %
+ \edef\@tempa{\expandafter\fc@case\fc@first\@nil}%
+ \else
+% \end{macrocode}
+% Now we tamper a little bit with the plural handling options to ensure that there is no final plural mark.
+% \begin{macrocode}
+ \def\@tempa##1{%
+ \expandafter\edef\csname fc@frenchoptions@##1@plural\endcsname{%
+ \ifcase\csname fc@frenchoptions@##1@plural\endcsname\space
+ 0% 0: always => always
+ \or
+ 1% 1: never => never
+ \or
+ 6% 2: multiple => multiple ng-last
+ \or
+ 1% 3: multiple g-last => never
+ \or
+ 5% 4: multiple l-last => multiple lng-last
+ \or
+ 5% 5: multiple lng-last => multiple lng-last
+ \or
+ 6% 6: multiple ng-last => multiple ng-last
+ \fi
+ }%
+ }%
+ \@tempa{vingt}%
+ \@tempa{cent}%
+ \@tempa{mil}%
+ \@tempa{n-illion}%
+ \@tempa{n-illiard}%
+% \end{macrocode}
+% Now make \cs{fc@case} and \cs{@nil} non expandable
+% \begin{macrocode}
+ \let\fc@case@save\fc@case
+ \def\fc@case{\noexpand\fc@case}%
+ \def\@nil{\noexpand\@nil}%
+% \end{macrocode}
+% In the sequel, \cs{@tempa} is used to accumulate the formatted number.
+% \begin{macrocode}
+ \let\@tempa\@empty
+ \fc@@nbrstrfrench@inner
+% \end{macrocode}
+% Now restore \cs{fc@case}
+% \begin{macrocode}
+ \let\fc@case\fc@case@save
+% \end{macrocode}
+% Now we add the ``i\`eme'' ending
+% \begin{macrocode}
+ \expandafter\fc@get@last@word\expandafter{\@tempa}\@tempb\@tempc
+ \expandafter\fc@get@last@letter\expandafter{\@tempc}\@tempd\@tempe
+ \def\@tempf{e}%
+ \ifx\@tempe\@tempf
+ \edef\@tempa{\@tempb\expandafter\fc@case\@tempd i\`eme\@nil}%
+ \else
+ \def\@tempf{q}%
+ \ifx\@tempe\@tempf
+ \edef\@tempa{\@tempb\expandafter\fc@case\@tempd qui\`eme\@nil}%
+ \else
+ \def\@tempf{f}%
+ \ifx\@tempe\@tempf
+ \edef\@tempa{\@tempb\expandafter\fc@case\@tempd vi\`eme\@nil}%
+ \else
+ \edef\@tempa{\@tempb\expandafter\fc@case\@tempc i\`eme\@nil}%
+ \fi
+ \fi
+ \fi
+ \fi
+% \end{macrocode}
+% Propagate the result --- i.e. expansion of \cs{@tempa} --- into macro \texttt{\#2} after closing brace.
+% \begin{macrocode}
+ \def\@tempb##1{\def\@tempa{\def#2{##1}}}%
+ \expandafter\@tempb\expandafter{\@tempa}%
+ \expandafter
+ }\@tempa
}
% \end{macrocode}
-%\iffalse
+% Macro \cs{fc@frenchoptions@setdefaults} allows to set all options to default for the French.
+% \begin{macrocode}
+\newcommand*\fc@frenchoptions@setdefaults{%
+ \csname KV@fcfrench@all plural\endcsname{reformed}%
+ \def\fc@frenchoptions@submillion@dos{-}%
+ \let\fc@frenchoptions@supermillion@dos\space
+ \let\fc@u@in@duo\@empty% Could be `u'
+ % \let\fc@poweroften\fc@@pot@longscalefrench
+ \let\fc@poweroften\fc@@pot@recursivefrench
+ \def\fc@longscale@nilliard@upto{0}% infinity
+ \def\fc@frenchoptions@mil@plural@mark{le}%
+}
+\fc@frenchoptions@setdefaults
+% \end{macrocode}
+\iffalse Local variables: \fi
+\iffalse mode: docTeX \fi
+\iffalse End: \fi%\iffalse
% \begin{macrocode}
%</fc-french.def>
% \end{macrocode}
%\fi
%\iffalse
% \begin{macrocode}
+%<*fc-frenchb.def>
+% \end{macrocode}
+%\fi
+% \subsubsection{fc-frenchb.def}
+% \begin{macrocode}
+\ProvidesFCLanguage{frenchb}[2012/06/18]
+\FCloadlang{french}
+% \end{macrocode}
+% Set |frenchb| to be equivalent to |french|.
+% \begin{macrocode}
+\let\@ordinalMfrenchb=\@ordinalMfrench
+\let\@ordinalFfrenchb=\@ordinalFfrench
+\let\@ordinalNfrenchb=\@ordinalNfrench
+\let\@numberstringMfrenchb=\@numberstringMfrench
+\let\@numberstringFfrenchb=\@numberstringFfrench
+\let\@numberstringNfrenchb=\@numberstringNfrench
+\let\@NumberstringMfrenchb=\@NumberstringMfrench
+\let\@NumberstringFfrenchb=\@NumberstringFfrench
+\let\@NumberstringNfrenchb=\@NumberstringNfrench
+\let\@ordinalstringMfrenchb=\@ordinalstringMfrench
+\let\@ordinalstringFfrenchb=\@ordinalstringFfrench
+\let\@ordinalstringNfrenchb=\@ordinalstringNfrench
+\let\@OrdinalstringMfrenchb=\@OrdinalstringMfrench
+\let\@OrdinalstringFfrenchb=\@OrdinalstringFfrench
+\let\@OrdinalstringNfrenchb=\@OrdinalstringNfrench
+% \end{macrocode}
+
+%\iffalse
+% \begin{macrocode}
+%</fc-frenchb.def>
+% \end{macrocode}
+%\fi
+%\iffalse
+% \begin{macrocode}
%<*fc-german.def>
% \end{macrocode}
%\fi
@@ -3629,7 +6021,7 @@ this number}%
% German definitions (thank you to K. H. Fricke for supplying
% this information)
% \begin{macrocode}
-\ProvidesFile{fc-german.def}[2007/06/14]
+\ProvidesFCLanguage{german}[2012/06/18]
% \end{macrocode}
% Define macro that converts a number or count register (first
% argument) to an ordinal, and stores the result in the
@@ -3657,7 +6049,7 @@ this number}%
\newcommand{\@@unitstringgerman}[1]{%
\ifcase#1%
null%
-\or ein%
+\or eins%
\or zwei%
\or drei%
\or vier%
@@ -3727,8 +6119,9 @@ zehn%
% As above, but initial letters in upper case:
% \begin{macrocode}
\DeclareRobustCommand{\@NumberstringMgerman}[2]{%
-\@numberstringMgerman{#1}{\@@num@str}%
-\edef#2{\noexpand\MakeUppercase\@@num@str}}
+ \@numberstringMgerman{#1}{\@@num@str}%
+ \edef#2{\noexpand\MakeUppercase\expandonce\@@num@str}%
+}
% \end{macrocode}
% Feminine and neuter form:
% \begin{macrocode}
@@ -3777,24 +6170,29 @@ zehn%
% As above, but with initial letters in upper case.
% \begin{macrocode}
\DeclareRobustCommand{\@OrdinalstringMgerman}[2]{%
-\@ordinalstringMgerman{#1}{\@@num@str}%
-\edef#2{\protect\MakeUppercase\@@num@str}}
+ \@ordinalstringMgerman{#1}{\@@num@str}%
+ \edef#2{\noexpand\MakeUppercase\expandonce\@@num@str}%
+}
% \end{macrocode}
% Feminine form:
% \begin{macrocode}
\DeclareRobustCommand{\@OrdinalstringFgerman}[2]{%
-\@ordinalstringFgerman{#1}{\@@num@str}%
-\edef#2{\protect\MakeUppercase\@@num@str}}
+ \@ordinalstringFgerman{#1}{\@@num@str}%
+ \edef#2{\noexpand\MakeUppercase\expandonce\@@num@str}%
+}
% \end{macrocode}
% Neuter form:
% \begin{macrocode}
\DeclareRobustCommand{\@OrdinalstringNgerman}[2]{%
-\@ordinalstringNgerman{#1}{\@@num@str}%
-\edef#2{\protect\MakeUppercase\@@num@str}}
+ \@ordinalstringNgerman{#1}{\@@num@str}%
+ \edef#2{\noexpand\MakeUppercase\expandonce\@@num@str}%
+}
% \end{macrocode}
% Code for converting numbers into textual ordinals. As before,
% it is easier to split it into units, tens and teens.
% Units:
+%\changes{2.0}{2012-09-25}{fixed spelling mistake (correction
+%provided by Dominik Wa\ss enhoven)}
% \begin{macrocode}
\newcommand{\@@unitthstringMgerman}[1]{%
\ifcase#1%
@@ -3803,7 +6201,7 @@ nullter%
\or zweiter%
\or dritter%
\or vierter%
-\or f\"unter%
+\or f\"unfter%
\or sechster%
\or siebter%
\or achter%
@@ -3895,6 +6293,8 @@ zehnte%
}
% \end{macrocode}
% Units (neuter):
+%\changes{2.0}{2012-09-25}{fixed spelling mistake (correction
+%provided by Dominik Wa\ss enhoven)}
% \begin{macrocode}
\newcommand{\@@unitthstringNgerman}[1]{%
\ifcase#1%
@@ -3903,7 +6303,7 @@ nulltes%
\or zweites%
\or drittes%
\or viertes%
-\or f\"unte%
+\or f\"unftes%
\or sechstes%
\or siebtes%
\or achtes%
@@ -3944,31 +6344,29 @@ zehntes%
\fi
}
% \end{macrocode}
-% This appends the results to |#2| for number |#2| (in range 0 to 100.)
-% null and eins are dealt with separately in |\@@numberstringgerman|.
+% This appends the results to |\#2| for number |\#2| (in range 0 to
+% 100.)
+% null and eins are dealt with separately in
+% |\@@numberstringgerman|.
% \begin{macrocode}
\newcommand{\@@numberunderhundredgerman}[2]{%
\ifnum#1<10\relax
\ifnum#1>0\relax
- \let\@@fc@numstr#2\relax
- \edef#2{\@@fc@numstr\@unitstring{#1}}%
+ \eappto#2{\@unitstring{#1}}%
\fi
\else
\@tmpstrctr=#1\relax
\@modulo{\@tmpstrctr}{10}%
\ifnum#1<20\relax
- \let\@@fc@numstr#2\relax
- \edef#2{\@@fc@numstr\@teenstring{\@tmpstrctr}}%
+ \eappto#2{\@teenstring{\@tmpstrctr}}%
\else
\ifnum\@tmpstrctr=0\relax
\else
- \let\@@fc@numstr#2\relax
- \edef#2{\@@fc@numstr\@unitstring{\@tmpstrctr}und}%
+ \eappto#2{\@unitstring{\@tmpstrctr}und}%
\fi
\@tmpstrctr=#1\relax
\divide\@tmpstrctr by 10\relax
- \let\@@fc@numstr#2\relax
- \edef#2{\@@fc@numstr\@tenstring{\@tmpstrctr}}%
+ \eappto#2{\@tenstring{\@tmpstrctr}}%
\fi
\fi
}
@@ -3992,35 +6390,42 @@ zehntes%
\def#2{}%
\@strctr=#1\relax \divide\@strctr by 1000\relax
\ifnum\@strctr>1\relax
-% #1 is >= 2000, \@strctr now contains the number of thousands
-\@@numberunderhundredgerman{\@strctr}{#2}%
- \let\@@fc@numstr#2\relax
- \edef#2{\@@fc@numstr tausend}%
+% \end{macrocode}
+% \#1 is $\geq 2000$, \cs{@strctr} now contains the number of thousands
+% \begin{macrocode}
+ \@@numberunderhundredgerman{\@strctr}{#2}%
+ \appto#2{tausend}%
\else
-% #1 lies in range [1000,1999]
+% \end{macrocode}
+% \#1 lies in range [1000,1999]
+% \begin{macrocode}
\ifnum\@strctr=1\relax
- \let\@@fc@numstr#2\relax
- \edef#2{\@@fc@numstr\eintausend}%
+ \eappto#2{\eintausend}%
\fi
\fi
\@strctr=#1\relax
\@modulo{\@strctr}{1000}%
\divide\@strctr by 100\relax
\ifnum\@strctr>1\relax
+% \end{macrocode}
% now dealing with number in range [200,999]
- \let\@@fc@numstr#2\relax
- \edef#2{\@@fc@numstr\@unitstring{\@strctr}hundert}%
+% \begin{macrocode}
+ \eappto#2{\@unitstring{\@strctr}hundert}%
\else
\ifnum\@strctr=1\relax
+% \end{macrocode}
% dealing with number in range [100,199]
+% \begin{macrocode}
\ifnum#1>1000\relax
-% if orginal number > 1000, use einhundert
- \let\@@fc@numstr#2\relax
- \edef#2{\@@fc@numstr einhundert}%
+% \end{macrocode}
+% if original number $> 1000$, use einhundert
+% \begin{macrocode}
+ \appto#2{einhundert}%
\else
-% otherwise use \einhundert
- \let\@@fc@numstr#2\relax
- \edef#2{\@@fc@numstr\einhundert}%
+% \end{macrocode}
+% otherwise use \cs{einhundert}
+% \begin{macrocode}
+ \eappto#2{\einhundert}%
\fi
\fi
\fi
@@ -4030,8 +6435,7 @@ zehntes%
\def#2{null}%
\else
\ifnum\@strctr=1\relax
- \let\@@fc@numstr#2\relax
- \edef#2{\@@fc@numstr eins}%
+ \appto#2{eins}%
\else
\@@numberunderhundredgerman{\@strctr}{#2}%
\fi
@@ -4042,24 +6446,20 @@ zehntes%
% \begin{macrocode}
\newcommand{\@@numberunderhundredthgerman}[2]{%
\ifnum#1<10\relax
- \let\@@fc@numstr#2\relax
- \edef#2{\@@fc@numstr\@unitthstring{#1}}%
+ \eappto#2{\@unitthstring{#1}}%
\else
\@tmpstrctr=#1\relax
\@modulo{\@tmpstrctr}{10}%
\ifnum#1<20\relax
- \let\@@fc@numstr#2\relax
- \edef#2{\@@fc@numstr\@teenthstring{\@tmpstrctr}}%
+ \eappto#2{\@teenthstring{\@tmpstrctr}}%
\else
\ifnum\@tmpstrctr=0\relax
\else
- \let\@@fc@numstr#2\relax
- \edef#2{\@@fc@numstr\@unitstring{\@tmpstrctr}und}%
+ \eappto#2{\@unitstring{\@tmpstrctr}und}%
\fi
\@tmpstrctr=#1\relax
\divide\@tmpstrctr by 10\relax
- \let\@@fc@numstr#2\relax
- \edef#2{\@@fc@numstr\@tenthstring{\@tmpstrctr}}%
+ \eappto#2{\@tenthstring{\@tmpstrctr}}%
\fi
\fi
}
@@ -4080,25 +6480,28 @@ zehntes%
\def#2{}%
\@strctr=#1\relax \divide\@strctr by 1000\relax
\ifnum\@strctr>1\relax
-% #1 is >= 2000, \@strctr now contains the number of thousands
+% \end{macrocode}
+% \#1 is $\geq 2000$, \cs{@strctr} now contains the number of thousands
+% \begin{macrocode}
\@@numberunderhundredgerman{\@strctr}{#2}%
- \let\@@fc@numstr#2\relax
- % is that it, or is there more?
+% \end{macrocode}
+% is that it, or is there more?
+% \begin{macrocode}
\@tmpstrctr=#1\relax \@modulo{\@tmpstrctr}{1000}%
\ifnum\@tmpstrctr=0\relax
- \edef#2{\@@fc@numstr\@thousandth}%
+ \eappto#2{\@thousandth}%
\else
- \edef#2{\@@fc@numstr tausend}%
+ \appto#2{tausend}%
\fi
\else
-% #1 lies in range [1000,1999]
+% \end{macrocode}
+% \#1 lies in range [1000,1999]
+% \begin{macrocode}
\ifnum\@strctr=1\relax
\ifnum#1=1000\relax
- \let\@@fc@numstr#2\relax
- \edef#2{\@@fc@numstr\@thousandth}%
+ \eappto#2{\@thousandth}%
\else
- \let\@@fc@numstr#2\relax
- \edef#2{\@@fc@numstr\eintausend}%
+ \eappto#2{\eintausend}%
\fi
\fi
\fi
@@ -4106,34 +6509,34 @@ zehntes%
\@modulo{\@strctr}{1000}%
\divide\@strctr by 100\relax
\ifnum\@strctr>1\relax
+% \end{macrocode}
% now dealing with number in range [200,999]
- \let\@@fc@numstr#2\relax
- % is that it, or is there more?
+% is that it, or is there more?
+% \begin{macrocode}
\@tmpstrctr=#1\relax \@modulo{\@tmpstrctr}{100}%
\ifnum\@tmpstrctr=0\relax
\ifnum\@strctr=1\relax
- \edef#2{\@@fc@numstr\@hundredth}%
+ \eappto#2{\@hundredth}%
\else
- \edef#2{\@@fc@numstr\@unitstring{\@strctr}\@hundredth}%
+ \eappto#2{\@unitstring{\@strctr}\@hundredth}%
\fi
\else
- \edef#2{\@@fc@numstr\@unitstring{\@strctr}hundert}%
+ \eappto#2{\@unitstring{\@strctr}hundert}%
\fi
\else
\ifnum\@strctr=1\relax
+% \end{macrocode}
% dealing with number in range [100,199]
% is that it, or is there more?
+% \begin{macrocode}
\@tmpstrctr=#1\relax \@modulo{\@tmpstrctr}{100}%
\ifnum\@tmpstrctr=0\relax
- \let\@@fc@numstr#2\relax
- \edef#2{\@@fc@numstr\@hundredth}%
+ \eappto#2{\@hundredth}%
\else
\ifnum#1>1000\relax
- \let\@@fc@numstr#2\relax
- \edef#2{\@@fc@numstr einhundert}%
+ \appto#2{einhundert}%
\else
- \let\@@fc@numstr#2\relax
- \edef#2{\@@fc@numstr\einhundert}%
+ \eappto#2{\einhundert}%
\fi
\fi
\fi
@@ -4145,25 +6548,11 @@ zehntes%
}%
}
% \end{macrocode}
-% Set |ngerman| to be equivalent to |german|. Is it okay to do
-% this? (I don't know the difference between the two.)
+% Load fc-germanb.def if not already loaded
% \begin{macrocode}
-\let\@ordinalMngerman=\@ordinalMgerman
-\let\@ordinalFngerman=\@ordinalFgerman
-\let\@ordinalNngerman=\@ordinalNgerman
-\let\@numberstringMngerman=\@numberstringMgerman
-\let\@numberstringFngerman=\@numberstringFgerman
-\let\@numberstringNngerman=\@numberstringNgerman
-\let\@NumberstringMngerman=\@NumberstringMgerman
-\let\@NumberstringFngerman=\@NumberstringFgerman
-\let\@NumberstringNngerman=\@NumberstringNgerman
-\let\@ordinalstringMngerman=\@ordinalstringMgerman
-\let\@ordinalstringFngerman=\@ordinalstringFgerman
-\let\@ordinalstringNngerman=\@ordinalstringNgerman
-\let\@OrdinalstringMngerman=\@OrdinalstringMgerman
-\let\@OrdinalstringFngerman=\@OrdinalstringFgerman
-\let\@OrdinalstringNngerman=\@OrdinalstringNgerman
+\FCloadlang{germanb}
% \end{macrocode}
+
%\iffalse
% \begin{macrocode}
%</fc-german.def>
@@ -4171,746 +6560,163 @@ zehntes%
%\fi
%\iffalse
% \begin{macrocode}
+%<*fc-germanb.def>
+% \end{macrocode}
+%\fi
+% \subsubsection{fc-germanb.def}
+% \begin{macrocode}
+\ProvidesFCLanguage{germanb}[2012/06/18]
+% \end{macrocode}
+% Load fc-german.def if not already loaded
+% \begin{macrocode}
+\FCloadlang{german}
+% \end{macrocode}
+% Set |germanb| to be equivalent to |german|.
+% \begin{macrocode}
+\let\@ordinalMgermanb=\@ordinalMgerman
+\let\@ordinalFgermanb=\@ordinalFgerman
+\let\@ordinalNgermanb=\@ordinalNgerman
+\let\@numberstringMgermanb=\@numberstringMgerman
+\let\@numberstringFgermanb=\@numberstringFgerman
+\let\@numberstringNgermanb=\@numberstringNgerman
+\let\@NumberstringMgermanb=\@NumberstringMgerman
+\let\@NumberstringFgermanb=\@NumberstringFgerman
+\let\@NumberstringNgermanb=\@NumberstringNgerman
+\let\@ordinalstringMgermanb=\@ordinalstringMgerman
+\let\@ordinalstringFgermanb=\@ordinalstringFgerman
+\let\@ordinalstringNgermanb=\@ordinalstringNgerman
+\let\@OrdinalstringMgermanb=\@OrdinalstringMgerman
+\let\@OrdinalstringFgermanb=\@OrdinalstringFgerman
+\let\@OrdinalstringNgermanb=\@OrdinalstringNgerman
+% \end{macrocode}
+
+%\iffalse
+% \begin{macrocode}
+%</fc-germanb.def>
+% \end{macrocode}
+%\fi
+%\iffalse
+% \begin{macrocode}
%<*fc-italian.def>
% \end{macrocode}
%\fi
% \subsubsection{fc-italian}
-% Italian definitions provided by Edoardo Pasca (2008).
+% Italian support is now handled by interfacing to Enrico Gregorio's
+% itnumpar package.
% \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}
+\ProvidesFCLanguage{italian}[2012/06/18]
+\RequirePackage{itnumpar}
\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}}
+ \edef#2{\noexpand\printnumeroinparole{#1}}%
+}
\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}}
+ \edef#2{\noexpand\printnumeroinparole{#1}}}
\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}}
+ \edef#2{\noexpand\printNumeroinparole{#1}}}
\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}}
+ \edef#2{\noexpand\printNumeroinparole{#1}}}
\newcommand{\@ordinalstringMitalian}[2]{%
-\let\@unitthstring=\@@unitthstringitalian
-\let\@unitstring=\@@unitstringitalian
-\let\@teenthstring=\@@teenthstringitalian
-\let\@tenthstring=\@@tenthstringitalian
-\let\@hundredthstring=\@@hundredthstringitalian
-\def\@thousandth{millesimo}%
-\@@ordinalstringitalian{#1}{#2}}
+ \edef#2{\noexpand\printordinalem{#1}}}
\newcommand{\@ordinalstringFitalian}[2]{%
-\let\@unitthstring=\@@unitthstringFitalian
-\let\@unitstring=\@@unitstringFitalian
-\let\@teenthstring=\@@teenthstringFitalian
-\let\@tenthstring=\@@tenthstringFitalian
-\let\@hundredthstring=\@@hundredthstringFitalian
-\def\@thousandth{millesima}%
-\@@ordinalstringitalian{#1}{#2}}
+ \edef#2{\noexpand\printordinalef{#1}}}
\newcommand{\@OrdinalstringMitalian}[2]{%
-\let\@unitthstring=\@@Unitthstringitalian
-\let\@unitstring=\@@Unitstringitalian
-\let\@teenthstring=\@@Teenthstringitalian
-\let\@tenthstring=\@@Tenthstringitalian
-\let\@hundredthstring=\@@Hundredthstringitalian
-\def\@thousandth{Millesimo}%
-\@@ordinalstringitalian{#1}{#2}}
+ \edef#2{\noexpand\printOrdinalem{#1}}}
\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}
+ \edef#2{\noexpand\printOrdinalef{#1}}}
+\newcommand{\@ordinalMitalian}[2]{%
+ \edef#2{#1\relax\noexpand\fmtord{o}}}
+\newcommand{\@ordinalFitalian}[2]{%
+ \edef#2{#1\relax\noexpand\fmtord{a}}}
+% \end{macrocode}
-\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
-}
+%\iffalse
+% \begin{macrocode}
+%</fc-italian.def>
+% \end{macrocode}
+%\fi
+%\iffalse
+% \begin{macrocode}
+%<*fc-ngerman.def>
+% \end{macrocode}
+%\fi
+% \subsubsection{fc-ngerman.def}
+% \begin{macrocode}
+\ProvidesFCLanguage{ngerman}[2012/06/18]
+\FCloadlang{german}
+\FCloadlang{ngermanb}
+% \end{macrocode}
+% Set |ngerman| to be equivalent to |german|. Is it okay to do
+% this? (I don't know the difference between the two.)
+% \begin{macrocode}
+\let\@ordinalMngerman=\@ordinalMgerman
+\let\@ordinalFngerman=\@ordinalFgerman
+\let\@ordinalNngerman=\@ordinalNgerman
+\let\@numberstringMngerman=\@numberstringMgerman
+\let\@numberstringFngerman=\@numberstringFgerman
+\let\@numberstringNngerman=\@numberstringNgerman
+\let\@NumberstringMngerman=\@NumberstringMgerman
+\let\@NumberstringFngerman=\@NumberstringFgerman
+\let\@NumberstringNngerman=\@NumberstringNgerman
+\let\@ordinalstringMngerman=\@ordinalstringMgerman
+\let\@ordinalstringFngerman=\@ordinalstringFgerman
+\let\@ordinalstringNngerman=\@ordinalstringNgerman
+\let\@OrdinalstringMngerman=\@OrdinalstringMgerman
+\let\@OrdinalstringFngerman=\@OrdinalstringFgerman
+\let\@OrdinalstringNngerman=\@OrdinalstringNgerman
+% \end{macrocode}
-\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
-}
+%\iffalse
+% \begin{macrocode}
+%</fc-ngerman.def>
+% \end{macrocode}
+%\fi
+%\iffalse
+% \begin{macrocode}
+%<*fc-ngermanb.def>
+% \end{macrocode}
+%\fi
+% \subsubsection{fc-ngermanb.def}
+% \begin{macrocode}
+\ProvidesFCLanguage{ngermanb}[2012/06/18]
+\FCloadlang{german}
+% \end{macrocode}
+% Set |ngermanb| to be equivalent to |german|. Is it okay to do
+% this? (I don't know the difference between the two.)
+% \begin{macrocode}
+\let\@ordinalMngermanb=\@ordinalMgerman
+\let\@ordinalFngermanb=\@ordinalFgerman
+\let\@ordinalNngermanb=\@ordinalNgerman
+\let\@numberstringMngermanb=\@numberstringMgerman
+\let\@numberstringFngermanb=\@numberstringFgerman
+\let\@numberstringNngermanb=\@numberstringNgerman
+\let\@NumberstringMngermanb=\@NumberstringMgerman
+\let\@NumberstringFngermanb=\@NumberstringFgerman
+\let\@NumberstringNngermanb=\@NumberstringNgerman
+\let\@ordinalstringMngermanb=\@ordinalstringMgerman
+\let\@ordinalstringFngermanb=\@ordinalstringFgerman
+\let\@ordinalstringNngermanb=\@ordinalstringNgerman
+\let\@OrdinalstringMngermanb=\@OrdinalstringMgerman
+\let\@OrdinalstringFngermanb=\@OrdinalstringFgerman
+\let\@OrdinalstringNngermanb=\@OrdinalstringNgerman
+% \end{macrocode}
+% Load fc-ngerman.def if not already loaded
+% \begin{macrocode}
+\FCloadlang{ngerman}
% \end{macrocode}
%\iffalse
% \begin{macrocode}
-%</fc-italian.def>
+%</fc-ngermanb.def>
% \end{macrocode}
%\fi
%\iffalse
@@ -4921,7 +6727,7 @@ Decima%
% \subsubsection{fc-portuges.def}
% Portuguse definitions
% \begin{macrocode}
-\ProvidesFile{fc-portuges.def}[2007/05/26]
+\ProvidesFCLanguage{portuges}[2012/06/18]
% \end{macrocode}
% Define macro that converts a number or count register (first
% argument) to an ordinal, and stores the result in the second
@@ -4948,7 +6754,8 @@ Decima%
\let\@ordinalNportuges\@ordinalMportuges
% \end{macrocode}
% Convert a number to a textual representation. To make it easier,
-% split it up into units, tens, teens and hundreds. Units (argument must
+% split it up into units, tens, teens and hundreds. Units (argument
+% must
% be a number from 0 to 9):
% \begin{macrocode}
\newcommand*{\@@unitstringportuges}[1]{%
@@ -5475,7 +7282,9 @@ this number}%
\def#2{}%
\@strctr=#1\relax \divide\@strctr by 1000\relax
\ifnum\@strctr>9
-% #1 is greater or equal to 10000
+% \end{macrocode}
+% \#1 is greater or equal to 10000
+% \begin{macrocode}
\divide\@strctr by 10
\ifnum\@strctr>1\relax
\let\@@fc@numstr#2\relax
@@ -5500,7 +7309,7 @@ this number}%
\let\@@fc@numstr#2\relax
\edef#2{\@@fc@numstr\ \@thousand}%
\else
- \ifnum\@strctr>0\relax
+ \ifnum\@strctr>0\relax
\ifnum\@strctr>1\relax
\let\@@fc@numstr#2\relax
\edef#2{\@@fc@numstr\@unitstring{\@strctr}\ }%
@@ -5546,7 +7355,7 @@ this number}%
\let\@@fc@numstr#2\relax
\edef#2{\@@fc@numstr\ \@andname}%
\fi
- \fi
+ \fi
\let\@@fc@numstr#2\relax
\edef#2{\@@fc@numstr\ \@unitstring{\@strctr}}%
\fi
@@ -5670,7 +7479,7 @@ this number}%
% \subsubsection{fc-spanish.def}
% Spanish definitions
% \begin{macrocode}
-\ProvidesFile{fc-spanish.def}[2007/05/26]
+\ProvidesFCLanguage{spanish}[2012/06/18]
% \end{macrocode}
% Define macro that converts a number or count register (first
% argument) to an ordinal, and stores the result in the
@@ -5726,11 +7535,13 @@ cera%
}
% \end{macrocode}
% Tens (argument must go from 1 to 10):
+%\changes{2.0}{2012-06-18}{fixed spelling mistake (correction
+%provided by Fernando Maldonado)}
% \begin{macrocode}
\newcommand{\@@tenstringspanish}[1]{%
\ifcase#1\relax
\or diez%
-\or viente%
+\or veinte%
\or treinta%
\or cuarenta%
\or cincuenta%
@@ -5857,10 +7668,12 @@ Cera%
% \end{macrocode}
% Tens:
% \begin{macrocode}
+%\changes{2.0}{2012-06-18}{fixed spelling mistake (correction
+%provided by Fernando Maldonado)}
\newcommand{\@@Tenstringspanish}[1]{%
\ifcase#1\relax
\or Diez%
-\or Viente%
+\or Veinte%
\or Treinta%
\or Cuarenta%
\or Cincuenta%
@@ -5968,6 +7781,8 @@ Veinte%
\@@numberstringspanish{#1}{#2}}
% \end{macrocode}
% Feminine form:
+%\changes{2.0}{2012-06-18}{changed andname to `b' (correction
+%provided by Fernando Maldonado)}
% \begin{macrocode}
\DeclareRobustCommand{\@numberstringFspanish}[2]{%
\let\@unitstring=\@@unitstringFspanish
@@ -5976,7 +7791,7 @@ Veinte%
\let\@twentystring=\@@twentystringFspanish
\let\@hundredstring=\@@hundredstringFspanish
\def\@hundred{cien}\def\@thousand{mil}%
-\def\@andname{y}%
+\def\@andname{b}%
\@@numberstringspanish{#1}{#2}}
% \end{macrocode}
% Make neuter same as masculine:
@@ -5996,6 +7811,8 @@ Veinte%
\@@numberstringspanish{#1}{#2}}
% \end{macrocode}
% Feminine form:
+%\changes{2.0}{2012-06-18}{changed andname to `b' (correction
+%provided by Fernando Maldonado)}
% \begin{macrocode}
\DeclareRobustCommand{\@NumberstringFspanish}[2]{%
\let\@unitstring=\@@UnitstringFspanish
@@ -6003,7 +7820,7 @@ Veinte%
\let\@tenstring=\@@Tenstringspanish
\let\@twentystring=\@@TwentystringFspanish
\let\@hundredstring=\@@HundredstringFspanish
-\def\@andname{y}%
+\def\@andname{b}%
\def\@hundred{Cien}\def\@thousand{Mil}%
\@@numberstringspanish{#1}{#2}}
% \end{macrocode}
@@ -6324,7 +8141,6 @@ D\'ecima%
\or Octingent\'esima%
\or Noningent\'esima%
\fi}
-
% \end{macrocode}
% This has changed in version 1.09, so that it now stores the
% results in the second argument (which must be a control
@@ -6348,7 +8164,9 @@ this number}%
\def#2{}%
\@strctr=#1\relax \divide\@strctr by 1000\relax
\ifnum\@strctr>9
-% #1 is greater or equal to 10000
+% \end{macrocode}
+% \#1 is greater or equal to 10000
+% \begin{macrocode}
\divide\@strctr by 10
\ifnum\@strctr>1
\let\@@fc@numstr#2\relax
@@ -6369,7 +8187,7 @@ this number}%
\let\@@fc@numstr#2\relax
\edef#2{\@@fc@numstr\ \@thousand}%
\else
- \ifnum\@strctr>0\relax
+ \ifnum\@strctr>0\relax
\ifnum\@strctr>1\relax
\let\@@fc@numstr#2\relax
\edef#2{\@@fc@numstr\@unitstring{\@strctr}\ }%
@@ -6399,7 +8217,11 @@ this number}%
\ifnum#1>100\relax
\ifnum\@strctr>0\relax
\let\@@fc@numstr#2\relax
- \edef#2{\@@fc@numstr\ \@andname\ }%
+% \end{macrocode}
+%\changes{2.0}{2012-06-18}{removed andname (correction
+%provided by Fernando Maldonado)}
+% \begin{macrocode}
+ \edef#2{\@@fc@numstr\ }%
\fi
\fi
\ifnum\@strctr>29\relax
@@ -6530,6 +8352,7 @@ this number}%
\fi
}
% \end{macrocode}
+
%\iffalse
% \begin{macrocode}
%</fc-spanish.def>
@@ -6541,13 +8364,13 @@ this number}%
% \end{macrocode}
%\fi
% \subsubsection{fc-UKenglish.def}
-% UK English definitions
+% English definitions
% \begin{macrocode}
-\ProvidesFile{fc-UKenglish}[2007/06/14]
+\ProvidesFCLanguage{UKenglish}[2012/06/18]
% \end{macrocode}
-% Check that fc-english.def has been loaded
+% Loaded fc-english.def if not already loaded
% \begin{macrocode}
-\@ifundefined{@ordinalMenglish}{\input{fc-english.def}}{}
+\FCloadlang{english}
% \end{macrocode}
% These are all just synonyms for the commands provided by
% fc-english.def.
@@ -6567,7 +8390,7 @@ this number}%
\let\@OrdinalstringMUKenglish\@OrdinalstringMenglish
\let\@OrdinalstringFUKenglish\@OrdinalstringMenglish
\let\@OrdinalstringNUKenglish\@OrdinalstringMenglish
-% \end{macrocode}
+% \end{macrocode}
%\iffalse
% \begin{macrocode}
%</fc-UKenglish.def>
@@ -6581,14 +8404,15 @@ this number}%
% \subsubsection{fc-USenglish.def}
% US English definitions
% \begin{macrocode}
-\ProvidesFile{fc-USenglish}[2007/06/14]
+\ProvidesFCLanguage{USenglish}[2012/06/18]
% \end{macrocode}
-% Check that fc-english.def has been loaded
+% Loaded fc-english.def if not already loaded
% \begin{macrocode}
-\@ifundefined{@ordinalMenglish}{\input{fc-english.def}}{}
+\FCloadlang{english}
% \end{macrocode}
% These are all just synonyms for the commands provided by
-% fc-english.def.
+% fc-english.def. (This needs fixing as there are some differences
+% between UK and US number strings.)
% \begin{macrocode}
\let\@ordinalMUSenglish\@ordinalMenglish
\let\@ordinalFUSenglish\@ordinalMenglish
@@ -6611,3090 +8435,5 @@ this number}%
%</fc-USenglish.def>
% \end{macrocode}
%\fi
-%\iffalse
-% \begin{macrocode}
-%<*fmtcount.perl>
-% \end{macrocode}
-%\fi
-%\iffalse
-% \begin{macrocode}
-# File : fmtcount.perl
-# Author : Nicola Talbot
-# Date : 26 May 2007
-# Version : 1.05
-# Description : LaTeX2HTML implementation of fmtcount package
-
-package main;
-
-sub do_fmtcount_raise{
- local($tmp)="";
-
- $tmp .= 'sub do_cmd_fmtord{';
- $tmp .= 'local($_) = @_;';
- $tmp .= 'local($suffix) = &missing_braces unless (s/$next_pair_pr_rx/$suffix=$2;\'\'/eo);';
- $tmp .= 'join("", "<SUP>",$suffix,"</SUP>",$_);';
- $tmp .='}';
-
- eval($tmp);
-}
-
-sub do_fmtcount_level{
- local($tmp)="";
-
- $tmp .= 'sub do_cmd_fmtord{';
- $tmp .= 'local($_) = @_;';
- $tmp .= 'local($suffix) = &missing_braces unless (s/$next_pair_pr_rx/$suffix=$2;\'\'/eo);';
- $tmp .= 'join("", $suffix,$_);';
- $tmp .='}';
-
- eval($tmp);
-}
-
-if (not defined &do_cmd_fmtord)
-{
- &do_fmtcount_raise(@_);
-}
-
-$frenchdialect = 'france';
-$ordinalabbrv = 0;
-
-sub get_ordinal_suffix_english{
- local($num,$gender) = @_;
- local($suffix);
-
- if ((($num % 10) == 1) && ($num%100 != 11))
- {
- $suffix = 'st';
- }
- elsif ((($num % 10) == 2) && ($num%100 != 12))
- {
- $suffix = 'nd';
- }
- elsif ((($num % 10) == 3) && ($num%100 != 13))
- {
- $suffix = 'rd';
- }
- else
- {
- $suffix = 'th';
- }
-
- $suffix;
-}
-
-sub get_ordinal_suffix_french{
- local($num,$gender) = @_;
- local($_);
-
- if ($ordinalabbrv > 0)
- {
- $_ = 'e';
- }
- else
- {
- if ($num == 1)
- {
- $_ = ($gender eq 'f' ? 'ere' : 'er');
- }
- else
- {
- $_ = 'eme';
- }
- }
-}
-
-sub get_ordinal_suffix_spanish{
- local($num,$gender) = @_;
-
- ($gender eq 'f' ? 'a' : 'o');
-}
-
-sub get_ordinal_suffix_portuges{
- local($num,$gender) = @_;
-
- ($gender eq 'f' ? 'a' : 'o');
-}
-
-sub get_ordinal_suffix_german{
- local($num,$gender) = @_;
-
- '';
-}
-
-sub get_ordinal_suffix_ngerman{
- local($num,$gender) = @_;
-
- '';
-}
-
-sub get_ordinal_suffix{
- local($num,$gender) = @_;
- local($suffix,$suffixsub);
-
- $suffixsub = "get_ordinal_suffix_$default_language";
-
- if (defined ($suffixsub))
- {
- $suffix = &$suffixsub($num,$gender);
- }
- else
- {
- $suffix = &get_ordinal_suffix_english($num,$gender);
- }
-
- $suffix;
-}
-
-sub getordinal{
- local($num,$gender) = @_;
- local($suffix) = &get_ordinal_suffix($num,$gender);
- local($text)='';
-
- if ($suffix eq '')
- {
- $text = $num;
- }
- else
- {
- local($br_id) = ++$global{'max_id'};
- $text = $num . "\\fmtord${OP}$br_id${CP}$suffix${OP}$br_id${CP}";
- }
-
- $text;
-}
-
-sub do_cmd_ordinalnum{
- local($_) = @_;
- local($num) = &missing_braces
- unless (s/$next_pair_pr_rx/$num=$2;''/eo);
- my($gender)='m';
- local($suffix)='';
-
- if (s/\[([mfn])\]//)
- {
- $gender = $1;
- }
-
- $suffix = &get_ordinal_suffix($num,$gender);
-
- local($br_id) = ++$global{'max_id'};
- join('', $num, "\\fmtord${OP}$br_id${CP}$suffix${OP}$br_id${CP}", $_);
-}
-
-sub do_cmd_FCordinal{
- &do_cmd_ordinal;
-}
-
-sub do_cmd_ordinal{
- local($ctr, $val, $id, $_) = &read_counter_value($_[0]);
- my($gender)='m';
-
- $_[0] =~ s/${OP}$id${CP}$ctr${OP}$id${CP}//;
-
- if ($_[0]=~s/\[(.)\]//)
- {
- $gender = $1;
- }
-
- if ($ctr eq 'DAY' or $ctr eq 'MONTH' or $str eq 'YEAR')
- {
- # this is a cludge to make it work with newdateformat
- join('', '{ORDINAL{', $ctr, '}}', $_[0]);
- }
- else
- {
- join('', &getordinal($val, $gender), $_[0]);
- }
-}
-
-sub do_cmd_storeordinal{
- local($_) = @_;
- local($key);
-
- $key = &missing_braces
- unless ((s/$next_pair_pr_rx//o)&&($key=$2));
-
- local($ctr, $val, $id, $_) = &read_counter_value($_);
- my($gender)='m';
-
- $_ =~ s/${OP}$id${CP}$ctr${OP}$id${CP}//;
-
- if ($_ =~s/\s*\[(.)\]//)
- {
- $gender = $1;
- }
-
- if ($ctr eq 'DAY' or $ctr eq 'MONTH' or $ctr eq 'YEAR')
- {
- # this is a cludge to make it work with newdateformat
- $fmtcntvar{$key} = join('', '{ORDINAL{', $ctr, '}}');
- }
- else
- {
- $fmtcntvar{$key} = &getordinal($val, $gender);
- }
-
- $_;
-}
-
-sub do_cmd_storeordinalnum{
- local($_) = @_;
- local($key, $val);
-
- $key = &missing_braces
- unless ((s/$next_pair_pr_rx//o)&&($key=$2));
-
- $val = &missing_braces
- unless (s/$next_pair_pr_rx/$val=$2;''/eo);
-
- my($gender)='m';
-
- if ($_ =~s/\s*\[([mfn])\]//)
- {
- $gender = $1;
- }
-
- $fmtcntvar{$key} = &getordinal($val, $gender);
-
- $_;
-}
-
-@unitthstring = ('zeroth',
- 'first',
- 'second',
- 'third',
- 'fourth',
- 'fifth',
- 'sixth',
- 'seventh',
- 'eighth',
- 'ninth');
-
-@tenthstring = ('',
- 'tenth',
- 'twentieth',
- 'thirtieth',
- 'fortieth',
- 'fiftieth',
- 'sixtieth',
- 'seventieth',
- 'eightieth',
- 'ninetieth');
-
-@teenthstring = ('tenth',
- 'eleventh',
- 'twelfth',
- 'thirteenth',
- 'fourteenth',
- 'fifteenth',
- 'sixteenth',
- 'seventeenth',
- 'eighteenth',
- 'nineteenth');
-
-@unitstring = ('zero',
- 'one',
- 'two',
- 'three',
- 'four',
- 'five',
- 'six',
- 'seven',
- 'eight',
- 'nine');
-
-@teenstring = ('ten',
- 'eleven',
- 'twelve',
- 'thirteen',
- 'fourteen',
- 'fifteen',
- 'sixteen',
- 'seventeen',
- 'eighteen',
- 'nineteen');
-@tenstring = ('',
- 'ten',
- 'twenty',
- 'thirty',
- 'forty',
- 'fifty',
- 'sixty',
- 'seventy',
- 'eighty',
- 'ninety');
-
-$hundredname = "hundred";
-$hundredthname = "hundredth";
-$thousandname = "thousand";
-$thousandthname = "thousandth";
-
-sub get_numberstringenglish{
- local($num) = @_;
- local($name)="";
-
- unless (($num >= 1000000) || ($num < 0))
- {
- if ($num >= 1000)
- {
- local($thousands) = &get_numberstringenglish($num/1000);
- $name .= $thousands . " $thousandname";
- $num = $num%1000;
- }
-
- if ($num >= 100)
- {
- if ($_[0] >= 1000) { $name .= " "; }
-
- local($hundreds) = &get_numberstringenglish($num/100);
- $name .= $hundreds . " $hundredname";
- $num = $num%100;
- }
-
- if (($_[0] > 100) && ($_[0]%100 > 0)) { $name .= " and "; }
-
- if ($num >= 20)
- {
- $name .= $tenstring[$num/10];
-
- if ($num%10 > 0) { $name .= '-'; }
- }
-
- if (($num >= 10) && ($num < 20))
- {
- $name .= $teenstring[$num%10];
- }
- elsif (($num%10 > 0) || ($_[0] == 0))
- {
- $name .= $unitstring[$num%10];
- }
- }
-
- $name;
-}
-
-@unitthstringfrench = ('zeroi\`eme',
- 'uni\`eme',
- 'deuxi\`eme',
- 'troisi\`eme',
- 'quatri\`eme',
- 'cinqui\`eme',
- 'sixi\`eme',
- 'septi\`eme',
- 'huiti\`eme',
- 'neuvi\`eme');
-
-@tenthstringfrench = ('',
- 'dixi\`eme',
- 'vingti\`eme',
- 'trentri\`eme',
- 'quaranti\`eme',
- 'cinquanti\`eme',
- 'soixanti\`eme',
- 'septenti\`eme',
- 'huitanti\`eme',
- 'nonenti\`eme');
-
-@teenthstringfrench = ('dixi\`eme',
- 'onzi\`eme',
- 'douzi\`eme',
- 'treizi\`eme',
- 'quatorzi\`eme',
- 'quinzi\`eme',
- 'seizi\`eme',
- 'dix-septi\`eme',
- 'dix-huiti\`eme',
- 'dix-neuvi\`eme');
-
-@unitstringfrench = ('zero',
- 'un',
- 'deux',
- 'trois',
- 'quatre',
- 'cinq',
- 'six',
- 'sept',
- 'huit',
- 'neuf');
-
-@teenstringfrench = ('dix',
- 'onze',
- 'douze',
- 'treize',
- 'quatorze',
- 'quinze',
- 'seize',
- 'dix-sept',
- 'dix-huit',
- 'dix-neuf');
-
-@tenstringfrench = ('',
- 'dix',
- 'vingt',
- 'trente',
- 'quarante',
- 'cinquante',
- 'soixante',
- 'septente',
- 'huitante',
- 'nonente');
-
-$hundrednamefrench = "cent";
-$hundredthnamefrench = "centi\\`eme";
-$thousandnamefrench = "mille";
-$thousandthnamefrench = "mili\\`eme";
-
-@unitthstringspanish = ('cero',
- 'primero',
- 'segundo',
- 'tercero',
- 'cuarto',
- 'quinto',
- 'sexto',
- 's\\\'eptimo',
- 'octavo',
- 'noveno');
-
-@tenthstringspanish = ('',
- 'd\\\'ecimo',
- 'vig\\\'esimo',
- 'trig\\\'esimo',
- 'cuadrag\\\'esimo',
- 'quincuag\\\'esimo',
- 'sexag\\\'esimo',
- 'septuag\\\'esimo',
- 'octog\\\'esimo',
- 'nonag\\\'esimo');
-
-@teenthstringspanish = ('d\\\'ecimo',
- 'und\\\'ecimo',
- 'duod\\\'ecimo',
- 'decimotercero',
- 'decimocuarto',
- 'decimoquinto',
- 'decimosexto',
- 'decimos\\\'eptimo',
- 'decimoctavo',
- 'decimonoveno');
-
-@hundredthstringspanish = ('',
- 'cent\\\'esimo',
- 'ducent\\\'esimo',
- 'tricent\\\'esimo',
- 'cuadringent\\\'esimo',
- 'quingent\\\'esimo',
- 'sexcent\\\'esimo',
- 'septing\\\'esimo',
- 'octingent\\\'esimo',
- 'noningent\\\'esimo');
-
-@unitstringspanish = ('cero',
- 'uno',
- 'dos',
- 'tres',
- 'cuatro',
- 'cinco',
- 'seis',
- 'siete',
- 'ocho',
- 'nueve');
-
-@teenstringspanish = ('diez',
- 'once',
- 'doce',
- 'trece',
- 'catorce',
- 'quince',
- 'diecis\\\'eis',
- 'diecisiete',
- 'dieciocho',
- 'diecinueve');
-
-@twentystringspanish = ('viente',
- 'vientiuno',
- 'vientid\\\'os',
- 'vientitr\\\'es',
- 'vienticuatro',
- 'vienticinco',
- 'vientis\\\'eis',
- 'vientisiete',
- 'vientiocho',
- 'vientinueve');
-
-@tenstringspanish = ('',
- 'diez',
- 'viente',
- 'treinta',
- 'cuarenta',
- 'cincuenta',
- 'sesenta',
- 'setenta',
- 'ochenta',
- 'noventa');
-
-@hundredstringspanish = ('',
- 'ciento',
- 'doscientos',
- 'trescientos',
- 'cuatrocientos',
- 'quinientos',
- 'seiscientos',
- 'setecientos',
- 'ochocientos',
- 'novecientos');
-
-$hundrednamespanish = "cien";
-$hundredthnamespanish = "centi\\`eme";
-$thousandnamespanish = "mil";
-$thousandthnamespanish = "mil\\'esimo";
-
-@unitthstringportuges = ('zero',
- 'primeiro',
- 'segundo',
- 'terceiro',
- 'quatro',
- 'quinto',
- 'sexto',
- 's\\\'etimo',
- 'oitavo',
- 'nono');
-
-@tenthstringportuges = ('',
- 'd\\\'ecimo',
- 'vig\\\'esimo',
- 'trig\\\'esimo',
- 'quadrag\\\'esimo',
- 'q\"uinquag\\\'esimo',
- 'sexag\\\'esimo',
- 'setuag\\\'esimo',
- 'octog\\\'esimo',
- 'nonag\\\'esimo');
-
-@hundredthstringportuges = ('',
- 'cent\\\'esimo',
- 'ducent\\\'esimo',
- 'trecent\\\'esimo',
- 'quadringent\\\'esimo',
- 'q\"uingent\\\'esimo',
- 'seiscent\\\'esimo',
- 'setingent\\\'esimo',
- 'octingent\\\'esimo',
- 'nongent\\\'esimo');
-
-@unitstringportuges = ('zero',
- 'um',
- 'dois',
- 'tr\^es',
- 'quatro',
- 'cinco',
- 'seis',
- 'sete',
- 'oito',
- 'nove');
-
-@teenstringportuges = ('dez',
- 'onze',
- 'doze',
- 'treze',
- 'quatorze',
- 'quinze',
- 'dezesseis',
- 'dezessete',
- 'dezoito',
- 'dezenove');
-
-@tenstringportuges = ('',
- 'dez',
- 'vinte',
- 'trinta',
- 'quaranta',
- 'cinq\"uenta',
- 'sessenta',
- 'setenta',
- 'oitenta',
- 'noventa');
-
-@hundredstringportuges = ('',
- 'cento',
- 'duzentos',
- 'trezentos',
- 'quatrocentos',
- 'quinhentos',
- 'seiscentos',
- 'setecentos',
- 'oitocentos',
- 'novecentos');
-
-$hundrednameportuges = "cem";
-$thousandnameportuges = "mil";
-$thousandthnameportuges = "mil\\'esimo";
-
-sub get_numberstringfrench{
- local($num,$gender) = @_;
- local($name)="";
-
- if ($gender eq 'f')
- {
- $unitstringfrench[1] = 'une';
- }
- else
- {
- $unitstringfrench[1] = 'un';
- }
-
- unless (($num >= 1000000) || ($num < 0))
- {
- if ($num >= 1000)
- {
- local($thousands) = '';
-
- if ($num >= 2000)
- {
- $thousands = &get_numberstringfrench($num/1000,$gender).' ';
- }
-
- $name .= $thousands . $thousandnamefrench;
- $num = $num%1000;
- }
-
- if ($num >= 100)
- {
- if ($_[0] >= 1000) { $name .= " "; }
-
- local($hundreds) = '';
-
- if ($num >= 200)
- {
- $hundreds = &get_numberstringfrench($num/100,$gender).' ';
- }
-
- $name .= $hundreds . $hundrednamefrench;
- $num = $num%100;
-
- if (($_[0]%100 == 0) && ($_[0]/100 > 1))
- {
- $name .= 's';
- }
- }
-
- if (($_[0] > 100) && ($_[0]%100 > 0)) { $name .= " "; }
-
- if ($num >= 20)
- {
- if ($frenchdialect eq 'france' and $num >= 70)
- {
- if ($num < 80)
- {
- $name .= $tenstringfrench[6];
-
- if ($num%10 == 1)
- {
- $name .= ' et ';
- }
- else
- {
- $name .= '-';
- }
-
- $num = 10+($num%10);
- }
- else
- {
- $name .= 'quatre-vingt' . ($num==80?'s':'-');
-
- if ($num >= 90)
- {
- $num = 10+($num%10);
- }
- }
- }
- elsif ($frenchdialect eq 'belgian'
- && ($num >= 80) && ($num < 90))
- {
- $name .= 'quatre-vingt' . ($num==80?'s':'-');
- }
- else
- {
- $name .= $tenstringfrench[$num/10];
-
- if ($num%10 == 1) { $name .= ' et ';}
- elsif ($num%10 > 0) { $name .= '-'; }
- }
- }
-
- if (($num >= 10) && ($num < 20))
- {
- $name .= $teenstringfrench[$num%10];
- }
- elsif (($num%10 > 0) || ($_[0] == 0))
- {
- $name .= $unitstringfrench[$num%10];
- }
- }
-
- $name;
-}
-
-sub get_numberstringspanish{
- local($num,$gender) = @_;
- local($name)="";
-
- if ($gender eq 'f')
- {
- $unitstringspanish[1] = 'una';
- }
- else
- {
- $unitstringspanish[1] = 'uno';
- }
-
- unless (($num >= 1000000) || ($num < 0))
- {
- if ($num >= 1000)
- {
- local($thousands) = '';
-
- if ($num >= 2000)
- {
- $thousands = &get_numberstringspanish($num/1000,$gender).' ';
- }
-
- $name .= $thousands . $thousandnamespanish;
- $num = $num%1000;
- }
-
- if ($num >= 100)
- {
- if ($_[0] >= 1000) { $name .= " "; }
-
- local($hundreds) = '';
-
- if ($num > 100)
- {
- $hundreds = $hundredstringspanish[$num/100];
- }
- else
- {
- $hundreds = 'cien';
- }
-
- $name .= $hundreds;
- $num = $num%100;
- }
-
- if (($_[0] > 100) && ($_[0]%100 > 0)) { $name .= " y "; }
-
-
- if ($num >= 30)
- {
- $name .= $tenstringspanish[$num/10];
-
- if ($num%10 > 0) { $name .= ' y '; }
- }
-
- if (($num >=20) && ($num < 30))
- {
- $name .= $twentystringspanish[$num%10];
- }
- elsif (($num >= 10) && ($num < 20))
- {
- $name .= $teenstringspanish[$num%10];
- }
- elsif (($num%10 > 0) || ($_[0] == 0))
- {
- $name .= $unitstringspanish[$num%10];
- }
- }
-
- $name;
-}
-
-sub get_numberstringportuges{
- local($num,$gender) = @_;
- local($name)="";
-
- if ($gender eq 'f')
- {
- $unitstringportuges[0] = 'zera';
- $unitstringportuges[1] = 'uma';
- $unitstringportuges[2] = 'duas';
- }
- else
- {
- $unitstringportuges[0] = 'zero';
- $unitstringportuges[1] = 'um';
- $unitstringportuges[2] = 'dois';
- }
-
- unless (($num >= 1000000) || ($num < 0))
- {
- if ($num >= 1000)
- {
- local($thousands) = '';
-
- if ($num >= 2000)
- {
- $thousands = &get_numberstringportuges($num/1000,$gender).' ';
- }
-
- $name .= $thousands . $thousandnameportuges;
- $num = $num%1000;
- }
-
- if ($num >= 100)
- {
- if ($_[0] >= 1000) { $name .= " "; }
-
- local($hundreds) = '';
-
- if ($num > 100)
- {
- $hundreds = $hundredstringportuges[$num/100];
-
- if ($gender eq 'f' and $num >= 200)
- {
- $hundreds =~s/o(s?)$/a\1/;
- }
- }
- else
- {
- $hundreds = $hundrednameportuges;
- }
-
- $name .= $hundreds;
- $num = $num%100;
- }
-
- if (($_[0] > 100) && ($_[0]%100 > 0)) { $name .= " e "; }
-
- if ($num >= 20)
- {
- $name .= $tenstringportuges[$num/10];
-
- if ($num%10 == 1) { $name .= ' e ';}
- elsif ($num%10 > 0) { $name .= ' '; }
- }
-
- if (($num >= 10) && ($num < 20))
- {
- $name .= $teenstringportuges[$num%10];
- }
- elsif (($num%10 > 0) || ($_[0] == 0))
- {
- $name .= $unitstringportuges[$num%10];
- }
- }
-
- $name;
-}
-
-@unitthstringMgerman = ('nullter',
- 'erster',
- 'zweiter',
- 'dritter',
- 'vierter',
- 'f\\"unter',
- 'sechster',
- 'siebter',
- 'achter',
- 'neunter');
-
-@tenthstringMgerman = ('',
- 'zehnter',
- 'zwanzigster',
- 'drei\\ss igster',
- 'vierzigster',
- 'f\\"unfzigster',
- 'sechzigster',
- 'siebzigster',
- 'achtzigster',
- 'neunzigster');
-
-@teenthstringMgerman = ('zehnter',
- 'elfter',
- 'zw\\"olfter',
- 'dreizehnter',
- 'vierzehnter',
- 'f\\"unfzehnter',
- 'sechzehnter',
- 'siebzehnter',
- 'achtzehnter',
- 'neunzehnter');
-
-@unitthstringFgerman = ('nullte',
- 'erste',
- 'zweite',
- 'dritte',
- 'vierte',
- 'f\\"unfte',
- 'sechste',
- 'siebte',
- 'achte',
- 'neunte');
-
-@tenthstringFgerman = ('',
- 'zehnte',
- 'zwanzigste',
- 'drei\\ss igste',
- 'vierzigste',
- 'f\\"unfzigste',
- 'sechzigste',
- 'siebzigste',
- 'achtzigste',
- 'neunzigste');
-
-@teenthstringFgerman = ('zehnte',
- 'elfte',
- 'zw\\"olfte',
- 'dreizehnte',
- 'vierzehnte',
- 'f\\"unfzehnte',
- 'sechzehnte',
- 'siebzehnte',
- 'achtzehnte',
- 'neunzehnte');
-
-@unitthstringNgerman = ('nulltes',
- 'erstes',
- 'zweites',
- 'drittes',
- 'viertes',
- 'f\\"unte',
- 'sechstes',
- 'siebtes',
- 'achtes',
- 'neuntes');
-
-@tenthstringNgerman = ('',
- 'zehntes',
- 'zwanzigstes',
- 'drei\\ss igstes',
- 'vierzigstes',
- 'f\\"unfzigstes',
- 'sechzigstes',
- 'siebzigstes',
- 'achtzigstes',
- 'neunzigstes');
-
-@teenthstringNgerman = ('zehntes',
- 'elftes',
- 'zw\\"olftes',
- 'dreizehntes',
- 'vierzehntes',
- 'f\\"unfzehntes',
- 'sechzehntes',
- 'siebzehntes',
- 'achtzehntes',
- 'neunzehntes');
-
-@unitstringgerman = ('null',
- 'ein', # eins dealt with separately (this is for prefixes)
- 'zwei',
- 'drei',
- 'vier',
- 'f\\"unf',
- 'sechs',
- 'sieben',
- 'acht',
- 'neun');
-
-@teenstringgerman = ('zehn',
- 'elf',
- 'zw\\"olf',
- 'dreizehn',
- 'vierzehn',
- 'f\\"unfzehn',
- 'sechzehn',
- 'siebzehn',
- 'achtzehn',
- 'neunzehn');
-
-@tenstringgerman = ('',
- 'zehn',
- 'zwanzig',
- 'drei\\ss ig',
- 'vierzig',
- 'f\\"unfzig',
- 'sechzig',
- 'siebzig',
- 'achtzig',
- 'neunzig');
-
-sub do_cmd_einhundert{
- local($_) = @_;
-
- "einhundert$_";
-}
-
-sub do_cmd_eintausend{
- local($_) = @_;
-
- "eintausend$_";
-}
-
-sub get_numberunderhundredgerman{
- local($num)=@_;
- local($name)='';
-
- if ($num == 1)
- {
- $name = 'eins';
- }
- elsif ($num < 10)
- {
- $name = $unitstringgerman[$num];
- }
- elsif ($num%10 == 0)
- {
- $name = $tenstringgerman[$num/10];
- }
- else
- {
- $name = join('und', $unitstringgerman[$num%10],
- $tenstringgerman[$num/10]);
- }
-
- $name;
-}
-
-sub get_numberstringgerman{
- local($orgnum,$gender) = @_;
- local($name)="";
-
- local($num) = $orgnum;
-
- unless (($num >= 1000000) || ($num < 0))
- {
- if ($num >= 1000 and $num < 2000)
- {
- $name = &translate_commands("\\eintausend ");
- }
- elsif ($num >= 2000)
- {
- $name = &get_numberunderhundredgerman($num/1000)
- . "tausend";
- }
-
- $num = $orgnum%1000;
-
- if ($num >= 100 and $num < 200)
- {
- if ($orgnum > 1000)
- {
- $name .= "einhundert";
- }
- else
- {
- $name = &translate_commands("\\einhundert ");
- }
- }
- elsif ($num >= 200)
- {
- $name .= $unitstringgerman[$num/100]."hundert";
- }
-
- $num = $num%100;
-
- if ($orgnum == 0)
- {
- $name = 'null';
- }
- elsif ($num > 0)
- {
- $name .= &get_numberunderhundredgerman($num);
- }
- }
-
- $name;
-}
-
-sub get_numberstring{
- local($val,$gender) = @_;
-
- if ($default_language eq 'french')
- {
- &get_numberstringfrench($val,$gender);
- }
- elsif ($default_language eq 'spanish')
- {
- &get_numberstringspanish($val,$gender);
- }
- elsif ($default_language eq 'portuges')
- {
- &get_numberstringportuges($val,$gender);
- }
- elsif ($default_language eq 'german'
- or $default_language eq 'ngerman')
- {
- &get_numberstringgerman($val,$gender);
- }
- else
- {
- &get_numberstringenglish($val);
- }
-}
-
-sub do_cmd_numberstringnum{
- local($_) = @_;
- local($num,$gender);
- $num = &missing_braces unless
- s/$next_pair_pr_rx/$num=$2;''/eo;
-
- if (s/\[(m|f|n)\]//)
- {
- $gender = $1;
- }
- else
- {
- $gender = 'm';
- }
-
- join('', &get_numberstring($num,$gender), $_);
-}
-
-sub do_cmd_numberstring{
- local($ctr, $val, $id, $_) = &read_counter_value($_[0]);
- my($gender)='m';
-
- $_[0] =~ s/${OP}$id${CP}$ctr${OP}$id${CP}//;
-
- if ($_[0]=~s/\[(.)\]//)
- {
- $gender = $1;
- }
-
- if ($ctr eq 'DAY' or $ctr eq 'MONTH' or $ctr eq 'YEAR')
- {
- # this is a cludge to make it work with newdateformat
- join('', '{NUMBERSTRING{', $ctr, '}}', $_[0]);
- }
- else
- {
- join('', &get_numberstring($val, $gender), $_[0]);
- }
-}
-
-sub do_cmd_storenumberstring{
- local($_) = @_;
- local($key);
-
- $key = &missing_braces
- unless ((s/$next_pair_pr_rx//o)&&($key=$2));
-
- local($ctr, $val, $id, $_) = &read_counter_value($_);
- my($gender)='m';
-
- $_ =~ s/${OP}$id${CP}$ctr${OP}$id${CP}//;
-
- if ($_ =~s/\s*\[(.)\]//)
- {
- $gender = $1;
- }
-
- if ($ctr eq 'DAY' or $ctr eq 'MONTH' or $ctr eq 'YEAR')
- {
- # this is a cludge to make it work with newdateformat
- $fmtcntvar{$key} = join('', '{NUMBERSTRING{', $ctr, '}}');
- }
- else
- {
- $fmtcntvar{$key} = join('', &get_numberstring($val, $gender));
- }
-
- $_;
-}
-
-sub do_cmd_storenumberstringnum{
- local($_) = @_;
- local($key, $val);
-
- $key = &missing_braces
- unless ((s/$next_pair_pr_rx//o)&&($key=$2));
-
- $val = &missing_braces
- unless (s/$next_pair_pr_rx/$val=$2;''/eo);
-
- my($gender)='m';
-
- if ($_ =~s/\s*\[([mfn])\]//)
- {
- $gender = $1;
- }
-
- $fmtcntvar{$key} = join('', &get_numberstring($val, $gender));
-
- $_;
-}
-
-sub get_Numberstring{
- local($val,$gender) = @_;
- local($string) = &get_numberstring($val,$gender);
-
- if ($default_language=~m/german/)
- {
- $string =~ s/([a-z])([^\s\-]+)/\u\1\2/;
- }
- else
- {
- $string =~ s/([a-z])([^\s\-]+)/\u\1\2/g;
-
- if ($default_language eq 'french')
- {
- $string =~ s/ Et / et /g;
- }
- elsif ($default_language eq 'spanish')
- {
- $string =~ s/ Y / y /g;
- }
- elsif ($default_language eq 'portuges')
- {
- $string =~ s/ E / e /g;
- }
- else
- {
- $string =~ s/ And / and /g;
- }
- }
-
- $string;
-}
-
-sub do_cmd_Numberstringnum{
- local($_) = @_;
- local($num,$gender);
- $num = &missing_braces
- unless (s/$next_pair_pr_rx/$num=$2;''/eo);
-
- if (s/\[(m|f|n)\]//)
- {
- $gender = $1;
- }
- else
- {
- $gender = 'm';
- }
-
- join('', &get_Numberstring($num,$gender), $_);
-}
-
-sub do_cmd_Numberstring{
- local($ctr, $val, $id, $_) = &read_counter_value($_[0]);
- my($gender)='m';
-
- $_[0] =~ s/${OP}$id${CP}$ctr${OP}$id${CP}//;
-
- if ($_[0]=~s/\[(.)\]//)
- {
- $gender = $1;
- }
-
- if ($ctr eq 'DAY' or $ctr eq 'MONTH' or $ctr eq 'YEAR')
- {
- # this is a cludge to make it work with newdateformat
- join('', '{NNUMBERSTRING{', $ctr, '}}', $_[0]);
- }
- else
- {
- join('', &get_Numberstring($val, $gender), $_[0]);
- }
-}
-
-sub do_cmd_storeNumberstring{
- local($_) = @_;
- local($key);
-
- $key = &missing_braces
- unless ((s/$next_pair_pr_rx//o)&&($key=$2));
-
- local($ctr, $val, $id, $_) = &read_counter_value($_);
- my($gender)='m';
-
- $_ =~ s/${OP}$id${CP}$ctr${OP}$id${CP}//;
-
- if ($_ =~s/\s*\[([mfn])\]//)
- {
- $gender = $1;
- }
-
- if ($ctr eq 'DAY' or $ctr eq 'MONTH' or $ctr eq 'YEAR')
- {
- # this is a cludge to make it work with newdateformat
- $fmtcntvar{$key} = join('', '{NNUMBERSTRING{', $ctr, '}}');
- }
- else
- {
- $fmtcntvar{$key} = join('', &get_Numberstring($val, $gender));
- }
-
- $_;
-}
-
-sub do_cmd_storeNumberstringnum{
- local($_) = @_;
- local($key, $val);
-
- $key = &missing_braces
- unless ((s/$next_pair_pr_rx//o)&&($key=$2));
-
- $val = &missing_braces
- unless (s/$next_pair_pr_rx/$val=$2;''/eo);
-
- my($gender)='m';
-
- if ($_ =~s/\s*\[([mfn])\]//)
- {
- $gender = $1;
- }
-
- $fmtcntvar{$key} = join('', &get_Numberstring($val, $gender));
-
- $_;
-}
-
-sub do_cmd_NUMBERstringnum{
- local($_) = @_;
- local($num,$gender);
- $num = &missing_braces
- unless (s/$next_pair_pr_rx/$num=$2;''/eo);
-
- if (s/\[(m|f|n)\]//)
- {
- $gender = $1;
- }
- else
- {
- $gender = 'm';
- }
-
- join('', uc(&get_numberstring($num,$gender)), $_);
-}
-
-sub do_cmd_NUMBERstring{
- local($ctr, $val, $id, $_) = &read_counter_value($_[0]);
- my($gender)='m';
-
- $_[0] =~ s/${OP}$id${CP}$ctr${OP}$id${CP}//;
-
- if ($_[0]=~s/\[(.)\]//)
- {
- $gender = $1;
- }
-
- if ($ctr eq 'DAY' or $ctr eq 'MONTH' or $ctr eq 'YEAR')
- {
- # this is a cludge to make it work with newdateformat
- join('', '{CAPNUMBERSTRING{', $ctr, '}}', $_);
- }
- else
- {
- join('', uc(&get_numberstring($val, $gender)), $_);
- }
-}
-
-sub do_cmd_storeNUMBERstring{
- local($_) = @_;
- local($key);
-
- $key = &missing_braces
- unless ((s/$next_pair_pr_rx//o)&&($key=$2));
-
- local($ctr, $val, $id, $_) = &read_counter_value($_);
- my($gender)='m';
-
- $_ =~ s/${OP}$id${CP}$ctr${OP}$id${CP}//;
-
- if ($_ =~s/\s*\[(.)\]//)
- {
- $gender = $1;
- }
-
- if ($ctr eq 'DAY' or $ctr eq 'MONTH' or $ctr eq 'YEAR')
- {
- # this is a cludge to make it work with newdateformat
- $fmtcntvar{$key} = join('', '{CAPNUMBERSTRING{', $ctr, '}}');
- }
- else
- {
- $fmtcntvar{$key} = uc(&get_numberstring($val, $gender));
- }
-
- $_;
-}
-
-sub do_cmd_storeNUMBERstringnum{
- local($_) = @_;
- local($key, $val);
-
- $key = &missing_braces
- unless ((s/$next_pair_pr_rx//o)&&($key=$2));
-
- $val = &missing_braces
- unless (s/$next_pair_pr_rx/$val=$2;''/eo);
-
- my($gender)='m';
-
- if ($_ =~s/\s*\[([mfn])\]//)
- {
- $gender = $1;
- }
-
- $fmtcntvar{$key} = uc(&get_numberstring($val, $gender));
-
- $_;
-}
-
-sub get_ordinalstringenglish{
- local($num) = @_;
- local($name)="";
-
- unless (($num >= 1000000) || ($num < 0))
- {
- if ($num >= 1000)
- {
- local($thousands) = &get_numberstring($num/1000);
- $name .= $thousands;
-
- if ($num%1000 > 0)
- {
- $name .= " $thousandname";
- }
- else
- {
- $name .= " $thousandthname";
- }
-
- $num = $num%1000;
- }
-
- if ($num >= 100)
- {
- if ($_[0] >= 1000) { $name .= " "; }
-
- local($hundreds) = &get_numberstring($num/100);
- $name .= $hundreds;
-
- if ($num%100 > 0)
- {
- $name .= " $hundredname";
- }
- else
- {
- $name .= " $hundredthname";
- }
-
- $num = $num%100;
- }
-
- if (($_[0] > 100) && ($_[0]%100 > 0)) { $name .= " and "; }
-
- if ($num >= 20)
- {
- if ($num%10 > 0)
- {
- $name .= $tenstring[$num/10] . '-';
- }
- else
- {
- $name .= $tenthstring[$num/10];
- }
- }
-
- if (($num >= 10) && ($num < 20))
- {
- $name .= $teenthstring[$num%10];
- }
- elsif (($num%10 > 0) || ($_[0] == 0))
- {
- $name .= $unitthstring[$num%10];
- }
- }
-
- $name;
-}
-
-sub get_ordinalstringfrench{
- local($num,$gender) = @_;
- local($name)="";
-
- unless (($num >= 1000000) || ($num < 0))
- {
- if ($num >= 1000)
- {
- local($thousands) = '';
-
- if ($num >= 2000)
- {
- $thousands = &get_numberstringfrench($num/1000,$gender).' ';
- }
-
- $num = $num%1000;
-
- if ($num > 0)
- {
- $name .= $thousands . $thousandnamefrench;
- }
- else
- {
- $name .= $thousands . $thousandthnamefrench;
- }
- }
-
- if ($num >= 100)
- {
- if ($_[0] >= 1000) { $name .= " "; }
-
- local($hundreds) = '';
-
- if ($num >= 200)
- {
- $hundreds = &get_numberstringfrench($num/100,$gender).' ';
- }
-
- $num = $num%100;
-
- if ($num > 0)
- {
- $name .= $hundreds . $hundrednamefrench;
- }
- else
- {
- $name .= $hundreds . $hundredthnamefrench;
- }
- }
-
- if (($_[0] > 100) && ($_[0]%100 > 0)) { $name .= " "; }
-
- if ($num >= 20)
- {
- if ($frenchdialect eq 'france' and $num >= 70)
- {
- if ($num < 80)
- {
- if ($num%10 > 0)
- {
- $name .= $tenstringfrench[6];
- }
- else
- {
- $name .= $tenthstringfrench[6];
- }
-
- if ($num%10 == 1)
- {
- $name .= ' et ';
- }
- else
- {
- $name .= '-';
- }
-
- $num = 10+($num%10);
- }
- else
- {
- $name .= 'quatre-vingt' . ($num==80?'i\`eme':'-');
-
- if ($num >= 90)
- {
- $num = 10+($num%10);
- }
- }
- }
- elsif ($frenchdialect eq 'belgian' and $num >= 80)
- {
- $name .= 'quatre-vingt' . ($num==80?'i\`eme':'-');
-
- if ($num >= 90)
- {
- $num = 10+($num%10);
- }
- }
- else
- {
- if ($num%10 > 0)
- {
- $name .= $tenstringfrench[$num/10];
- }
- else
- {
- $name .= $tenthstringfrench[$num/10];
- }
-
- if ($num%10 == 1) { $name .= ' et ';}
- elsif ($num%10 > 0) { $name .= '-'; }
- }
- }
-
- if (($num >= 10) && ($num < 20))
- {
- $name .= $teenthstringfrench[$num%10];
- }
- elsif ($_[0] == 1)
- {
- $name = 'premi\`ere';
- }
- elsif (($num%10 > 0) || ($_[0] == 0))
- {
- $name .= $unitthstringfrench[$num%10];
- }
- }
-
- $name;
-}
-
-sub get_ordinalstringspanish{
- local($num,$gender) = @_;
- local($name)="";
- local($str);
-
- unless (($num >= 1000000) || ($num < 0))
- {
- if ($num >= 1000)
- {
- if ($num >= 2000)
- {
- local($thousands) = &get_ordinalstringspanish($num/1000);
-
- if ($gender eq 'f')
- {
- $thousands =~s/o(s?)$/a\1/;
- }
-
- $name .= $thousands. " ";
- }
- else
- {
- $name = "";
- }
-
- $name .= "$thousandthnamespanish";
-
- if ($gender eq 'f')
- {
- $name =~s/o$/a/;
- }
-
- $num = $num%1000;
- }
-
- if ($num >= 100)
- {
- if ($_[0] >= 1000) { $name .= " "; }
-
- local($hundreds) = $hundredthstringspanish[$num/100];
-
- if ($gender eq 'f')
- {
- $hundreds =~s/o$/a/;
- }
-
- $name .= $hundreds;
-
- $num = $num%100;
- }
-
- if (($_[0] > 100) && ($_[0]%100 > 0)) { $name .= " "; }
-
- local($lastbit)="";
-
- if ($num >= 20)
- {
- $lastbit = $tenthstringspanish[$num/10];
-
- if ($num%10 > 0)
- {
- $lastbit .= ' ';
- }
-
- if ($gender eq 'f')
- {
- $lastbit =~s/o([ s]*)$/a\1/;
- }
-
- $name .= $lastbit;
-
- $lastbit = "";
- }
-
- if (($num >= 10) && ($num < 20))
- {
- $lastbit = $teenthstringspanish[$num%10];
- }
- elsif (($num%10 > 0) || ($_[0] == 0))
- {
- $lastbit = $unitthstringspanish[$num%10];
- }
-
- if ($gender eq 'f')
- {
- $lastbit =~s/o([ s]*)$/a\1/;
- }
-
- $name .= $lastbit;
- }
-
- $name;
-}
-
-sub get_ordinalstringportuges{
- local($num,$gender) = @_;
- local($name)="";
- local($str);
-
- unless (($num >= 1000000) || ($num < 0))
- {
- if ($num >= 1000)
- {
- if ($num >= 2000)
- {
- local($thousands) = &get_ordinalstringportuges($num/1000);
-
- if ($gender eq 'f')
- {
- $thousands =~s/o(s?)$/a\1/;
- }
-
- $name .= $thousands. " ";
- }
- else
- {
- $name = "";
- }
-
- $name .= "$thousandthnameportuges";
-
- if ($gender eq 'f')
- {
- $name =~s/o$/a/;
- }
-
- $num = $num%1000;
- }
-
- if ($num >= 100)
- {
- if ($_[0] >= 1000) { $name .= " "; }
-
- local($hundreds) = $hundredthstringportuges[$num/100];
-
- if ($gender eq 'f')
- {
- $hundreds =~s/o$/a/;
- }
-
- $name .= $hundreds;
-
- $num = $num%100;
- }
-
- if (($_[0] > 100) && ($_[0]%100 > 0)) { $name .= "-"; }
-
- local($lastbit)="";
-
- if ($num >= 10)
- {
- $lastbit = $tenthstringportuges[$num/10];
-
- if ($num%10 > 0)
- {
- $lastbit .= '-';
- }
-
- if ($gender eq 'f')
- {
- $lastbit =~s/o([ s]*)$/a\1/;
- }
-
- $name .= $lastbit;
-
- $lastbit = "";
- }
-
- if (($num%10 > 0) || ($_[0] == 0))
- {
- $lastbit = $unitthstringportuges[$num%10];
- }
-
- if ($gender eq 'f')
- {
- $lastbit =~s/o([ s]*)$/a\1/;
- }
-
- $name .= $lastbit;
- }
-
- $name;
-}
-
-sub get_numberunderhundredthgerman{
- local($num,$gender)=@_;
- local($name)='';
-
- if ($num < 10)
- {
- if ($gender eq 'F')
- {
- $name = $unitthstringFgerman[$num];
- }
- elsif ($gender eq 'N')
- {
- $name = $unitthstringNgerman[$num];
- }
- else
- {
- $name = $unitthstringMgerman[$num];
- }
- }
- elsif ($num%10 == 0)
- {
- if ($gender eq 'F')
- {
- $name = $tenthstringFgerman[$num/10];
- }
- elsif ($gender eq 'N')
- {
- $name = $tenthstringNgerman[$num/10];
- }
- else
- {
- $name = $tenthstringMgerman[$num/10];
- }
- }
- else
- {
- local($tenth);
- if ($gender eq 'F')
- {
- $tenth = $tenthstringFgerman[$num/10];
- }
- elsif ($gender eq 'N')
- {
- $tenth = $tenthstringNgerman[$num/10];
- }
- else
- {
- $tenth = $tenthstringMgerman[$num/10];
- }
-
- $name = join('und', $unitstringgerman[$num%10], $tenth);
- }
-
- $name;
-}
-
-sub get_ordinalstringgerman{
- local($orgnum,$gender) = @_;
- local($name)="";
- local($suffix)='';
-
- $gender = uc($gender);
-
- if ($gender eq 'F')
- {
- $suffix = 'ste';
- }
- elsif ($gender eq 'N')
- {
- $suffix = 'stes';
- }
- else
- {
- $suffix = 'ster';
- $gender = 'M';
- }
-
- local($num) = $orgnum;
-
- unless (($num >= 1000000) || ($num < 0))
- {
- if ($num >= 1000 and $num < 2000)
- {
- $name = &translate_commands("\\eintausend ");
- }
- elsif ($num >= 2000)
- {
- $name = &get_numberunderhundredgerman($num/1000)
- . "tausend";
- }
-
- $num = $orgnum%1000;
-
- # is that it or is there more?
- if ($orgnum >= 1000 and $num == 0)
- {
- $name .= $suffix;
- return $name;
- }
-
- if ($num >= 100 and $num < 200)
- {
- if ($orgnum > 1000)
- {
- $name .= "einhundert";
- }
- else
- {
- $name = &translate_commands("\\einhundert ");
- }
- }
- elsif ($num >= 200)
- {
- $name .= $unitstringgerman[$num/100]."hundert";
- }
-
- $num = $num%100;
-
- # is that it or is there more?
- if ($orgnum >= 100 and $num == 0)
- {
- $name .= $suffix;
- return $name;
- }
-
- if ($orgnum == 0)
- {
- if ($gender eq 'F')
- {
- $name = $unitthstringFgerman[0];
- }
- elsif ($gender eq 'N')
- {
- $name = $unitthstringNgerman[0];
- }
- else
- {
- $name = $unitthstringMgerman[0];
- }
- }
- elsif ($num > 0)
- {
- $name .= &get_numberunderhundredthgerman($num,$gender);
- }
- }
-
- $name;
-}
-
-sub get_ordinalstring{
- local($val,$gender) = @_;
-
- if ($default_language eq 'french')
- {
- &get_ordinalstringfrench($val,$gender);
- }
- elsif ($default_language eq 'spanish')
- {
- &get_ordinalstringspanish($val,$gender);
- }
- elsif ($default_language eq 'portuges')
- {
- &get_ordinalstringportuges($val,$gender);
- }
- elsif ($default_language eq 'german'
- or $default_language eq 'ngerman')
- {
- &get_ordinalstringgerman($val,$gender);
- }
- else
- {
- &get_ordinalstringenglish($val);
- }
-}
-
-sub do_cmd_ordinalstringnum{
- local($_) = @_;
- local($num,$gender);
- $num = &missing_braces
- unless (s/$next_pair_pr_rx/$num=$2;''/eo);
-
- if (s/\[(m|f|n)\]//)
- {
- $gender = $1;
- }
- else
- {
- $gender = 'm';
- }
-
- join('', &get_ordinalstring($num,$gender), $_);
-}
-
-sub do_cmd_ordinalstring{
- local($ctr, $val, $id, $_) = &read_counter_value($_[0]);
- my($gender)='m';
-
- $_[0] =~ s/${OP}$id${CP}$ctr${OP}$id${CP}//;
-
- if ($_[0]=~s/\[(.)\]//)
- {
- $gender = $1;
- }
-
- if ($ctr eq 'DAY' or $ctr eq 'MONTH' or $ctr eq 'YEAR')
- {
- # this is a cludge to make it work with newdateformat
- join('', '{ORDINALSTRING{', $ctr, '}}', $_);
- }
- else
- {
- join('', &get_ordinalstring($val, $gender), $_);
- }
-}
-
- %fmtcntvar = ();
-
-sub do_cmd_FMCuse{
- local($_) = @_;
- local($key);
-
- $key = &missing_braces
- unless ((s/$next_pair_pr_rx//o)&&($key=$2));
-
- $fmtcntvar{$key}.$_;
-}
-
-sub do_cmd_storeordinalstring{
- local($_) = @_;
- local($key);
-
- $key = &missing_braces
- unless ((s/$next_pair_pr_rx//o)&&($key=$2));
-
- local($ctr, $val, $id, $_) = &read_counter_value($_);
- my($gender)='m';
-
- $_ =~ s/${OP}$id${CP}$ctr${OP}$id${CP}//;
-
- if ($_ =~s/\s*\[(.)\]//)
- {
- $gender = $1;
- }
-
- if ($ctr eq 'DAY' or $ctr eq 'MONTH' or $ctr eq 'YEAR')
- {
- # this is a cludge to make it work with newdateformat
- $fmtcntvar{$key} = join('', '{ORDINALSTRING{', $ctr, '}}');
- }
- else
- {
- $fmtcntvar{$key} = join('', &get_ordinalstring($val, $gender));
- }
-
- $_;
-}
-
-sub do_cmd_storeordinalstringnum{
- local($_) = @_;
- local($key, $val);
-
- $key = &missing_braces
- unless ((s/$next_pair_pr_rx//o)&&($key=$2));
-
- $val = &missing_braces
- unless (s/$next_pair_pr_rx/$val=$2;''/eo);
-
- my($gender)='m';
-
- if ($_ =~s/\s*\[(.)\]//)
- {
- $gender = $1;
- }
-
- $fmtcntvar{$key} = join('', &get_ordinalstring($val, $gender));
-
- $_;
-}
-
-sub get_Ordinalstring{
- local($val,$gender) = @_;
- local($string) = &get_ordinalstring($val,$gender);
-
- if ($default_language=~m/german/)
- {
- $string =~ s/\b([a-z])([^\s\-]+)/\u\1\2/;
- }
- else
- {
- $string =~ s/\b([a-z])([^\s\-]+)/\u\1\2/g;
-
- if ($default_language eq 'french')
- {
- $string =~ s/ Et / et /g;
- }
- else
- {
- $string =~ s/ And / and /g;
- }
- }
-
- $string;
-}
-
-sub do_cmd_Ordinalstringnum{
- local($_) = @_;
- local($num,$gender);
- $num = &missing_braces
- unless (s/$next_pair_pr_rx/$num=$2;''/eo);
-
- if (s/\[(m|f|n)\]//)
- {
- $gender = $1;
- }
- else
- {
- $gender = 'm';
- }
-
- join('', &get_Ordinalstring($num,$gender), $_);
-}
-
-sub do_cmd_Ordinalstring{
- local($ctr, $val, $id, $_) = &read_counter_value($_[0]);
- my($gender)='m';
-
- $_[0] =~ s/${OP}$id${CP}$ctr${OP}$id${CP}//;
-
- if ($_[0]=~s/\[(.)\]//)
- {
- $gender = $1;
- }
-
- if ($ctr eq 'DAY' or $ctr eq 'MONTH' or $ctr eq 'YEAR')
- {
- # this is a cludge to make it work with newdateformat
- join('', '{OORDINALSTRING{', $ctr, '}}', $_[0]);
- }
- else
- {
- join('', &get_Ordinalstring($val, $gender), $_[0]);
- }
-}
-
-sub do_cmd_storeOrdinalstring{
- local($_) = @_;
- local($key);
-
- $key = &missing_braces
- unless ((s/$next_pair_pr_rx//o)&&($key=$2));
-
- local($ctr, $val, $id, $_) = &read_counter_value($_);
- my($gender)='m';
-
- $_ =~ s/${OP}$id${CP}$ctr${OP}$id${CP}//;
-
- if ($_ =~s/\s*\[(.)\]//)
- {
- $gender = $1;
- }
-
- if ($ctr eq 'DAY' or $ctr eq 'MONTH' or $ctr eq 'YEAR')
- {
- # this is a cludge to make it work with newdateformat
- $fmtcntvar{$key} = join('', '{OORDINALSTRING{', $ctr, '}}');
- }
- else
- {
- $fmtcntvar{$key} = join('', &get_Ordinalstring($val, $gender));
- }
-
- $_;
-}
-
-sub do_cmd_storeOrdinalstringnum{
- local($_) = @_;
- local($key, $val);
-
- $key = &missing_braces
- unless ((s/$next_pair_pr_rx//o)&&($key=$2));
-
- $val = &missing_braces
- unless (s/$next_pair_pr_rx/$val=$2;''/eo);
-
- my($gender)='m';
-
- if ($_ =~s/\s*\[(.)\]//)
- {
- $gender = $1;
- }
-
- $fmtcntvar{$key} = join('', &get_Ordinalstring($val, $gender));
-
- $_;
-}
-
-sub do_cmd_ORDINALstringnum{
- local($_) = @_;
- local($num,$gender);
- $num = &missing_braces
- unless (s/$next_pair_pr_rx/$num=$2;''/eo);
-
- if (s/\[(m|f|n)\]//)
- {
- $gender = $1;
- }
- else
- {
- $gender = 'm';
- }
-
- join('', uc(&get_ordinalstring($num,$gender)), $_);
-}
-
-sub do_cmd_ORDINALstring{
- local($ctr, $val, $id, $_) = &read_counter_value($_[0]);
- my($gender)='m';
-
- $_[0] =~ s/${OP}$id${CP}$ctr${OP}$id${CP}//;
-
- if ($_[0]=~s/\[(.)\]//)
- {
- $gender = $1;
- }
-
- if ($ctr eq 'DAY' or $ctr eq 'MONTH' or $ctr eq 'YEAR')
- {
- # this is a cludge to make it work with newdateformat
- join('', '{CAPORDINALSTRING{', $ctr, '}}', $_);
- }
- else
- {
- join('', uc(&get_ordinalstring($val, $gender)), $_);
- }
-}
-
-sub do_cmd_storeORDINALstring{
- local($_) = @_;
- local($key);
-
- $key = &missing_braces
- unless ((s/$next_pair_pr_rx//o)&&($key=$2));
-
- local($ctr, $val, $id, $_) = &read_counter_value($_);
- my($gender)='m';
-
- $_ =~ s/${OP}$id${CP}$ctr${OP}$id${CP}//;
-
- if ($_ =~s/\s*\[(.)\]//)
- {
- $gender = $1;
- }
-
- if ($ctr eq 'DAY' or $ctr eq 'MONTH' or $ctr eq 'YEAR')
- {
- # this is a cludge to make it work with newdateformat
- $fmtcntvar{$key} = join('', '{CAPORDINALSTRING{', $ctr, '}}');
- }
- else
- {
- $fmtcntvar{$key} = uc(&get_ordinalstring($val, $gender));
- }
-
- $_;
-}
-
-sub do_cmd_storeORDINALstringnum{
- local($_) = @_;
- local($key, $val);
-
- $key = &missing_braces
- unless ((s/$next_pair_pr_rx//o)&&($key=$2));
-
- $val = &missing_braces
- unless (s/$next_pair_pr_rx/$val=$2;''/eo);
-
- my($gender)='m';
-
- if ($_ =~s/\s*\[(.)\]//)
- {
- $gender = $1;
- }
-
- $fmtcntvar{$key} = uc(&get_ordinalstring($val, $gender));
-
- $_;
-}
-
-sub do_cmd_fmtcountsetoptions{
- local($_) = @_;
- local($options) = &missing_braces unless ($_[0]=~(s/$next_pair_pr_rx//o)&&($options=$2));
-
- if ($options =~ m/french=?(\w*)(,|$)/)
- {
- if ($1 eq 'france' or $1 eq 'swiss' or $1 eq 'belgian')
- {
- $frenchdialect = $1;
-
- print "Using French dialect: $1" if ($VERBOSITY > 0) ;
- }
- elsif ($1 eq '')
- {
- $frenchdialect = 'france';
-
- print "Using French dialect: france" if ($VERBOSITY > 0);
- }
- else
- {
- &write_warnings("unknown french dialect '$1'");
- }
- }
-
- if ($options =~ m/abbrv=?(\w*)(,|$)/)
- {
- if ($1 eq 'true' or $1 eq '')
- {
- $ordinalabbrv = 1;
-
- print "Setting abbrv=true" if ($VERBOSITY > 0);
- }
- elsif ($1 eq 'false')
- {
- $ordinalabbrv = 0;
-
- print "Setting abbrv=false" if ($VERBOSITY > 0);
- }
- else
- {
- &write_warnings("fmtcountsetoptions key abbrv: unknown value '$1'.");
- }
- }
-
- if ($options =~ m/fmtord=(\w*)(,|$)/)
- {
- if ($1 eq 'raise')
- {
- &do_fmtcount_raise();
-
- print "Using raised ordinals" if ($VERBOSITY > 0);
- }
- elsif ($1 eq 'level')
- {
- &do_fmtcount_level();
-
- print "Using level ordinals" if ($VERBOSITY > 0);
- }
- elsif ($1 eq 'user')
- {
- # do nothing
-
- print "Using user defined fmtord" if ($VERBOSITY > 0);
- }
- else
- {
- &write_warnings("unknown fmtcount option fmtord=$1");
- }
- }
-
- $_[0];
-}
-
-$padzeroes = 0;
-
-sub do_cmd_padzeroes{
- local($_) = @_;
- local($val,$pat) = &get_next_optional_argument;
-
- if ($val eq '')
- {
- $padzeroes = 17;
- }
- else
- {
- $padzeroes = $val;
- }
-
- $_;
-}
-
-sub get_binary{
- local($num) = @_;
- local($val) = "";
-
- for (my $i=17; $i>=0; $i--)
- {
- if (($i < $padzeroes) || ($num & (1 << $i)) || !($val eq ""))
- {
- $val .= ($num & (1 << $i) ? 1 : 0);
- }
- }
-
- $val;
-}
-
-sub do_cmd_binary{
- local($ctr, $val, $id, $_) = &read_counter_value($_[0]);
-
- join('', &get_binary($val), $_);
-}
-
-sub do_cmd_binarynum{
- local($_) = @_;
- local($num) = &missing_braces
- unless (s/$next_pair_pr_rx/$num=$2;''/eo);
-
- join('', &get_binary($num), $_);
-}
-
-sub get_decimal{
- local($num) = @_;
-
- sprintf "%0${padzeroes}d", $num;
-}
-
-sub do_cmd_decimal{
- local($ctr, $val, $id, $_) = &read_counter_value($_[0]);
-
- join('', &get_decimal($val), $_);
-}
-
-sub do_cmd_decimalnum{
- local($_) = @_;
- local($num) = &missing_braces
- unless (s/$next_pair_pr_rx/$num=$2;''/eo);
-
- join('', &get_decimal($num), $_);
-}
-
-sub get_hexadecimal{
- local($num) = @_;
-
- sprintf "%0${padzeroes}lx", $num;
-}
-
-sub do_cmd_hexadecimal{
- local($ctr, $val, $id, $_) = &read_counter_value($_[0]);
-
- join('', &get_hexadecimal($val), $_);
-}
-
-sub do_cmd_hexadecimalnum{
- local($_) = @_;
- local($num) = &missing_braces
- unless (s/$next_pair_pr_rx/$num=$2;''/eo);
-
- join('', &get_hexadecimal($num), $_);
-}
-
-sub get_Hexadecimal{
- local($num) = @_;
-
- sprintf "%0${padzeroes}lX", $num;
-}
-
-sub do_cmd_Hexadecimal{
- local($ctr, $val, $id, $_) = &read_counter_value($_[0]);
-
- join('', &get_Hexadecimal($val), $_);
-}
-
-sub do_cmd_Hexadecimalnum{
- local($_) = @_;
- local($num) = &missing_braces
- unless (s/$next_pair_pr_rx/$num=$2;''/eo);
-
- join('', &get_Hexadecimal($num), $_);
-}
-
-sub get_octal{
- local($num) = @_;
-
- sprintf "%0${padzeroes}lo", $num;
-}
-
-sub do_cmd_octal{
- local($ctr, $val, $id, $_) = &read_counter_value($_[0]);
-
- join('', &get_octal($val), $_);
-}
-
-sub do_cmd_octalnum{
- local($_) = @_;
- local($num) = &missing_braces
- unless (s/$next_pair_pr_rx/$num=$2;''/eo);
-
- join('', &get_octal($num), $_);
-}
-
-sub get_aaalph{
- local($num) = @_;
- local($rep) = int($num/26) + 1;
- local($c) = chr(ord('a')-1+$num%26);
-
- local($_) = $c x $rep;
-}
-
-sub do_cmd_aaalph{
- local($ctr, $val, $id, $_) = &read_counter_value($_[0]);
-
- join('', &get_aaalph($val), $_);
-}
-
-sub get_AAAlph{
- local($num) = @_;
- local($rep) = int($num/26) + 1;
- local($c) = chr(ord('A')-1+$num%26);
-
- local($_) = $c x $rep;
-}
-
-sub do_cmd_AAAlph{
- local($ctr, $val, $id, $_) = &read_counter_value($_[0]);
-
- join('', &get_AAAlph($val), $_);
-}
-
-sub do_cmd_aaalphnum{
- local($_) = @_;
- local($num) = &missing_braces
- unless (s/$next_pair_pr_rx/$num=$2;''/eo);
-
- join('', (sprintf "%${padzeroes}s", &get_aaalph($num)), $_);
-}
-
-sub do_cmd_AAAlphnum{
- local($_) = @_;
- local($num) = &missing_braces
- unless (s/$next_pair_pr_rx/$num=$2;''/eo);
-
- join('', uc(sprintf "%${padzeroes}s", &get_aaalph($num)), $_);
-}
-
-sub get_abalph{
- local($num) = @_;
- local($str);
-
- if ($num == 0)
- {
- $str = '';
- }
- elsif ($num > 0 && $num <= 26)
- {
- $str = chr(ord('a')-1+$num);
- }
- else
- {
- $str = &get_abalph(int($num/26)) . chr(ord('a')-1+($num%26));
- }
-
- $str;
-}
-
-sub do_cmd_abalph{
- local($ctr, $val, $id, $_) = &read_counter_value($_[0]);
-
- join('', (sprintf "%${padzeroes}s", &get_abalph($val)), $_);
-}
-
-sub do_cmd_abalphnum{
- local($_) = @_;
- local($num) = &missing_braces
- unless (s/$next_pair_pr_rx/$num=$2;''/eo);
-
- join('', (sprintf "%${padzeroes}s", &get_abalph($num)), $_);
-}
-
-sub do_cmd_ABAlph{
- local($ctr, $val, $id, $_) = &read_counter_value($_[0]);
-
- join('', uc(sprintf "%${padzeroes}s", &get_abalph($val)), $_);
-}
-
-sub do_cmd_ABAlphnum{
- local($_) = @_;
- local($num) = &missing_braces
- unless (s/$next_pair_pr_rx/$num=$2;''/eo);
-
- join('', uc(sprintf "%${padzeroes}s", &get_abalph($num)), $_);
-}
-
-sub get_twodigit{
- local($num) = @_;
-
- sprintf "%02d", $num;
-}
-
-sub do_cmd_twodigit{
- local($_) = @_;
- local($num) = &missing_braces
- unless (s/$next_pair_pr_rx/$num=$2;''/eo);
-
- # this is a cludge
- if ($num eq "THEDAY" or $num eq "THEYEAR" or $num eq "THEMONTH")
- {
- join('', 'TWODIGIT{', $num, '}', $_);
- }
- else
- {
- join('', &get_twodigit($num), $_);
- }
-}
-
-# this was put here to help with the definition of \datelatin
-
-sub do_cmd_romannumeral{
- local($_) = @_;
- local($num) = &missing_braces
- unless (s/$next_pair_pr_rx/$num=$2;''/eo);
-
- # this is a cludge
- if ($num eq "THEDAY" or $num eq "THEYEAR" or $num eq "THEMONTH")
- {
- join('', 'ROMANNUMERAL{', $num, '}', $_);
- }
- else
- {
- join('', &froman($num), $_);
- }
-}
-
-# load configuration file if it exists
-# Note: The configuration file should be loaded before
-# the package options are executed.
-
-# why doesn't this work? If I call this subroutine it
-# causes an infinite loop.
-
-sub load_fmtcount_cfg{
- local($file,$found);
-
- $file = &fulltexpath('fmtcount.cfg');
-
- $found = (-f $file);
-
- if (!$found)
- {
- foreach $texpath (split /$envkey/, $TEXINPUTS)
- {
- $file = "$texpath${dd}fmtcount.cfg";
-
- last if ($found = (-f $file));
- }
- }
-
- if ($found)
- {
- print "\nusing configuration file $file\n";
-
- &slurp_input($file);
- &pre_process;
- &substitute_meta_cmds if (%new_command || %new_environment);
- &wrap_shorthand_environments;
- $_ = &translate_commands(&translate_environments($_));
-
- print "\n processed size: ".length($_)."\n" if ($VERBOSITY>1)
- }
- else
- {
- print "\nNo configuation file fmtcount.cfg found\n" if ($VERBOSITY>1)
- }
-}
-
-1;
-% \end{macrocode}
-%\fi
-%\iffalse
-% \begin{macrocode}
-%</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
diff --git a/Master/texmf-dist/source/latex/fmtcount/fmtcount.ins b/Master/texmf-dist/source/latex/fmtcount/fmtcount.ins
index ce3f24e2327..5d5f30354ce 100644
--- a/Master/texmf-dist/source/latex/fmtcount/fmtcount.ins
+++ b/Master/texmf-dist/source/latex/fmtcount/fmtcount.ins
@@ -1,10 +1,10 @@
-% fmtcount.ins generated using makedtx version 0.94b 2009/10/2 18:35
+% fmtcount.ins generated using makedtx version 0.94b 2012/9/25 10:12
\input docstrip
\preamble
fmtcount.dtx
- Copyright 2009 Nicola Talbot
+ Copyright 2012 Nicola Talbot
This work may be distributed and/or modified under the
conditions of the LaTeX Project Public License, either version 1.3
@@ -18,24 +18,40 @@
The Current Maintainer of this work is Nicola Talbot.
- This work consists of the files fmtcount.dtx and fmtcount.ins and the derived files fmtcount.sty, fc-british.def, fc-english.def, fc-french.def, fc-german.def, fc-italian.def, fc-portuges.def, fc-spanish.def, fc-UKenglish.def, fc-USenglish.def, fmtcount.perl, fc-lang.tex, fc-samp.tex.
+ This work consists of the files fmtcount.dtx and fmtcount.ins and the derived files fcnumparser.sty, fcprefix.sty, fmtcount.sty, fc-american.def, fc-british.def, fc-english.def, fc-francais.def, fc-french.def, fc-frenchb.def, fc-german.def, fc-germanb.def, fc-italian.def, fc-ngerman.def, fc-ngermanb.def, fc-portuges.def, fc-spanish.def, fc-UKenglish.def, fc-USenglish.def.
\endpreamble
\askforoverwritefalse
-\generate{\file{fmtcount.sty}{\usepreamble\defaultpreamble
+\generate{\file{fcnumparser.sty}{\usepreamble\defaultpreamble
+\usepostamble\defaultpostamble\from{fmtcount.dtx}{fcnumparser.sty,package}}
+\file{fcprefix.sty}{\usepreamble\defaultpreamble
+\usepostamble\defaultpostamble\from{fmtcount.dtx}{fcprefix.sty,package}}
+\file{fmtcount.sty}{\usepreamble\defaultpreamble
\usepostamble\defaultpostamble\from{fmtcount.dtx}{fmtcount.sty,package}}
+\file{fc-american.def}{\usepreamble\defaultpreamble
+\usepostamble\defaultpostamble\from{fmtcount.dtx}{fc-american.def,package}}
\file{fc-british.def}{\usepreamble\defaultpreamble
\usepostamble\defaultpostamble\from{fmtcount.dtx}{fc-british.def,package}}
\file{fc-english.def}{\usepreamble\defaultpreamble
\usepostamble\defaultpostamble\from{fmtcount.dtx}{fc-english.def,package}}
+\file{fc-francais.def}{\usepreamble\defaultpreamble
+\usepostamble\defaultpostamble\from{fmtcount.dtx}{fc-francais.def,package}}
\file{fc-french.def}{\usepreamble\defaultpreamble
\usepostamble\defaultpostamble\from{fmtcount.dtx}{fc-french.def,package}}
+\file{fc-frenchb.def}{\usepreamble\defaultpreamble
+\usepostamble\defaultpostamble\from{fmtcount.dtx}{fc-frenchb.def,package}}
\file{fc-german.def}{\usepreamble\defaultpreamble
\usepostamble\defaultpostamble\from{fmtcount.dtx}{fc-german.def,package}}
+\file{fc-germanb.def}{\usepreamble\defaultpreamble
+\usepostamble\defaultpostamble\from{fmtcount.dtx}{fc-germanb.def,package}}
\file{fc-italian.def}{\usepreamble\defaultpreamble
\usepostamble\defaultpostamble\from{fmtcount.dtx}{fc-italian.def,package}}
+\file{fc-ngerman.def}{\usepreamble\defaultpreamble
+\usepostamble\defaultpostamble\from{fmtcount.dtx}{fc-ngerman.def,package}}
+\file{fc-ngermanb.def}{\usepreamble\defaultpreamble
+\usepostamble\defaultpostamble\from{fmtcount.dtx}{fc-ngermanb.def,package}}
\file{fc-portuges.def}{\usepreamble\defaultpreamble
\usepostamble\defaultpostamble\from{fmtcount.dtx}{fc-portuges.def,package}}
\file{fc-spanish.def}{\usepreamble\defaultpreamble
@@ -44,11 +60,6 @@
\usepostamble\defaultpostamble\from{fmtcount.dtx}{fc-UKenglish.def,package}}
\file{fc-USenglish.def}{\usepreamble\defaultpreamble
\usepostamble\defaultpostamble\from{fmtcount.dtx}{fc-USenglish.def,package}}
-\file{fmtcount.perl}{\nopreamble\nopostamble\from{fmtcount.dtx}{fmtcount.perl}}
-\file{fc-lang.tex}{\usepreamble\defaultpreamble
-\usepostamble\defaultpostamble\from{fmtcount.dtx}{fc-lang.tex,package}}
-\file{fc-samp.tex}{\usepreamble\defaultpreamble
-\usepostamble\defaultpostamble\from{fmtcount.dtx}{fc-samp.tex,package}}
}
\endbatchfile
diff --git a/Master/texmf-dist/source/latex/fmtcount/fmtcount.perl b/Master/texmf-dist/source/latex/fmtcount/fmtcount.perl
index bc7d3b9fb4e..df6122a7dd2 100644
--- a/Master/texmf-dist/source/latex/fmtcount/fmtcount.perl
+++ b/Master/texmf-dist/source/latex/fmtcount/fmtcount.perl
@@ -1,7 +1,7 @@
# File : fmtcount.perl
# Author : Nicola Talbot
-# Date : 26 May 2007
-# Version : 1.05
+# Date : 2012-09-25
+# Version : 1.06
# Description : LaTeX2HTML implementation of fmtcount package
package main;
@@ -415,9 +415,9 @@ sub get_numberstringenglish{
'quarante',
'cinquante',
'soixante',
- 'septente',
- 'huitante',
- 'nonente');
+ 'septante',
+ 'octante',
+ 'nonante');
$hundrednamefrench = "cent";
$hundredthnamefrench = "centi\\`eme";