summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/fmtcount
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2015-05-09 22:19:10 +0000
committerKarl Berry <karl@freefriends.org>2015-05-09 22:19:10 +0000
commit5eb3d28bc68d47fc7eb74e47ac1f6f5c0787ec72 (patch)
tree4df1478569d269659f20d61fb6586a5b8e8cf47f /Master/texmf-dist/source/latex/fmtcount
parent5e664832d01265bd37a5cbdd56729feb90ce8fa9 (diff)
fmtcount (9may15)
git-svn-id: svn://tug.org/texlive/trunk@37298 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/fmtcount')
-rw-r--r--Master/texmf-dist/source/latex/fmtcount/fmtcount.dtx6234
-rw-r--r--Master/texmf-dist/source/latex/fmtcount/fmtcount.ins20
2 files changed, 3211 insertions, 3043 deletions
diff --git a/Master/texmf-dist/source/latex/fmtcount/fmtcount.dtx b/Master/texmf-dist/source/latex/fmtcount/fmtcount.dtx
index 77ebb29e78c..9293bdd287d 100644
--- a/Master/texmf-dist/source/latex/fmtcount/fmtcount.dtx
+++ b/Master/texmf-dist/source/latex/fmtcount/fmtcount.dtx
@@ -1,12 +1,11 @@
%\iffalse
% fmtcount.dtx generated using makedtx version 0.94b (c) Nicola Talbot
% Command line args:
-% -src "(.+)\.(sty)=>\1.\2"
-% -src "(.+)\.(def)=>\1.\2"
+% -src "(.+)\.(sty|def)$=>\1.\2"
% -doc "fmtcount-manual.tex"
% -author "Nicola Talbot and Vincent Belaïche"
% fmtcount
-% Created on 2014/7/28 7:55
+% Created on 2015/5/8 16:50
%\fi
%\iffalse
%<*package>
@@ -29,7 +28,7 @@
%\fi
% \iffalse
% Doc-Source file to use with LaTeX2e
-% Copyright (C) 2014 Nicola Talbot and Vincent Belaïche, all rights reserved.
+% Copyright (C) 2015 Nicola Talbot and Vincent Belaïche, all rights reserved.
% \fi
% \iffalse
%<*driver>
@@ -42,7 +41,7 @@
\usepackage{tabularx,supertabular,multirow}
\usepackage[T1]{fontenc}
\usepackage{cmap}
-\usepackage{fmtcount}% needed
+\usepackage{fmtcount}% needed for \fc@iterate@on@languages
\newcommand*\uref[1]{\href{#1}{#1}}
\DeclareMathOperator{\intv}{..}
\newcommand*\interface{}
@@ -79,7 +78,7 @@
pdftitle={fmtcount.sty: Displaying the Values of LaTeX Counters},
pdfkeywords={LaTeX,counter}]{hyperref}
-\CheckSum{9801}
+\CheckSum{9930}
\doxitem{Option}{option}{options}
@@ -98,7 +97,7 @@
% \url{www.dickimaw-books.com}
% \and
% Vincent Bela\"iche}
-% \date{2014-07-18 (version 3.00)\relax
+% \date{2015-05-05 (version 3.01)\relax
%}
% \maketitle
% \tableofcontents
@@ -470,8 +469,8 @@
%\begin{definition}[\DescribeMacro{\fmtcountsetoptions}]
%\cs{fmtcountsetoptions}\verb"{fmtord="\meta{type}\verb'}'
%\end{definition}
-%where \meta{type} is either \texttt{level} or
-%\texttt{raise}.
+%where \meta{type} is either \texttt{level} or \texttt{raise}. Since version~3.01 of \sty{fmtcount}, it is also
+%possible to set \meta{type} on a language by language basis, see~\S~\ref{sec:multilingual-support}.
%
%\section{Multilingual Support}
%\label{sec:multilingual-support}
@@ -525,6 +524,31 @@
%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 setting ordinal ending position raise/level}
+%\label{sec:options-fmtord}
+%
+%\begin{definition}[\DescribeMacro{\fmtcountsetoptions}]
+%\cs{fmtcountsetoptions}\verb"{"\meta{language}\verb"={fmtord="\meta{type}\verb'}}'
+%\end{definition}
+%where \meta{language} is one of the supported language \meta{type} is either \texttt{level} or \texttt{raise}
+%or \texttt{undefine}. If the value is \texttt{level} or \texttt{raise}, then that will set the \texttt{fmtord}
+%option accordingly\footnote{see~\S~\ref{sec:package-options}} only for that language \meta{language}. If the
+%value is \texttt{undefine}, then the non-language specific behaviour is followed.
+%
+%Some \meta{language} are synonyms, here is a table:
+%
+%\begin{center}
+% \begin{tabular}{|l|l|}\hline
+% \textbf{language}& \textbf{alias(es)}\\\hline
+% english& british\\\hline
+% french&frenchb\\\hline
+% &germanb\\
+% german&ngerman\\
+% &ngermanb\\\hline
+% USenglish&american\\\hline
+% \end{tabular}
+%\end{center}
+%
%\subsection{Options for French}
%\label{sec:options-french}
%
@@ -585,9 +609,9 @@
%\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\\
+% {\def\languagename{french}\csname fmtord@abbrvtrue\endcsname\ordinalnum{2}} (par défaut), ou\\
% \pkgopt{false}& pour produire des ordinaux de la forme
-% 2\textsuperscript{eme} (par defaut)\\
+% {\def\languagename{french}\csname fmtord@abbrvfalse\endcsname\ordinalnum{2}} \\
%\end{tabularx}
%
%\begin{definition}[\DescribeOption{vingt plural}]
@@ -854,3000 +878,14 @@
%\url{https://github.com/nlct/fmtcount/issues/}.
%
%
+%% Local Variables:
+%% coding: utf-8
+%% End:
%
%\StopEventually{}
%\section{The Code}
%\iffalse
% \begin{macrocode}
-%<*fcnumparser.sty>
-% \end{macrocode}
-%\fi
-%\subsection{fcnumparser.sty}
-% \begin{macrocode}
-\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{fcnumparser}[2012/09/28]
-% \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}
-\ifcsundef{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}
-\ifcsundef{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}
-\ifcsundef{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}
-\ifcsundef{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}
-\ifcsundef{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}
-\ifcsundef{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}
-\ifcsundef{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}
-\ifcsundef{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}
-\ifcsundef{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}[2012/09/28]
-\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}
-\ifcsundef{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}
-\ifcsundef{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
-%\subsection{fmtcount.sty}
-% This section deals with the code for |fmtcount.sty|
-% \begin{macrocode}
-\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{fmtcount}[2014/07/18 v3.00]
-\RequirePackage{ifthen}
-\RequirePackage{keyval}
-\RequirePackage{etoolbox}
-\RequirePackage{fcprefix}
-% \end{macrocode}
-% \changes{3.00}{2014-07-18}{Add \cs{RequirePackage} for \texttt{ifxetex}}
-% \begin{macrocode}
-\RequirePackage{ifxetex}
-% \end{macrocode}
-% \changes{1.3}{2007/7/19}{no
-%longer using xspace package}
-%\changes{1.31}{2009/10/02}{amsgen now loaded (\cs{new@ifnextchar}
-% needed)}
-% Need to use \cs{new@ifnextchar} instead of \cs{@ifnextchar} in
-% commands that have a final optional argument (such as \cs{gls})
-% so require \sty{amsgen}.
-% \begin{macrocode}
-\RequirePackage{amsgen}
-% \end{macrocode}
-% These commands need to be defined before the
-% configuration file is loaded.
-%
-% Define the macro to format the |st|, |nd|, |rd| or |th| of an
-% ordinal.
-%\begin{macro}{\fmtord}
-% \begin{macrocode}
-\providecommand*{\fmtord}[1]{\textsuperscript{#1}}
-% \end{macrocode}
-%\end{macro}
-%\begin{macro}{\padzeroes}
-%\begin{definition}
-%\cs{padzeroes}\oarg{n}
-%\end{definition}
-% Specifies how many digits should be displayed for commands such as
-% \cs{decimal} and \cs{binary}.
-% \begin{macrocode}
-\newcount\c@padzeroesN
-\c@padzeroesN=1\relax
-\providecommand*{\padzeroes}[1][17]{\c@padzeroesN=#1}
-% \end{macrocode}
-%\end{macro}
-%
-%\begin{macro}{\FCloadlang}
-%\changes{2.0}{2012-06-18}{new}
-%\changes{2.02}{2012-10-24}{ensured catcode for @ set to `letter'
-%before loading file}
-%\begin{definition}
-%\cs{FCloadlang}\marg{language}
-%\end{definition}
-% Load \styfmt{fmtcount} language file,
-% \texttt{fc-}\meta{language}\texttt{.def}, unless already loaded.
-% Unfortunately neither \styfmt{babel} nor \styfmt{polyglossia} keep a list of loaded
-% dialects, so we can't load all the necessary def files in the
-% preamble as we don't know which dialects the user requires.
-% Therefore the dialect definitions get loaded when a command such
-% as \cs{ordinalnum} is used, if they
-% haven't already been loaded.
-% \begin{macrocode}
-\newcount\fc@tmpcatcode
-\def\fc@languages{}%
-\def\fc@mainlang{}%
-\newcommand*{\FCloadlang}[1]{%
- \@FC@iflangloaded{#1}{}%
- {%
- \fc@tmpcatcode=\catcode`\@\relax
- \catcode `\@ 11\relax
- \InputIfFileExists{fc-#1.def}%
- {%
- \ifdefempty{\fc@languages}%
- {%
- \gdef\fc@languages{#1}%
- }%
- {%
- \gappto\fc@languages{,#1}%
- }%
- \gdef\fc@mainlang{#1}%
- }%
- {}%
- \catcode `\@ \fc@tmpcatcode\relax
- }%
-}
-% \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}
-%
-% We need that flag to remember that a language has been loaded via package option, so that in the end we can
-% set \styfmt{fmtcount} in multiling
-% \begin{macrocode}
-\newif\iffmtcount@language@option
-\fmtcount@language@optionfalse
-% \end{macrocode}
-%\begin{macro}{\fc@supported@language@list}
-% Declare list of supported languages, as a comma separated list. No space, no empty items. Each item is a
-% language for which fmtcount is able to load language specific definitions. The raison d'\^etre of this
-% list is to commonalize iteration on languages for the two following purposes:
-% \begin{itemize}
-% \item loading language definition as a result of the language being used by
-% \styfmt{babel}/\styfmt{polyglossia}
-% \item loading language definition as a result of package option
-% \end{itemize}
-% These two purposes cannot be handled in the same pass, we need two different passes otherwise there would
-% be some corner cases when a package would be required --- as a result of loading language definition for
-% one language --- between a \cs{DeclareOption} and a \cs{ProcessOption} which is forbidden by \LaTeXe.
-%\changes{3.00}{2014-07-18}{new}
-% \begin{macrocode}
-\newcommand*\fc@supported@language@list{%
-english,%
-UKenglish,%
-british,%
-USenglish,%
-american,%
-spanish,%
-portuges,%
-french,%
-frenchb,%
-francais,%
-german,%
-germanb,%
-ngerman,%
-ngermanb,%
-italian}
-% \end{macrocode}
-%\end{macro}
-%\begin{macro}{\fc@iterate@on@languages}
-%\begin{definition}
-%\cs{fc@iterate@on@languages}\marg{body}
-%\end{definition}
-% Now make some language iterator, note that for the following to work properly
-% \cs{fc@supported@language@list} must not be empty. \meta{body} is a macro that takes one argument, and
-% \cs{fc@iterate@on@languages} applies it iteratively :
-%\changes{3.00}{2014-07-18}{new}
-% \begin{macrocode}
-\newcommand*\fc@iterate@on@languages[1]{%
- \ifx\fc@supported@language@list\@empty
-% \end{macrocode}
-% That case should never happen !
-% \begin{macrocode}
- \PackageError{fmtcount}{Macro `\protect\@fc@iterate@on@languages' is empty}{You should never get here:
- Something is broken within \texttt{fmtcount}, please report the issue on
- \texttt{https://github.com/search?q=fmtcount\&ref=cmdform\&type=Issues}}%
- \else
- \let\fc@iterate@on@languages@body#1
- \expandafter\@fc@iterate@on@languages\fc@supported@language@list,\@nil,%
- \fi
-}
-\def\@fc@iterate@on@languages#1,{%
- {%
- \def\@tempa{#1}%
- \ifx\@tempa\@nnil
- \let\@tempa\@empty
- \else
- \def\@tempa{%
- \fc@iterate@on@languages@body{#1}%
- \@fc@iterate@on@languages
- }%
- \fi
- \expandafter
- }\@tempa
-}%
-% \end{macrocode}
-%\end{macro}
-%\begin{macro}{\@fc@loadifbabelorpolyglossialdf}
-%\begin{definition}
-%\cs{@fc@loadifbabelorpolyglossialdf}\marg{language}
-%\end{definition}
-%Loads fmtcount language file,
-%\texttt{fc-}\meta{language}\texttt{.def},
-% if one of the following condition is met:
-% \begin{itemize}
-% \item \styfmt{babel} language definition file \meta{language}\texttt{.ldf} has been loaded --- conditionally
-% to compilation with \texttt{latex}, not \texttt{xelatex}.
-% \item \styfmt{polyglossia} language definition file \texttt{gloss-}\meta{language}\texttt{.ldf} has been
-% loaded --- conditionally to compilation with \texttt{xelatex}, not \texttt{latex}.
-% \item \meta{language} option has been passed to package \styfmt{fmtcount}.
-% \end{itemize}
-%
-%\changes{2.03}{2012-11-11}{renamed \cs{@fc@loadifbabelldf} to
-% \cs{@fc@loadifbabelorpolyglossialdf}}
-%\changes{2.03}{2012-11-11}{added check for polyglossia language}
-%\changes{3.00}{2014-07-18}{use \cs{ifxetex} to discriminate between \styfmt{babel} and \styfmt{polyglossia}}
-% \begin{macrocode}
-\newcommand*{\@fc@loadifbabelorpolyglossialdf}[1]{%
- \ifxetex
- \IfFileExists{gloss-#1.ldf}{\ifcsundef{#1@loaded}{}{\FCloadlang{#1}}}{}%
- \else
- \ifcsundef{ver@#1.ldf}{}{\FCloadlang{#1}}%
- \fi
-}
-% \end{macrocode}
-%\end{macro}
-%
-% Load appropriate language definition files:
-%\changes{1.1}{14 June 2007}{added check for UKenglish,
-% british and USenglish babel settings}
-%\changes{2.0}{2012-06-18}{changed check for \cs{l@}\meta{language}
-% to check for \cs{date}\meta{language}}
-%\changes{3.00}{2014-07-18}{use iterator rather than doing it flat on each language}
-% \begin{macrocode}
-\fc@iterate@on@languages\@fc@loadifbabelorpolyglossialdf
-% \end{macrocode}
-%\begin{macro}{\fmtcount@french}
-% Define keys for use with |\fmtcountsetoptions|. Key to switch French dialects (Does \styfmt{babel} store
-% this kind of information?)
-% \begin{macrocode}
-\def\fmtcount@french{france}
-% \end{macrocode}
-%\end{macro}
-%\begin{option}{french}
-% \begin{macrocode}
-\define@key{fmtcount}{french}[france]{%
- \@FC@iflangloaded{french}%
- {%
- \setkeys{fcfrench}{#1}%
- }%
- {%
- \PackageError{fmtcount}%
- {Language `french' not defined}%
- {You need to load babel before loading fmtcount}%
- }%
-}
-% \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'}%
- }%
-}
-% \end{macrocode}
-%\end{option}
-%\begin{macro}{\iffmtord@abbrv}
-% Key to determine whether the ordinal should be abbreviated
-% (language dependent, currently only affects French ordinals.)
-% \begin{macrocode}
-\newif\iffmtord@abbrv
-\fmtord@abbrvfalse
-\define@key{fmtcount}{abbrv}[true]{%
- \ifthenelse{\equal{#1}{true}\or\equal{#1}{false}}%
- {%
- \csname fmtord@abbrv#1\endcsname
- }%
- {%
- \PackageError{fmtcount}%
- {Invalid value `#1' to fmtord key}%
- {Option `fmtord' can only take the values `true' or
- `false'}%
- }%
-}
-% \end{macrocode}
-%\end{macro}
-%\begin{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}%
- \@FC@iflangloaded{french}{\ifcsundef{@ordinalstringMfrench}%
- {%
- \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}%
-{%
- \PackageInfo{fmtcount}{Using configuration file fmtcount.cfg}%
-}%
-{%
-}
-% \end{macrocode}
-%\begin{option}{\meta{language}}
-% \begin{macrocode}
-\newcommand*\@fc@declare@language@option[1]{%
- \DeclareOption{#1}{%
- \@FC@iflangloaded{#1}{}{%
- \fmtcount@language@optiontrue
- \FCloadlang{#1}%
- }}}%
-\fc@iterate@on@languages\@fc@declare@language@option
-% \end{macrocode}
-%\end{option}
-%
-%\begin{option}{level}
-% \begin{macrocode}
-\DeclareOption{level}{\def\fmtcount@fmtord{level}%
- \def\fmtord#1{#1}}
-% \end{macrocode}
-%\end{option}
-%\begin{option}{raise}
-% \begin{macrocode}
-\DeclareOption{raise}{\def\fmtcount@fmtord{raise}%
- \def\fmtord#1{\textsuperscript{#1}}}
-% \end{macrocode}
-%\end{option}
-% Process package options
-% \changes{3.00}{2014-07-18}{Add \cs{relax} after \cs{ProcessOptions} like shown in \texttt{clsguide.pdf}}
-% \begin{macrocode}
-\ProcessOptions\relax
-% \end{macrocode}
-%\begin{macro}{\@FCmodulo}
-%\begin{definition}
-%\cs{@FCmodulo}\marg{count reg}\marg{n}
-%\end{definition}
-%\changes{2.04}{2014-06-09}{renamed \cs{@modulo} to \cs{@FCmodulo}}
-% Sets the count register to be its value modulo \meta{n}.
-% This is used for the
-% date, time, ordinal and numberstring commands. (The
-% \styfmt{fmtcount} package was originally part of the
-% \sty{datetime} package.)
-% \begin{macrocode}
-\newcount\@DT@modctr
-\newcommand*{\@FCmodulo}[2]{%
- \@DT@modctr=#1\relax
- \divide \@DT@modctr by #2\relax
- \multiply \@DT@modctr by #2\relax
- \advance #1 by -\@DT@modctr
-}
-% \end{macrocode}
-%\end{macro}
-% The following registers are needed by |\@ordinal| etc
-% \begin{macrocode}
-\newcount\@ordinalctr
-\newcount\@orgargctr
-\newcount\@strctr
-\newcount\@tmpstrctr
-% \end{macrocode}
-%Define commands that display numbers in different bases.
-% Define counters and conditionals needed.
-% \begin{macrocode}
-\newif\if@DT@padzeroes
-\newcount\@DT@loopN
-\newcount\@DT@X
-% \end{macrocode}
-%\begin{macro}{\binarynum}
-% Converts a decimal number to binary, and display.
-% \begin{macrocode}
-\newcommand*{\@binary}[1]{%
- \@DT@padzeroestrue
- \@DT@loopN=17\relax
- \@strctr=\@DT@loopN
- \whiledo{\@strctr<\c@padzeroesN}{0\advance\@strctr by 1}%
- \@strctr=65536\relax
- \@DT@X=#1\relax
- \loop
- \@DT@modctr=\@DT@X
- \divide\@DT@modctr by \@strctr
- \ifthenelse{\boolean{@DT@padzeroes}
- \and \(\@DT@modctr=0\)
- \and \(\@DT@loopN>\c@padzeroesN\)}%
- {}%
- {\the\@DT@modctr}%
- \ifnum\@DT@modctr=0\else\@DT@padzeroesfalse\fi
- \multiply\@DT@modctr by \@strctr
- \advance\@DT@X by -\@DT@modctr
- \divide\@strctr by 2\relax
- \advance\@DT@loopN by -1\relax
- \ifnum\@strctr>1
- \repeat
- \the\@DT@X
-}
-
-\let\binarynum=\@binary
-% \end{macrocode}
-%\end{macro}
-%\begin{macro}{\octalnum}
-% Converts a decimal number to octal, and displays.
-% \begin{macrocode}
-\newcommand*{\@octal}[1]{%
- \ifnum#1>32768
- \PackageError{fmtcount}%
- {Value of counter too large for \protect\@octal}
- {Maximum value 32768}
- \else
- \@DT@padzeroestrue
- \@DT@loopN=6\relax
- \@strctr=\@DT@loopN
- \whiledo{\@strctr<\c@padzeroesN}{0\advance\@strctr by 1}%
- \@strctr=32768\relax
- \@DT@X=#1\relax
- \loop
- \@DT@modctr=\@DT@X
- \divide\@DT@modctr by \@strctr
- \ifthenelse{\boolean{@DT@padzeroes}
- \and \(\@DT@modctr=0\)
- \and \(\@DT@loopN>\c@padzeroesN\)}%
- {}{\the\@DT@modctr}%
- \ifnum\@DT@modctr=0\else\@DT@padzeroesfalse\fi
- \multiply\@DT@modctr by \@strctr
- \advance\@DT@X by -\@DT@modctr
- \divide\@strctr by 8\relax
- \advance\@DT@loopN by -1\relax
- \ifnum\@strctr>1
- \repeat
- \the\@DT@X
- \fi
-}
-\let\octalnum=\@octal
-% \end{macrocode}
-%\end{macro}
-%\begin{macro}{\@@hexadecimalnum}
-% Converts 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]{%
- \@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]{%
- \@DT@padzeroestrue
- \@DT@loopN=5\relax
- \@strctr=\@DT@loopN
- \whiledo{\@strctr<\c@padzeroesN}{0\advance\@strctr by 1}%
- \@strctr=65536\relax
- \@DT@X=#1\relax
- \loop
- \@DT@modctr=\@DT@X
- \divide\@DT@modctr by \@strctr
- \ifthenelse{\boolean{@DT@padzeroes}
- \and \(\@DT@modctr=0\)
- \and \(\@DT@loopN>\c@padzeroesN\)}%
- {}{\@@Hexadecimal\@DT@modctr}%
- \ifnum\@DT@modctr=0\else\@DT@padzeroesfalse\fi
- \multiply\@DT@modctr by \@strctr
- \advance\@DT@X by -\@DT@modctr
- \divide\@strctr by 16\relax
- \advance\@DT@loopN by -1\relax
- \ifnum\@strctr>1
- \repeat
- \@@Hexadecimal\@DT@X
-}
-
-\let\Hexadecimalnum=\@Hexadecimal
-% \end{macrocode}
-%\end{macro}
-%\begin{macro}{\aaalphnum}
-% Lowercase alphabetical representation (a \ldots\ z aa \ldots\ zz)
-% \begin{macrocode}
-\newcommand*{\@aaalph}[1]{%
- \@DT@loopN=#1\relax
- \advance\@DT@loopN by -1\relax
- \divide\@DT@loopN by 26\relax
- \@DT@modctr=\@DT@loopN
- \multiply\@DT@modctr by 26\relax
- \@DT@X=#1\relax
- \advance\@DT@X by -1\relax
- \advance\@DT@X by -\@DT@modctr
- \advance\@DT@loopN by 1\relax
- \advance\@DT@X by 1\relax
- \loop
- \@alph\@DT@X
- \advance\@DT@loopN by -1\relax
- \ifnum\@DT@loopN>0
- \repeat
-}
-
-\let\aaalphnum=\@aaalph
-% \end{macrocode}
-%\end{macro}
-%\begin{macro}{\AAAlphnum}
-% Uppercase alphabetical representation (a \ldots\ z aa \ldots\ zz)
-% \begin{macrocode}
-\newcommand*{\@AAAlph}[1]{%
- \@DT@loopN=#1\relax
- \advance\@DT@loopN by -1\relax
- \divide\@DT@loopN by 26\relax
- \@DT@modctr=\@DT@loopN
- \multiply\@DT@modctr by 26\relax
- \@DT@X=#1\relax
- \advance\@DT@X by -1\relax
- \advance\@DT@X by -\@DT@modctr
- \advance\@DT@loopN by 1\relax
- \advance\@DT@X by 1\relax
- \loop
- \@Alph\@DT@X
- \advance\@DT@loopN by -1\relax
- \ifnum\@DT@loopN>0
- \repeat
-}
-
-\let\AAAlphnum=\@AAAlph
-% \end{macrocode}
-%\end{macro}
-%\begin{macro}{\abalphnum}
-% Lowercase alphabetical representation
-% \begin{macrocode}
-\newcommand*{\@abalph}[1]{%
- \ifnum#1>17576\relax
- \PackageError{fmtcount}%
- {Value of counter too large for \protect\@abalph}%
- {Maximum value 17576}%
- \else
- \@DT@padzeroestrue
- \@strctr=17576\relax
- \@DT@X=#1\relax
- \advance\@DT@X by -1\relax
- \loop
- \@DT@modctr=\@DT@X
- \divide\@DT@modctr by \@strctr
- \ifthenelse{\boolean{@DT@padzeroes}
- \and \(\@DT@modctr=1\)}%
- {}{\@alph\@DT@modctr}%
- \ifnum\@DT@modctr=1\else\@DT@padzeroesfalse\fi
- \multiply\@DT@modctr by \@strctr
- \advance\@DT@X by -\@DT@modctr
- \divide\@strctr by 26\relax
- \ifnum\@strctr>1
- \repeat
- \advance\@DT@X by 1\relax
- \@alph\@DT@X
- \fi
-}
-
-\let\abalphnum=\@abalph
-% \end{macrocode}
-%\end{macro}
-%\begin{macro}{\ABAlphnum}
-% Uppercase alphabetical representation
-% \begin{macrocode}
-\newcommand*{\@ABAlph}[1]{%
- \ifnum#1>17576\relax
- \PackageError{fmtcount}%
- {Value of counter too large for \protect\@ABAlph}%
- {Maximum value 17576}%
- \else
- \@DT@padzeroestrue
- \@strctr=17576\relax
- \@DT@X=#1\relax
- \advance\@DT@X by -1\relax
- \loop
- \@DT@modctr=\@DT@X
- \divide\@DT@modctr by \@strctr
- \ifthenelse{\boolean{@DT@padzeroes}\and
- \(\@DT@modctr=1\)}{}{\@Alph\@DT@modctr}%
- \ifnum\@DT@modctr=1\else\@DT@padzeroesfalse\fi
- \multiply\@DT@modctr by \@strctr
- \advance\@DT@X by -\@DT@modctr
- \divide\@strctr by 26\relax
- \ifnum\@strctr>1
- \repeat
- \advance\@DT@X by 1\relax
- \@Alph\@DT@X
- \fi
-}
-
-\let\ABAlphnum=\@ABAlph
-% \end{macrocode}
-%\end{macro}
-%\begin{macro}{\@fmtc@count}
-% Recursive command to count number of characters in argument.
-% \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
-}
-% \end{macrocode}
-%\end{macro}
-%\begin{macro}{\@decimal}
-%\changes{1.31}{2009/10/02}{fixed unwanted space.}
-% Format number as a decimal, possibly padded with zeroes in front.
-% \begin{macrocode}
-\newcommand{\@decimal}[1]{%
- \@strctr=0\relax
- \expandafter\@fmtc@count\number#1\relax
- \@DT@loopN=\c@padzeroesN
- \advance\@DT@loopN by -\@strctr
- \ifnum\@DT@loopN>0\relax
- \@strctr=0\relax
- \whiledo{\@strctr < \@DT@loopN}{0\advance\@strctr by 1\relax}%
- \fi
- \number#1\relax
-}
-
-\let\decimalnum=\@decimal
-% \end{macrocode}
-%\end{macro}
-%\begin{macro}{\FCordinal}
-%\begin{definition}
-%\cs{FCordinal}\marg{number}
-%\end{definition}
-% This is a bit cumbersome. Previously \cs{@ordinal}
-% was defined in a similar way to \cs{abalph} etc.
-% This ensured that the actual value of the counter was
-% written in the new label stuff in the .aux file. However
-% adding in an optional argument to determine the gender
-% for multilingual compatibility messed things up somewhat.
-% This was the only work around I could get to keep the
-% the cross-referencing stuff working, which is why
-% the optional argument comes \emph{after} the compulsory
-% argument, instead of the usual manner of placing it before.
-% Note however, that putting the optional argument means that
-% any spaces will be ignored after the command if the optional
-% argument is omitted.
-% Version 1.04 changed \cs{ordinal} to \cs{FCordinal}
-% to prevent it clashing with the memoir class.
-% \begin{macrocode}
-\newcommand{\FCordinal}[1]{%
- \expandafter\protect\expandafter\ordinalnum{%
- \expandafter\the\csname c@#1\endcsname}%
-}
-% \end{macrocode}
-%\end{macro}
-%\begin{macro}{\ordinal}
-% If \cs{ordinal} isn't defined make \cs{ordinal} a synonym
-% for \cs{FCordinal} to maintain compatibility with previous
-% versions.
-% \changes{3.00}{2014-07-18}{Use \cs{protect}, not \cs{string} in \cs{PackageWarning} to quote macros like
-% shown in \texttt{clsguide.pdf}}
-% \begin{macrocode}
-\ifcsundef{ordinal}
- {\let\ordinal\FCordinal}%
- {%
- \PackageWarning{fmtcount}%
- {\protect\ordinal \space already defined use
- \protect\FCordinal \space instead.}
- }
-% \end{macrocode}
-%\end{macro}
-%\begin{macro}{\ordinalnum}
-% Display ordinal where value is given as a number or
-% count register instead of a counter:
-%\changes{1.31}{2009/10/02}{replaced \cs{@ifnextchar} with
-%\cs{new@ifnextchar}}
-% \begin{macrocode}
-\newcommand*{\ordinalnum}[1]{%
- \new@ifnextchar[%
- {\@ordinalnum{#1}}%
- {\@ordinalnum{#1}[m]}%
-}
-% \end{macrocode}
-%\end{macro}
-%\begin{macro}{\@ordinalnum}
-% Display ordinal according to gender (neuter added in v1.1,
-% \cs{xspace} added in v1.2, and removed in v1.3\footnote{I
-%couldn't get it to work consistently both with and without the
-%optional argument}):
-% \begin{macrocode}
-\def\@ordinalnum#1[#2]{%
- {%
- \ifthenelse{\equal{#2}{f}}%
- {%
- \protect\@ordinalF{#1}{\@fc@ordstr}%
- }%
- {%
- \ifthenelse{\equal{#2}{n}}%
- {%
- \protect\@ordinalN{#1}{\@fc@ordstr}%
- }%
- {%
- \ifthenelse{\equal{#2}{m}}%
- {}%
- {%
- \PackageError{fmtcount}%
- {Invalid gender option `#2'}%
- {Available options are m, f or n}%
- }%
- \protect\@ordinalM{#1}{\@fc@ordstr}%
- }%
- }%
- \@fc@ordstr
- }%
-}
-% \end{macrocode}
-%\end{macro}
-%\begin{macro}{\storeordinal}
-% Store the ordinal (first argument
-% is identifying name, second argument is a counter.)
-% \begin{macrocode}
-\newcommand*{\storeordinal}[2]{%
- \expandafter\protect\expandafter\storeordinalnum{#1}{%
- \expandafter\the\csname c@#2\endcsname}%
-}
-% \end{macrocode}
-%\end{macro}
-%\begin{macro}{\storeordinalnum}
-% Store ordinal (first argument
-% is identifying name, second argument is a number or
-% count register.)
-% \begin{macrocode}
-\newcommand*{\storeordinalnum}[2]{%
- \@ifnextchar[%
- {\@storeordinalnum{#1}{#2}}%
- {\@storeordinalnum{#1}{#2}[m]}%
-}
-% \end{macrocode}
-%\end{macro}
-%\begin{macro}{\@storeordinalnum}
-% Store ordinal according to gender:
-% \begin{macrocode}
-\def\@storeordinalnum#1#2[#3]{%
- \ifthenelse{\equal{#3}{f}}%
- {%
- \protect\@ordinalF{#2}{\@fc@ord}
- }%
- {%
- \ifthenelse{\equal{#3}{n}}%
- {%
- \protect\@ordinalN{#2}{\@fc@ord}%
- }%
- {%
- \ifthenelse{\equal{#3}{m}}%
- {}%
- {%
- \PackageError{fmtcount}%
- {Invalid gender option `#3'}%
- {Available options are m or f}%
- }%
- \protect\@ordinalM{#2}{\@fc@ord}%
- }%
- }%
- \expandafter\let\csname @fcs@#1\endcsname\@fc@ord
-}
-% \end{macrocode}
-%\end{macro}
-%\begin{macro}{\FMCuse}
-% Get stored information:
-% \begin{macrocode}
-\newcommand*{\FMCuse}[1]{\csname @fcs@#1\endcsname}
-% \end{macrocode}
-%\end{macro}
-%\begin{macro}{\ordinalstring}
-% Display ordinal as a string (argument is a counter)
-% \begin{macrocode}
-\newcommand*{\ordinalstring}[1]{%
- \expandafter\protect\expandafter\ordinalstringnum{%
- \expandafter\the\csname c@#1\endcsname}%
-}
-% \end{macrocode}
-%\end{macro}
-%\begin{macro}{\ordinalstringnum}
-% Display ordinal as a string (argument is a count register or
-% number.)
-%\changes{1.31}{2009/10/02}{replaced \cs{@ifnextchar} with
-%\cs{new@ifnextchar}}
-%\changes{1.33}{2009/10/15}{Made robust}
-% \begin{macrocode}
-\newcommand{\ordinalstringnum}[1]{%
- \new@ifnextchar[%
- {\@ordinal@string{#1}}%
- {\@ordinal@string{#1}[m]}%
-}
-% \end{macrocode}
-%\end{macro}
-%\begin{macro}{\@ordinal@string}
-% Display ordinal as a string according to gender.
-% \changes{3.00}{2014-07-18}{Use \cs{protect}, not \cs{string} in \cs{PackageError} to quote macros like
-% shown in \texttt{clsguide.pdf}}
-% \changes{3.00}{2014-07-18}{Correct detailed error message, so `n' is one of available gender options}
-% \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 \protect\ordinalstring}%
- {Available options are m, f or n}%
- }%
- \protect\@ordinalstringM{#1}{\@fc@ordstr}%
- }%
- }%
- \@fc@ordstr
- }%
-}
-% \end{macrocode}
-%\end{macro}
-%\begin{macro}{\storeordinalstring}
-% Store textual representation of number. First argument is
-% identifying name, second argument is the counter set to the
-% required number.
-% \begin{macrocode}
-\newcommand*{\storeordinalstring}[2]{%
- \expandafter\protect\expandafter\storeordinalstringnum{#1}{%
- \expandafter\the\csname c@#2\endcsname}%
-}
-% \end{macrocode}
-%\end{macro}
-%\begin{macro}{\storeordinalstringnum}
-% Store textual representation of number. First argument is
-% identifying name, second argument is a count register or number.
-% \begin{macrocode}
-\newcommand*{\storeordinalstringnum}[2]{%
- \@ifnextchar[%
- {\@store@ordinal@string{#1}{#2}}%
- {\@store@ordinal@string{#1}{#2}[m]}%
-}
-% \end{macrocode}
-%\end{macro}
-%\begin{macro}{\@store@ordinal@string}
-% Store textual representation of number according to gender.
-% \changes{3.00}{2014-07-18}{Use \cs{protect}, not \cs{string} in \cs{PackageWarning} to quote macros like
-% shown in \texttt{clsguide.pdf}}
-% \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 \protect\ordinalstring}%
- {Available options are m, f or n}%
- }%
- \protect\@ordinalstringM{#2}{\@fc@ordstr}%
- }%
- }%
- \expandafter\let\csname @fcs@#1\endcsname\@fc@ordstr
-}
-% \end{macrocode}
-%\end{macro}
-%\begin{macro}{\Ordinalstring}
-% Display ordinal as a string with initial letters in upper case
-% (argument is a counter)
-% \begin{macrocode}
-\newcommand*{\Ordinalstring}[1]{%
- \expandafter\protect\expandafter\Ordinalstringnum{%
- \expandafter\the\csname c@#1\endcsname}%
-}
-% \end{macrocode}
-%\end{macro}
-%\begin{macro}{\Ordinalstringnum}
-% Display ordinal as a string with initial letters in upper case
-% (argument is a number or count register)
-%\changes{1.31}{2009/10/02}{replaced \cs{@ifnextchar} with
-%\cs{new@ifnextchar}}
-% \begin{macrocode}
-\newcommand*{\Ordinalstringnum}[1]{%
- \new@ifnextchar[%
- {\@Ordinal@string{#1}}%
- {\@Ordinal@string{#1}[m]}%
-}
-% \end{macrocode}
-%\end{macro}
-%\begin{macro}{\@Ordinal@string}
-% Display ordinal as a string with initial letters in upper case
-% according to gender
-% \begin{macrocode}
-\def\@Ordinal@string#1[#2]{%
- {%
- \ifthenelse{\equal{#2}{f}}%
- {%
- \protect\@OrdinalstringF{#1}{\@fc@ordstr}%
- }%
- {%
- \ifthenelse{\equal{#2}{n}}%
- {%
- \protect\@OrdinalstringN{#1}{\@fc@ordstr}%
- }%
- {%
- \ifthenelse{\equal{#2}{m}}%
- {}%
- {%
- \PackageError{fmtcount}%
- {Invalid gender option `#2'}%
- {Available options are m, f or n}%
- }%
- \protect\@OrdinalstringM{#1}{\@fc@ordstr}%
- }%
- }%
- \@fc@ordstr
- }%
-}
-% \end{macrocode}
-%\end{macro}
-%\begin{macro}{\storeOrdinalstring}
-% Store textual representation of number, with initial letters in
-% upper case. First argument is identifying name, second argument
-% is the counter set to the
-% required number.
-% \begin{macrocode}
-\newcommand*{\storeOrdinalstring}[2]{%
- \expandafter\protect\expandafter\storeOrdinalstringnum{#1}{%
- \expandafter\the\csname c@#2\endcsname}%
-}
-% \end{macrocode}
-%\end{macro}
-%\begin{macro}{\storeOrdinalstringnum}
-% Store textual representation of number, with initial letters in
-% upper case. First argument is identifying name, second argument
-% is a count register or number.
-% \begin{macrocode}
-\newcommand*{\storeOrdinalstringnum}[2]{%
- \@ifnextchar[%
- {\@store@Ordinal@string{#1}{#2}}%
- {\@store@Ordinal@string{#1}{#2}[m]}%
-}
-% \end{macrocode}
-%\end{macro}
-%\begin{macro}{\@store@Ordinal@string}
-% Store textual representation of number according to gender,
-% with initial letters in upper case.
-% \begin{macrocode}
-\def\@store@Ordinal@string#1#2[#3]{%
- \ifthenelse{\equal{#3}{f}}%
- {%
- \protect\@OrdinalstringF{#2}{\@fc@ordstr}%
- }%
- {%
- \ifthenelse{\equal{#3}{n}}%
- {%
- \protect\@OrdinalstringN{#2}{\@fc@ordstr}%
- }%
- {%
- \ifthenelse{\equal{#3}{m}}%
- {}%
- {%
- \PackageError{fmtcount}%
- {Invalid gender option `#3'}%
- {Available options are m or f}%
- }%
- \protect\@OrdinalstringM{#2}{\@fc@ordstr}%
- }%
- }%
- \expandafter\let\csname @fcs@#1\endcsname\@fc@ordstr
-}
-% \end{macrocode}
-%\end{macro}
-%
-%\begin{macro}{\storeORDINALstring}
-% Store upper case textual representation of ordinal. The first
-% argument is identifying name, the second argument is a counter.
-% \begin{macrocode}
-\newcommand*{\storeORDINALstring}[2]{%
- \expandafter\protect\expandafter\storeORDINALstringnum{#1}{%
- \expandafter\the\csname c@#2\endcsname}%
-}
-% \end{macrocode}
-%\end{macro}
-%\begin{macro}{\storeORDINALstringnum}
-% As above, but the second argument is a count register or a
-% number.
-% \begin{macrocode}
-\newcommand*{\storeORDINALstringnum}[2]{%
- \@ifnextchar[%
- {\@store@ORDINAL@string{#1}{#2}}%
- {\@store@ORDINAL@string{#1}{#2}[m]}%
-}
-% \end{macrocode}
-%\end{macro}
-%\begin{macro}{\@store@ORDINAL@string}
-% Gender is specified as an optional argument at the end.
-% \begin{macrocode}
-\def\@store@ORDINAL@string#1#2[#3]{%
- \ifthenelse{\equal{#3}{f}}%
- {%
- \protect\@ordinalstringF{#2}{\@fc@ordstr}%
- }%
- {%
- \ifthenelse{\equal{#3}{n}}%
- {%
- \protect\@ordinalstringN{#2}{\@fc@ordstr}%
- }%
- {%
- \ifthenelse{\equal{#3}{m}}%
- {}%
- {%
- \PackageError{fmtcount}%
- {Invalid gender option `#3'}%
- {Available options are m or f}%
- }%
- \protect\@ordinalstringM{#2}{\@fc@ordstr}%
- }%
- }%
- \expandafter\edef\csname @fcs@#1\endcsname{%
- \noexpand\MakeUppercase{\@fc@ordstr}%
- }%
-}
-% \end{macrocode}
-%\end{macro}
-%\begin{macro}{\ORDINALstring}
-% Display upper case textual representation of an ordinal. The
-% argument must be a counter.
-% \begin{macrocode}
-\newcommand*{\ORDINALstring}[1]{%
- \expandafter\protect\expandafter\ORDINALstringnum{%
- \expandafter\the\csname c@#1\endcsname
- }%
-}
-% \end{macrocode}
-%\end{macro}
-%\begin{macro}{\ORDINALstringnum}
-% As above, but the argument is a count register or a number.
-%\changes{1.31}{2009/10/02}{replaced \cs{@ifnextchar} with
-%\cs{new@ifnextchar}}
-% \begin{macrocode}
-\newcommand*{\ORDINALstringnum}[1]{%
- \new@ifnextchar[%
- {\@ORDINAL@string{#1}}%
- {\@ORDINAL@string{#1}[m]}%
-}
-% \end{macrocode}
-%\end{macro}
-%\begin{macro}{\@ORDINAL@string}
-% Gender is specified as an optional argument at the end.
-% \begin{macrocode}
-\def\@ORDINAL@string#1[#2]{%
- {%
- \ifthenelse{\equal{#2}{f}}%
- {%
- \protect\@ordinalstringF{#1}{\@fc@ordstr}%
- }%
- {%
- \ifthenelse{\equal{#2}{n}}%
- {%
- \protect\@ordinalstringN{#1}{\@fc@ordstr}%
- }%
- {%
- \ifthenelse{\equal{#2}{m}}%
- {}%
- {%
- \PackageError{fmtcount}%
- {Invalid gender option `#2'}%
- {Available options are m, f or n}%
- }%
- \protect\@ordinalstringM{#1}{\@fc@ordstr}%
- }%
- }%
- \MakeUppercase{\@fc@ordstr}%
- }%
-}
-% \end{macrocode}
-%\end{macro}
-%\begin{macro}{\storenumberstring}
-% Convert number to textual respresentation, and store. First
-% argument is the identifying name, second argument is a counter
-% containing the number.
-% \begin{macrocode}
-\newcommand*{\storenumberstring}[2]{%
- \expandafter\protect\expandafter\storenumberstringnum{#1}{%
- \expandafter\the\csname c@#2\endcsname}%
-}
-% \end{macrocode}
-%\end{macro}
-%\begin{macro}{\storenumberstringnum}
-% As above, but second argument is a number or count register.
-% \begin{macrocode}
-\newcommand{\storenumberstringnum}[2]{%
- \@ifnextchar[%
- {\@store@number@string{#1}{#2}}%
- {\@store@number@string{#1}{#2}[m]}%
-}
-% \end{macrocode}
-%\end{macro}
-%\begin{macro}{\@store@number@string}
-% Gender is given as optional argument, \emph{at the end}.
-% \begin{macrocode}
-\def\@store@number@string#1#2[#3]{%
- \ifthenelse{\equal{#3}{f}}%
- {%
- \protect\@numberstringF{#2}{\@fc@numstr}%
- }%
- {%
- \ifthenelse{\equal{#3}{n}}%
- {%
- \protect\@numberstringN{#2}{\@fc@numstr}%
- }%
- {%
- \ifthenelse{\equal{#3}{m}}%
- {}%
- {%
- \PackageError{fmtcount}
- {Invalid gender option `#3'}%
- {Available options are m, f or n}%
- }%
- \protect\@numberstringM{#2}{\@fc@numstr}%
- }%
- }%
- \expandafter\let\csname @fcs@#1\endcsname\@fc@numstr
-}
-% \end{macrocode}
-%\end{macro}
-%\begin{macro}{\numberstring}
-% Display textual representation of a number. The argument
-% must be a counter.
-% \begin{macrocode}
-\newcommand*{\numberstring}[1]{%
- \expandafter\protect\expandafter\numberstringnum{%
- \expandafter\the\csname c@#1\endcsname}%
-}
-% \end{macrocode}
-%\end{macro}
-%\begin{macro}{\numberstringnum}
-% As above, but the argument is a count register or a number.
-%\changes{1.31}{2009/10/02}{replaced \cs{@ifnextchar} with
-%\cs{new@ifnextchar}}
-% \begin{macrocode}
-\newcommand*{\numberstringnum}[1]{%
- \new@ifnextchar[%
- {\@number@string{#1}}%
- {\@number@string{#1}[m]}%
-}
-% \end{macrocode}
-%\end{macro}
-%
-%\begin{macro}{\@number@string}
-% Gender is specified as an optional argument \emph{at the end}.
-% \begin{macrocode}
-\def\@number@string#1[#2]{%
- {%
- \ifthenelse{\equal{#2}{f}}%
- {%
- \protect\@numberstringF{#1}{\@fc@numstr}%
- }%
- {%
- \ifthenelse{\equal{#2}{n}}%
- {%
- \protect\@numberstringN{#1}{\@fc@numstr}%
- }%
- {%
- \ifthenelse{\equal{#2}{m}}%
- {}%
- {%
- \PackageError{fmtcount}%
- {Invalid gender option `#2'}%
- {Available options are m, f or n}%
- }%
- \protect\@numberstringM{#1}{\@fc@numstr}%
- }%
- }%
- \@fc@numstr
- }%
-}
-% \end{macrocode}
-%\end{macro}
-%\begin{macro}{\storeNumberstring}
-% Store textual representation of number. First argument is
-% identifying name, second argument is a counter.
-% \begin{macrocode}
-\newcommand*{\storeNumberstring}[2]{%
- \expandafter\protect\expandafter\storeNumberstringnum{#1}{%
- \expandafter\the\csname c@#2\endcsname}%
-}
-% \end{macrocode}
-%\end{macro}
-%\begin{macro}{\storeNumberstringnum}
-% As above, but second argument is a count register or number.
-% \begin{macrocode}
-\newcommand{\storeNumberstringnum}[2]{%
- \@ifnextchar[%
- {\@store@Number@string{#1}{#2}}%
- {\@store@Number@string{#1}{#2}[m]}%
-}
-% \end{macrocode}
-%\end{macro}
-%\begin{macro}{\@store@Number@string}
-% Gender is specified as an optional argument \emph{at the end}:
-% \begin{macrocode}
-\def\@store@Number@string#1#2[#3]{%
- \ifthenelse{\equal{#3}{f}}%
- {%
- \protect\@NumberstringF{#2}{\@fc@numstr}%
- }%
- {%
- \ifthenelse{\equal{#3}{n}}%
- {%
- \protect\@NumberstringN{#2}{\@fc@numstr}%
- }%
- {%
- \ifthenelse{\equal{#3}{m}}%
- {}%
- {%
- \PackageError{fmtcount}%
- {Invalid gender option `#3'}%
- {Available options are m, f or n}%
- }%
- \protect\@NumberstringM{#2}{\@fc@numstr}%
- }%
- }%
- \expandafter\let\csname @fcs@#1\endcsname\@fc@numstr
-}
-% \end{macrocode}
-%\end{macro}
-%\begin{macro}{\Numberstring}
-% Display textual representation of number. The argument must be
-% a counter.
-% \begin{macrocode}
-\newcommand*{\Numberstring}[1]{%
- \expandafter\protect\expandafter\Numberstringnum{%
- \expandafter\the\csname c@#1\endcsname}%
-}
-% \end{macrocode}
-%\end{macro}
-%\begin{macro}{\Numberstringnum}
-% As above, but the argument is a count register or number.
-%\changes{1.31}{2009/10/02}{replaced \cs{@ifnextchar} with
-%\cs{new@ifnextchar}}
-% \begin{macrocode}
-\newcommand*{\Numberstringnum}[1]{%
- \new@ifnextchar[%
- {\@Number@string{#1}}%
- {\@Number@string{#1}[m]}%
-}
-% \end{macrocode}
-%\end{macro}
-%\begin{macro}{\@Number@string}
-% Gender is specified as an optional argument at the end.
-% \begin{macrocode}
-\def\@Number@string#1[#2]{%
- {%
- \ifthenelse{\equal{#2}{f}}%
- {%
- \protect\@NumberstringF{#1}{\@fc@numstr}%
- }%
- {%
- \ifthenelse{\equal{#2}{n}}%
- {%
- \protect\@NumberstringN{#1}{\@fc@numstr}%
- }%
- {%
- \ifthenelse{\equal{#2}{m}}%
- {}%
- {%
- \PackageError{fmtcount}%
- {Invalid gender option `#2'}%
- {Available options are m, f or n}%
- }%
- \protect\@NumberstringM{#1}{\@fc@numstr}%
- }%
- }%
- \@fc@numstr
- }%
-}
-% \end{macrocode}
-%\end{macro}
-%\begin{macro}{\storeNUMBERstring}
-% Store upper case textual representation of number. The first
-% argument is identifying name, the second argument is a counter.
-% \begin{macrocode}
-\newcommand{\storeNUMBERstring}[2]{%
- \expandafter\protect\expandafter\storeNUMBERstringnum{#1}{%
- \expandafter\the\csname c@#2\endcsname}%
-}
-% \end{macrocode}
-%\end{macro}
-%\begin{macro}{\storeNUMBERstringnum}
-% As above, but the second argument is a count register or a
-% number.
-% \begin{macrocode}
-\newcommand{\storeNUMBERstringnum}[2]{%
- \@ifnextchar[%
- {\@store@NUMBER@string{#1}{#2}}%
- {\@store@NUMBER@string{#1}{#2}[m]}%
-}
-% \end{macrocode}
-%\end{macro}
-%\begin{macro}{\@store@NUMBER@string}
-% Gender is specified as an optional argument at the end.
-% \begin{macrocode}
-\def\@store@NUMBER@string#1#2[#3]{%
- \ifthenelse{\equal{#3}{f}}%
- {%
- \protect\@numberstringF{#2}{\@fc@numstr}%
- }%
- {%
- \ifthenelse{\equal{#3}{n}}%
- {%
- \protect\@numberstringN{#2}{\@fc@numstr}%
- }%
- {%
- \ifthenelse{\equal{#3}{m}}%
- {}%
- {%
- \PackageError{fmtcount}%
- {Invalid gender option `#3'}%
- {Available options are m or f}%
- }%
- \protect\@numberstringM{#2}{\@fc@numstr}%
- }%
- }%
- \expandafter\edef\csname @fcs@#1\endcsname{%
- \noexpand\MakeUppercase{\@fc@numstr}%
- }%
-}
-% \end{macrocode}
-%\end{macro}
-%\begin{macro}{\NUMBERstring}
-% Display upper case textual representation of a number. The
-% argument must be a counter.
-% \begin{macrocode}
-\newcommand*{\NUMBERstring}[1]{%
- \expandafter\protect\expandafter\NUMBERstringnum{%
- \expandafter\the\csname c@#1\endcsname}%
-}
-% \end{macrocode}
-%\end{macro}
-%\begin{macro}{\NUMBERstringnum}
-% As above, but the argument is a count register or a number.
-%\changes{1.31}{2009/10/02}{replaced \cs{@ifnextchar} with
-%\cs{new@ifnextchar}}
-% \begin{macrocode}
-\newcommand*{\NUMBERstringnum}[1]{%
- \new@ifnextchar[%
- {\@NUMBER@string{#1}}%
- {\@NUMBER@string{#1}[m]}%
-}
-% \end{macrocode}
-%\end{macro}
-%\begin{macro}{\@NUMBER@string}
-% Gender is specified as an optional argument at the end.
-% \begin{macrocode}
-\def\@NUMBER@string#1[#2]{%
- {%
- \ifthenelse{\equal{#2}{f}}%
- {%
- \protect\@numberstringF{#1}{\@fc@numstr}%
- }%
- {%
- \ifthenelse{\equal{#2}{n}}%
- {%
- \protect\@numberstringN{#1}{\@fc@numstr}%
- }%
- {%
- \ifthenelse{\equal{#2}{m}}%
- {}%
- {%
- \PackageError{fmtcount}%
- {Invalid gender option `#2'}%
- {Available options are m, f or n}%
- }%
- \protect\@numberstringM{#1}{\@fc@numstr}%
- }%
- }%
- \MakeUppercase{\@fc@numstr}%
- }%
-}
-% \end{macrocode}
-%\end{macro}
-%\begin{macro}{\binary}
-% Number representations in other bases. Binary:
-% \begin{macrocode}
-\providecommand*{\binary}[1]{%
- \expandafter\protect\expandafter\@binary{%
- \expandafter\the\csname c@#1\endcsname}%
-}
-% \end{macrocode}
-%\end{macro}
-%\begin{macro}{\aaalph}
-% Like \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}%
-}
-% \end{macrocode}
-%\end{macro}
-%\begin{macro}{\AAAlph}
-% As before, but upper case.
-% \begin{macrocode}
-\providecommand*{\AAAlph}[1]{%
- \expandafter\protect\expandafter\@AAAlph{%
- \expandafter\the\csname c@#1\endcsname}%
-}
-% \end{macrocode}
-%\end{macro}
-%\begin{macro}{\abalph}
-% Like \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}%
-}
-% \end{macrocode}
-%\end{macro}
-%\begin{macro}{\ABAlph}
-% As above, but upper case.
-% \begin{macrocode}
-\providecommand*{\ABAlph}[1]{%
- \expandafter\protect\expandafter\@ABAlph{%
- \expandafter\the\csname c@#1\endcsname}%
-}
-% \end{macrocode}
-%\end{macro}
-%\begin{macro}{\hexadecimal}
-% Hexadecimal:
-% \begin{macrocode}
-\providecommand*{\hexadecimal}[1]{%
- \expandafter\protect\expandafter\@hexadecimal{%
- \expandafter\the\csname c@#1\endcsname}%
-}
-% \end{macrocode}
-%\end{macro}
-%\begin{macro}{\Hexadecimal}
-% As above, but in upper case.
-% \begin{macrocode}
-\providecommand*{\Hexadecimal}[1]{%
- \expandafter\protect\expandafter\@Hexadecimal{%
- \expandafter\the\csname c@#1\endcsname}%
-}
-% \end{macrocode}
-%\end{macro}
-%\begin{macro}{\octal}
-% Octal:
-% \begin{macrocode}
-\providecommand*{\octal}[1]{%
- \expandafter\protect\expandafter\@octal{%
- \expandafter\the\csname c@#1\endcsname}%
-}
-% \end{macrocode}
-%\end{macro}
-%\begin{macro}{\decimal}
-% Decimal:
-% \begin{macrocode}
-\providecommand*{\decimal}[1]{%
- \expandafter\protect\expandafter\@decimal{%
- \expandafter\the\csname c@#1\endcsname}%
-}
-% \end{macrocode}
-%\end{macro}
-%
-%\subsection{Multilinguage Definitions}
-%\begin{macro}{\@setdef@ultfmtcount}
-% If multilingual support is provided, make \cs{@numberstring}
-% etc use the correct language (if defined).
-% Otherwise use English definitions. \cs{@setdef@ultfmtcount}
-% sets the macros to use English.
-% \begin{macrocode}
-\def\@setdef@ultfmtcount{%
- \ifcsundef{@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}{\fc@multiling}
-%\changes{2.02}{2012-10-24}{new}
-%\cs{fc@multiling}\marg{name}\marg{gender}
-%\changes{3.00}{2014-07-18}{Use \cs{protect}, not \cs{string} in \cs{PackageWarning} to quote macros like
-% shown in \texttt{clsguide.pdf}}
-% \begin{macrocode}
-\newcommand*{\fc@multiling}[2]{%
- \ifcsundef{@#1#2\languagename}%
- {% try loading it
- \FCloadlang{\languagename}%
- }%
- {%
- }%
- \ifcsundef{@#1#2\languagename}%
- {%
- \PackageWarning{fmtcount}%
- {No support for \expandafter\protect\csname #1\endcsname\space for
- language '\languagename'}%
- \ifthenelse{\equal{\languagename}{\fc@mainlang}}%
- {%
- \FCloadlang{english}%
- }%
- {%
- }%
- \ifcsdef{@#1#2\fc@mainlang}%
- {%
- \csuse{@#1#2\fc@mainlang}%
- }%
- {%
- \PackageWarningNoLine{fmtcount}%
- {No languages loaded at all! Loading english definitions}%
- \FCloadlang{english}%
- \def\fc@mainlang{english}%
- \csuse{@#1#2english}%
- }%
- }%
- {%
- \csuse{@#1#2\languagename}%
- }%
-}
-% \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{%
- \fc@multiling{numberstring}{M}%
- }%
-% \end{macrocode}
-% The feminine version of \cs{numberstring}:
-% \begin{macrocode}
- \def\@numberstringF{%
- \fc@multiling{numberstring}{F}%
- }%
-% \end{macrocode}
-% The neuter version of \cs{numberstring}:
-% \begin{macrocode}
- \def\@numberstringN{%
- \fc@multiling{numberstring}{N}%
- }%
-% \end{macrocode}
-% The masculine version of \cs{Numberstring}:
-% \begin{macrocode}
- \def\@NumberstringM{%
- \fc@multiling{Numberstring}{M}%
- }%
-% \end{macrocode}
-% The feminine version of \cs{Numberstring}:
-% \begin{macrocode}
- \def\@NumberstringF{%
- \fc@multiling{Numberstring}{F}%
- }%
-% \end{macrocode}
-% The neuter version of \cs{Numberstring}:
-% \begin{macrocode}
- \def\@NumberstringN{%
- \fc@multiling{Numberstring}{N}%
- }%
-% \end{macrocode}
-% The masculine version of \cs{ordinal}:
-% \begin{macrocode}
- \def\@ordinalM{%
- \fc@multiling{ordinal}{M}%
- }%
-% \end{macrocode}
-% The feminine version of \cs{ordinal}:
-% \begin{macrocode}
- \def\@ordinalF{%
- \fc@multiling{ordinal}{F}%
- }%
-% \end{macrocode}
-% The neuter version of \cs{ordinal}:
-% \begin{macrocode}
- \def\@ordinalN{%
- \fc@multiling{ordinal}{N}%
- }%
-% \end{macrocode}
-% The masculine version of \cs{ordinalstring}:
-% \begin{macrocode}
- \def\@ordinalstringM{%
- \fc@multiling{ordinalstring}{M}%
- }%
-% \end{macrocode}
-% The feminine version of \cs{ordinalstring}:
-% \begin{macrocode}
- \def\@ordinalstringF{%
- \fc@multiling{ordinalstring}{F}%
- }%
-% \end{macrocode}
-% The neuter version of \cs{ordinalstring}:
-% \begin{macrocode}
- \def\@ordinalstringN{%
- \fc@multiling{ordinalstring}{N}%
- }%
-% \end{macrocode}
-% The masculine version of \cs{Ordinalstring}:
-% \begin{macrocode}
- \def\@OrdinalstringM{%
- \fc@multiling{Ordinalstring}{M}%
- }%
-% \end{macrocode}
-% The feminine version of \cs{Ordinalstring}:
-% \begin{macrocode}
- \def\@OrdinalstringF{%
- \fc@multiling{Ordinalstring}{F}%
- }%
-% \end{macrocode}
-% The neuter version of \cs{Ordinalstring}:
-% \begin{macrocode}
- \def\@OrdinalstringN{%
- \fc@multiling{Ordinalstring}{N}%
- }%
-}
-% \end{macrocode}
-%\end{macro}
-% Check to see if \styfmt{babel}, \styfmt{polyglossia} or \styfmt{ngerman} packages have been loaded, and if
-% yes set \styfmt{fmtcount} in multiling.
-% \begin{macrocode}
-\expandafter\@ifpackageloaded
-\expandafter{\ifxetex polyglossia\else babel\fi}%
-{%
- \@set@mulitling@fmtcount
-}%
-{%
- \@ifpackageloaded{ngerman}%
- {%
- \FCloadlang{ngerman}%
- \@set@mulitling@fmtcount
- }%
- {%
-% \end{macrocode}
-% In the case that neither babel/polyglossia, nor ngerman has been loaded, then we go to multiling if a
-% language has been loaded by package option, and to delfault language otherwise.
-% \begin{macrocode}
- \iffmtcount@language@option
- \@set@mulitling@fmtcount
-% \end{macrocode}
-% Some sanity check at the beginning of document may help the end user understand what is wrong:
-% \begin{macrocode}
- \AtBeginDocument{%
- \ifcsundef{languagename}%
- {%
- \PackageWarning{fmtcount}{%
- `\protect\languagename' is undefined, you should use package babel/polyglossia when loading a
- language via package option. Reverting to default language.
- }%
- \@setdef@ultfmtcount
- }{%
- \@FC@iflangloaded{\languagename}{}{%
-% \end{macrocode}
-% The current \cs{languagename} is not a language that has been previously loaded. The correction is to have
-% \cs{languagename} let to \cs{fc@mainlang}. Please note that, as \cs{iffmtcount@language@option} is true,
-% we know that \texttt{fmtcount} has loaded some language.
-% \begin{macrocode}
- \PackageWarning{fmtcount}{%
- Setting `\protect\languagename' to `\fc@mainlang'.\MessageBreak
- Reason is that `\protect\languagename' was `\languagename',\MessageBreak
- but `\languagename' was not loaded by fmtcount,\MessageBreak
- whereas `\fc@mainlang' was the last language loaded by fmtcount ;
- }%
- \let\languagename\fc@mainlang
- }
- }%
- }
- \else
- \@setdef@ultfmtcount
- \fi
- }%
-}
-% \end{macrocode}
-% Backwards compatibility:
-% \begin{macrocode}
-\let\@ordinal=\@ordinalM
-\let\@ordinalstring=\@ordinalstringM
-\let\@Ordinalstring=\@OrdinalstringM
-\let\@numberstring=\@numberstringM
-\let\@Numberstring=\@NumberstringM
-% \end{macrocode}
-\iffalse Local variables: \fi
-\iffalse mode: docTeX \fi
-\iffalse End: \fi
-%\iffalse
-% \begin{macrocode}
-%</fmtcount.sty>
-% \end{macrocode}
-%\fi
-%\iffalse
-% \begin{macrocode}
%<*fc-american.def>
% \end{macrocode}
%\fi
@@ -4713,6 +1751,11 @@ this number}%
}%
\@tempa{france}\@tempa{swiss}\@tempa{belgian}%
% \end{macrocode}
+% Make `\texttt{france}' the default dialect for `\texttt{french}' language
+% \changes{3.01}{2014-12-18}{Move French specific stuff from \styfmt{fmtcount.sty} to \styfmt{fc-french.def}.}
+% \begin{macrocode}
+\def\fmtcount@french{france}%
+% \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}
@@ -4747,29 +1790,52 @@ this number}%
\let\fc@case\fc@CaseIden
% \end{macrocode}
-% \DescribeMacro\@ordinalMfrench
+% \DescribeMacro{\@ordinalMfrench}
+% \changes{3.01}{2014-11-12}{Protect \cs{`}, for solving
+% \uref{http://github.com/nlct/fmtcount/issues/15}{Issue \#15}, and
+% correct non abbreviated ordinal finals}
+% \changes{3.01}{2014-11-20}{Add a package warning about non
+% abbreviated ordinals in French being incorrect. Change ``i\`eme''
+% to ``\`eme'' which is the most frequent non abbreviated form.}
% \begin{macrocode}
\newcommand*{\@ordinalMfrench}[2]{%
\iffmtord@abbrv
- \edef#2{\number#1\relax\noexpand\fmtord{e}}%
+ \ifnum#1=1 %
+ \edef#2{\number#1\relax\noexpand\fmtord{er}}%
+ \else
+ \edef#2{\number#1\relax\noexpand\fmtord{e}}%
+ \fi
\else
- \ifnum#1=1\relax
+ \PackageWarning{fmtcount}{Non abbreviated ordinal finals (`eme) are
+ considered incorrect in French.}%
+ \ifnum#1=1 %
\edef#2{\number#1\relax\noexpand\fmtord{er}}%
\else
- \edef#2{\number#1\relax\noexpand\fmtord{eme}}%
+ \protected@edef#2{\number#1\relax\noexpand\fmtord{\protect\`eme}}%
\fi
\fi}
% \end{macrocode}
-% \DescribeMacro\@ordinalFfrench
+% \DescribeMacro{\@ordinalFfrench}
+% \changes{3.01}{2014-11-10}{Protect \cs{`}, for solving
+% \uref{http://github.com/nlct/fmtcount/issues/15}{Issue \#15}}
+% \changes{3.01}{2014-11-20}{Add a package warning about non
+% abbreviated ordinals in French being incorrect. Change ``i\`eme''
+% to ``\`eme'' which is the most frequent non abbreviated form.}
% \begin{macrocode}
\newcommand*{\@ordinalFfrench}[2]{%
\iffmtord@abbrv
- \edef#2{\number#1\relax\noexpand\fmtord{e}}%
+ \ifnum#1=1 %
+ \edef#2{\number#1\relax\noexpand\fmtord{re}}%
+ \else
+ \edef#2{\number#1\relax\noexpand\fmtord{e}}%
+ \fi
\else
+ \PackageWarning{fmtcount}{Non abbreviated ordinal finals (`eme) are
+ considered incorrect in French.}%
\ifnum#1=1 %
- \edef#2{\number#1\relax\noexpand\fmtord{i\`ere}}%
+ \protected@edef#2{\number#1\relax\noexpand\fmtord{\protect\`ere}}%
\else
- \edef#2{\number#1\relax\noexpand\fmtord{i\`eme}}%
+ \protected@edef#2{\number#1\relax\noexpand\fmtord{\protect\`eme}}%
\fi
\fi}
% \end{macrocode}
@@ -4777,7 +1843,7 @@ this number}%
% \begin{macrocode}
\let\@ordinalNfrench\@ordinalMfrench
% \end{macrocode}
-% \DescribeMacro\@@unitstringfrench
+% \DescribeMacro{\@@unitstringfrench}
% \begin{macrocode}
\newcommand*{\@@unitstringfrench}[1]{%
\noexpand\fc@case
@@ -4796,7 +1862,7 @@ z\'ero%
\noexpand\@nil
}
% \end{macrocode}
-% \DescribeMacro\@@tenstringfrench
+% \DescribeMacro{\@@tenstringfrench}
% \begin{macrocode}
\newcommand*{\@@tenstringfrench}[1]{%
\noexpand\fc@case
@@ -4815,7 +1881,7 @@ z\'ero%
\noexpand\@nil
}
% \end{macrocode}
-% \DescribeMacro\@@teenstringfrench
+% \DescribeMacro{\@@teenstringfrench}
% \begin{macrocode}
\newcommand*{\@@teenstringfrench}[1]{%
\noexpand\fc@case
@@ -4834,7 +1900,7 @@ z\'ero%
\noexpand\@nil
}
% \end{macrocode}
-% \DescribeMacro\@@seventiesfrench
+% \DescribeMacro{\@@seventiesfrench}
% \begin{macrocode}
\newcommand*{\@@seventiesfrench}[1]{%
\@tenstring{6}%
@@ -4846,7 +1912,7 @@ z\'ero%
\@teenstring{#1}%
}
% \end{macrocode}
-% \DescribeMacro\@@eightiesfrench Macro \cs{@@eightiesfrench} is used to format numbers in the interval
+% \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}\)\\
@@ -4929,7 +1995,7 @@ z\'ero%
\ifnum#1>0 \@unitstring{#1}\fi
}
% \end{macrocode}
-% \DescribeMacro\fc@french@common Macro \cs{fc@french@common} does all the preliminary settings common to all
+% \DescribeMacro{\fc@french@common}Macro \cs{fc@french@common} does all the preliminary settings common to all
% French dialects \& formatting options.
% \begin{macrocode}
\newcommand*\fc@french@common{%
@@ -5065,7 +2131,11 @@ z\'ero%
\@@ordinalstringfrench{#1}{#2}%
}
\newcommand*\fc@@firstfrench{premier}
-\newcommand*\fc@@firstFfrench{premi\`ere}
+% \end{macrocode}
+% \changes{3.01}{2014-11-10}{Protect \cs{`}, for solving
+% \uref{http://github.com/nlct/fmtcount/issues/15}{Issue \#15}}
+% \begin{macrocode}
+\newcommand*\fc@@firstFfrench{premi\protect\`ere}
\DeclareRobustCommand{\@ordinalstringMfrenchfrance}[2]{%
\let\fc@case\fc@CaseIden
\let\fc@first=\fc@@firstfrench
@@ -5171,7 +2241,7 @@ z\'ero%
\let\@OrdinalstringFfrench=\@OrdinalstringFfrenchfrance
\let\@OrdinalstringNfrench\@OrdinalstringMfrench
% \end{macrocode}
-% \DescribeMacro\fc@@do@plural@mark Macro \cs{fc@@do@plural@mark} will expand to the plural mark of
+% \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}
@@ -5233,14 +2303,14 @@ z\'ero%
\fi
}
% \end{macrocode}
-% \DescribeMacro\fc@@nbrstr@Fpreamble Macro \cs{fc@@nbrstr@Fpreamble} do the necessary preliminaries before
+% \DescribeMacro{\fc@@nbrstr@Fpreamble}Macro \cs{fc@@nbrstr@Fpreamble} do the necessary preliminaries before
% formatting a cardinal with feminine gender.
% \begin{macrocode}
\ifcsundef{fc@@nbrstr@Fpreamble}{}{%
\PackageError{fmtcount}{Duplicate definition}{Redefinition of macro
`fc@@nbrstr@Fpreamble'}}
% \end{macrocode}
-% \DescribeMacro\fc@@nbrstr@Fpreamble
+% \DescribeMacro{\fc@@nbrstr@Fpreamble}
% \begin{macrocode}
\def\fc@@nbrstr@Fpreamble{%
\fc@read@unit{\count1}{0}%
@@ -5252,7 +2322,7 @@ z\'ero%
\fi
}
% \end{macrocode}
-% \DescribeMacro\fc@@nbrstr@Fpostamble
+% \DescribeMacro{\fc@@nbrstr@Fpostamble}
% \begin{macrocode}
\def\fc@@nbrstr@Fpostamble{%
\let\fc@case\fc@case@save
@@ -5264,7 +2334,7 @@ z\'ero%
\fi
}
% \end{macrocode}
-% \DescribeMacro\fc@@pot@longscalefrench Macro \cs{fc@@pot@longscalefrench} is used to produce
+% \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}
@@ -5411,7 +2481,7 @@ z\'ero%
}\@tempa
}
% \end{macrocode}
-% \DescribeMacro\fc@@pot@shortscalefrench Macro \cs{fc@@pot@shortscalefrench} is used to produce
+% \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}
@@ -5490,7 +2560,7 @@ z\'ero%
}\@tempa
}
% \end{macrocode}
-% \DescribeMacro\fc@@pot@recursivefrench Macro \cs{fc@@pot@recursivefrench} is used to produce
+% \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}
@@ -5607,7 +2677,7 @@ z\'ero%
}\@tempa
}
% \end{macrocode}
-% \DescribeMacro\fc@muladdfrench Macro \cs{fc@muladdfrench} is used to format the sum of a number \(a\) and
+% \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
@@ -5704,7 +2774,7 @@ z\'ero%
}\@tempa
}%
% \end{macrocode}
-% \DescribeMacro\fc@lthundredstringfrench Macro \cs{fc@lthundredstringfrench} is used to format a number in
+% \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}
\ifcsundef{fc@lthundredstringfrench}{}{%
@@ -5807,7 +2877,7 @@ z\'ero%
}\@tempa
}
% \end{macrocode}
-% \DescribeMacro\fc@ltthousandstringfrench Macro \cs{fc@ltthousandstringfrench} is used to format a number in
+% \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}
\ifcsundef{fc@ltthousandstringfrench}{}{%
@@ -5888,7 +2958,7 @@ z\'ero%
}\@tempa
}
% \end{macrocode}
-% \DescribeMacro\@@numberstringfrench Macro \cs{@@numberstringfrench} is the main engine for formatting
+% \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}
\ifcsundef{@@numberstringfrench}{}{%
@@ -5930,7 +3000,7 @@ z\'ero%
}\@tempa
}
% \end{macrocode}
-% \DescribeMacro\fc@@nbrstrfrench@inner Common part of \cs{@@numberstringfrench} and \cs
+% \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
@@ -5987,7 +3057,7 @@ z\'ero%
\repeat
}
% \end{macrocode}
-% \DescribeMacro\@@ordinalstringfrench Macro \cs{@@ordinalstringfrench} is the main engine for formatting
+% \DescribeMacro{\@@ordinalstringfrench}Macro \cs{@@ordinalstringfrench} is the main engine for formatting
% ordinal numbers in French. First check it is not yet defined.
% \begin{macrocode}
\ifcsundef{@@ordinalstringfrench}{}{%
@@ -6029,7 +3099,11 @@ z\'ero%
\count0=0 %
\fi
\ifnum\count0=1 %
- \edef\@tempa{\expandafter\fc@case\fc@first\@nil}%
+% \end{macrocode}
+% \changes{3.01}{2014-11-10}{Protect \cs{`}, for solving
+% \uref{http://github.com/nlct/fmtcount/issues/15}{Issue \#15}}
+% \begin{macrocode}
+ \protected@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.
@@ -6075,22 +3149,24 @@ z\'ero%
\let\fc@case\fc@case@save
% \end{macrocode}
% Now we add the ``i\`eme'' ending
+% \changes{3.01}{2014-11-10}{Protect \cs{`}, for solving
+% \uref{http://github.com/nlct/fmtcount/issues/15}{Issue \#15}}
% \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}%
+ \protected@edef\@tempa{\@tempb\expandafter\fc@case\@tempd i\protect\`eme\@nil}%
\else
\def\@tempf{q}%
\ifx\@tempe\@tempf
- \edef\@tempa{\@tempb\expandafter\fc@case\@tempd qui\`eme\@nil}%
+ \protected@edef\@tempa{\@tempb\expandafter\fc@case\@tempd qui\protect\`eme\@nil}%
\else
\def\@tempf{f}%
\ifx\@tempe\@tempf
- \edef\@tempa{\@tempb\expandafter\fc@case\@tempd vi\`eme\@nil}%
+ \protected@edef\@tempa{\@tempb\expandafter\fc@case\@tempd vi\protect\`eme\@nil}%
\else
- \edef\@tempa{\@tempb\expandafter\fc@case\@tempc i\`eme\@nil}%
+ \protected@edef\@tempa{\@tempb\expandafter\fc@case\@tempc i\protect\`eme\@nil}%
\fi
\fi
\fi
@@ -6118,6 +3194,18 @@ z\'ero%
}
\fc@frenchoptions@setdefaults
% \end{macrocode}
+% Make some indirection to call the current French dialect corresponding macro.
+% \changes{3.01}{2014-12-18}{Move French specific stuff from \styfmt{fmtcount.sty} to \styfmt{fc-french.def}.}
+% \begin{macrocode}
+\def\@ordinalstringMfrench{\csuse{@ordinalstringMfrench\fmtcount@french}}%
+\def\@ordinalstringFfrench{\csuse{@ordinalstringFfrench\fmtcount@french}}%
+\def\@OrdinalstringMfrench{\csuse{@OrdinalstringMfrench\fmtcount@french}}%
+\def\@OrdinalstringFfrench{\csuse{@OrdinalstringFfrench\fmtcount@french}}%
+\def\@numberstringMfrench{\csuse{@numberstringMfrench\fmtcount@french}}%
+\def\@numberstringFfrench{\csuse{@numberstringFfrench\fmtcount@french}}%
+\def\@NumberstringMfrench{\csuse{@NumberstringMfrench\fmtcount@french}}%
+\def\@NumberstringFfrench{\csuse{@NumberstringFfrench\fmtcount@french}}%
+% \end{macrocode}
\iffalse Local variables: \fi
\iffalse mode: docTeX \fi
\iffalse End: \fi
@@ -8799,5 +5887,3085 @@ this number}%
%</fc-USenglish.def>
% \end{macrocode}
%\fi
+%\iffalse
+% \begin{macrocode}
+%<*fcnumparser.sty>
+% \end{macrocode}
+%\fi
+%\subsection{fcnumparser.sty}
+% \begin{macrocode}
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesPackage{fcnumparser}[2012/09/28]
+% \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}
+\ifcsundef{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}
+\ifcsundef{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}
+\ifcsundef{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}
+\ifcsundef{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}
+\ifcsundef{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}
+\ifcsundef{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}
+\ifcsundef{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}
+\ifcsundef{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}
+\ifcsundef{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}[2012/09/28]
+\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}
+\ifcsundef{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}
+\ifcsundef{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
+%\subsection{fmtcount.sty}
+% This section deals with the code for |fmtcount.sty|
+% \begin{macrocode}
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesPackage{fmtcount}[2015/05/05 v3.01]
+\RequirePackage{ifthen}
+% \end{macrocode}
+% \changes{3.01}{2014-12-18}{Use \styfmt{xkeyval} instead of \styfmt{keyval}, so that we do not get in trouble
+% with bracket spurious removals}
+% \begin{macrocode}
+\RequirePackage{xkeyval}
+\RequirePackage{etoolbox}
+\RequirePackage{fcprefix}
+% \end{macrocode}
+% \changes{3.00}{2014-07-18}{Add \cs{RequirePackage} for \texttt{ifxetex}}
+% \begin{macrocode}
+\RequirePackage{ifxetex}
+% \end{macrocode}
+% \changes{1.3}{2007/7/19}{no
+%longer using xspace package}
+%\changes{1.31}{2009/10/02}{amsgen now loaded (\cs{new@ifnextchar}
+% needed)}
+% Need to use \cs{new@ifnextchar} instead of \cs{@ifnextchar} in
+% commands that have a final optional argument (such as \cs{gls})
+% so require \sty{amsgen}.
+% \begin{macrocode}
+\RequirePackage{amsgen}
+% \end{macrocode}
+% These commands need to be defined before the
+% configuration file is loaded.
+%
+% Define the macro to format the |st|, |nd|, |rd| or |th| of an
+% ordinal.
+% \changes{3.01}{2014-12-18}{Make \cs{fmtord} language dependent.}
+% \changes{3.01}{2014-12-21}{Substitute \cs{textsuperscript} for \cs{fc@textsuperscript}, and define
+% \cs{fc@textsuperscript} as \cs{fup} when defined at beginning of document, or as \cs{textsuperscript}
+% otherwise}
+%\begin{macro}{\fc@orddef@ult}
+% \begin{macrocode}
+\providecommand*{\fc@orddef@ult}[1]{\fc@textsuperscript{#1}}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\fc@ord@multiling}
+% \begin{macrocode}
+\providecommand*{\fc@ord@multiling}[1]{%
+ \ifcsundef{fc@\languagename @alias@of}{%
+% \end{macrocode}
+% Not a supported language, just use the default setting:
+% \begin{macrocode}
+ \fc@orddef@ult{#1}}{%
+ \expandafter\let\expandafter\@tempa\csname fc@\languagename @alias@of\endcsname
+ \ifcsundef{fc@ord@\@tempa}{%
+% \end{macrocode}
+% Not language specfic setting, just use the default setting:
+% \begin{macrocode}
+ \fc@orddef@ult{#1}}{%
+% \end{macrocode}
+% Language with specific setting, use that setting:
+% \begin{macrocode}
+\csname fc@ord@\@tempa\endcsname{#1}}}}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\padzeroes}
+%\begin{definition}
+%\cs{padzeroes}\oarg{n}
+%\end{definition}
+% Specifies how many digits should be displayed for commands such as
+% \cs{decimal} and \cs{binary}.
+% \begin{macrocode}
+\newcount\c@padzeroesN
+\c@padzeroesN=1\relax
+\providecommand*{\padzeroes}[1][17]{\c@padzeroesN=#1}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\FCloadlang}
+%\changes{2.0}{2012-06-18}{new}
+%\changes{2.02}{2012-10-24}{ensured catcode for @ set to `letter'
+%before loading file}
+%\begin{definition}
+%\cs{FCloadlang}\marg{language}
+%\end{definition}
+% Load \styfmt{fmtcount} language file,
+% \texttt{fc-}\meta{language}\texttt{.def}, unless already loaded.
+% Unfortunately neither \styfmt{babel} nor \styfmt{polyglossia} keep a list of loaded
+% dialects, so we can't load all the necessary def files in the
+% preamble as we don't know which dialects the user requires.
+% Therefore the dialect definitions get loaded when a command such
+% as \cs{ordinalnum} is used, if they
+% haven't already been loaded.
+% \begin{macrocode}
+\newcount\fc@tmpcatcode
+\def\fc@languages{}%
+\def\fc@mainlang{}%
+\newcommand*{\FCloadlang}[1]{%
+ \@FC@iflangloaded{#1}{}%
+ {%
+ \fc@tmpcatcode=\catcode`\@\relax
+ \catcode `\@ 11\relax
+ \InputIfFileExists{fc-#1.def}%
+ {%
+ \ifdefempty{\fc@languages}%
+ {%
+ \gdef\fc@languages{#1}%
+ }%
+ {%
+ \gappto\fc@languages{,#1}%
+ }%
+ \gdef\fc@mainlang{#1}%
+ }%
+ {}%
+ \catcode `\@ \fc@tmpcatcode\relax
+ }%
+}
+% \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}
+%
+% We need that flag to remember that a language has been loaded via package option, so that in the end we can
+% set \styfmt{fmtcount} in multiling
+% \begin{macrocode}
+\newif\iffmtcount@language@option
+\fmtcount@language@optionfalse
+% \end{macrocode}
+%\begin{macro}{\fc@supported@language@list}
+% Declare list of supported languages, as a comma separated list. No space, no empty items. Each item is a
+% language for which fmtcount is able to load language specific definitions. \texttt{Aliases but be
+% \textit{after} their meaning, for instance `american' being an alias of `USenglish', it has to appear
+% after it in the list}. The raison d'\^etre of this list is to commonalize iteration on languages for the
+% two following purposes:
+% \begin{itemize}
+% \item loading language definition as a result of the language being used by
+% \styfmt{babel}/\styfmt{polyglossia}
+% \item loading language definition as a result of package option
+% \end{itemize}
+% These two purposes cannot be handled in the same pass, we need two different passes otherwise there would
+% be some corner cases when a package would be required --- as a result of loading language definition for
+% one language --- between a \cs{DeclareOption} and a \cs{ProcessOption} which is forbidden by \LaTeXe.
+%\changes{3.00}{2014-07-18}{new}
+% \begin{macrocode}
+\newcommand*\fc@supported@language@list{%
+english,%
+UKenglish,%
+british,%
+USenglish,%
+american,%
+spanish,%
+portuges,%
+french,%
+frenchb,%
+francais,%
+german,%
+germanb,%
+ngerman,%
+ngermanb,%
+italian}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\fc@iterate@on@languages}
+%\begin{definition}
+%\cs{fc@iterate@on@languages}\marg{body}
+%\end{definition}
+% Now make some language iterator, note that for the following to work properly
+% \cs{fc@supported@language@list} must not be empty. \meta{body} is a macro that takes one argument, and
+% \cs{fc@iterate@on@languages} applies it iteratively :
+%\changes{3.00}{2014-07-18}{new}
+% \begin{macrocode}
+\newcommand*\fc@iterate@on@languages[1]{%
+ \ifx\fc@supported@language@list\@empty
+% \end{macrocode}
+% That case should never happen !
+% \begin{macrocode}
+ \PackageError{fmtcount}{Macro `\protect\@fc@iterate@on@languages' is empty}{You should never get here:
+ Something is broken within \texttt{fmtcount}, please report the issue on
+ \texttt{https://github.com/search?q=fmtcount\&ref=cmdform\&type=Issues}}%
+ \else
+ \let\fc@iterate@on@languages@body#1
+ \expandafter\@fc@iterate@on@languages\fc@supported@language@list,\@nil,%
+ \fi
+}
+\def\@fc@iterate@on@languages#1,{%
+ {%
+ \def\@tempa{#1}%
+ \ifx\@tempa\@nnil
+ \let\@tempa\@empty
+ \else
+ \def\@tempa{%
+ \fc@iterate@on@languages@body{#1}%
+ \@fc@iterate@on@languages
+ }%
+ \fi
+ \expandafter
+ }\@tempa
+}%
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\@fc@loadifbabelorpolyglossialdf}
+%\begin{definition}
+%\cs{@fc@loadifbabelorpolyglossialdf}\marg{language}
+%\end{definition}
+%Loads fmtcount language file,
+%\texttt{fc-}\meta{language}\texttt{.def},
+% if one of the following condition is met:
+% \begin{itemize}
+% \item \styfmt{babel} language definition file \meta{language}\texttt{.ldf} has been loaded --- conditionally
+% to compilation with \texttt{latex}, not \texttt{xelatex}.
+% \item \styfmt{polyglossia} language definition file \texttt{gloss-}\meta{language}\texttt{.ldf} has been
+% loaded --- conditionally to compilation with \texttt{xelatex}, not \texttt{latex}.
+% \item \meta{language} option has been passed to package \styfmt{fmtcount}.
+% \end{itemize}
+%
+%\changes{2.03}{2012-11-11}{renamed \cs{@fc@loadifbabelldf} to
+% \cs{@fc@loadifbabelorpolyglossialdf}}
+%\changes{2.03}{2012-11-11}{added check for polyglossia language}
+%\changes{3.00}{2014-07-18}{use \cs{ifxetex} to discriminate between \styfmt{babel} and \styfmt{polyglossia}}
+% \begin{macrocode}
+\newcommand*{\@fc@loadifbabelorpolyglossialdf}[1]{%
+ \ifxetex
+ \IfFileExists{gloss-#1.ldf}{\ifcsundef{#1@loaded}{}{\FCloadlang{#1}}}{}%
+ \else
+ \ifcsundef{ver@#1.ldf}{}{\FCloadlang{#1}}%
+ \fi
+}
+% \end{macrocode}
+%\end{macro}
+%
+% Load appropriate language definition files:
+%\changes{1.1}{14 June 2007}{added check for UKenglish,
+% british and USenglish babel settings}
+%\changes{2.0}{2012-06-18}{changed check for \cs{l@}\meta{language}
+% to check for \cs{date}\meta{language}}
+%\changes{3.00}{2014-07-18}{use iterator rather than doing it flat on each language}
+%\changes{3.01}{2014-12-18}{Define language aliases to \cs{fmtord}
+% option dependent on ``true'' language .}
+% \begin{macrocode}
+\fc@iterate@on@languages\@fc@loadifbabelorpolyglossialdf
+% \end{macrocode}
+% By default all languages are unique --- i.e. aliases not yet defined.
+% \begin{macrocode}
+\def\fc@iterate@on@languages@body#1{%
+ \expandafter\def\csname fc@#1@alias@of\endcsname{#1}}
+\expandafter\@fc@iterate@on@languages\fc@supported@language@list,\@nil,%
+% \end{macrocode}
+% Now define those languages that are aliases of another
+% language. This is done with: \cs{@tempa}\marg{alias}\marg{language}
+% \begin{macrocode}
+\def\@tempa#1#2{%
+ \expandafter\def\csname fc@#1@alias@of\endcsname{#2}%
+}%
+\@tempa{frenchb}{french}
+\@tempa{francais}{french}
+\@tempa{germanb}{german}
+\@tempa{ngermanb}{german}
+\@tempa{ngerman}{german}
+\@tempa{british}{english}
+\@tempa{american}{USenglish}
+% \end{macrocode}
+% Now, thanks to the aliases, we are going to define one option for each language, so that each language can
+% have its own settings.
+% \begin{macrocode}
+\def\fc@iterate@on@languages@body#1{%
+ \define@key{fmtcount}{#1}[]{%
+ \@FC@iflangloaded{#1}%
+ {%
+ \setkeys{fc\csname fc@#1@alias@of\endcsname}{##1}%
+ }{%
+ \PackageError{fmtcount}%
+ {Language `#1' not defined}%
+ {You need to load \ifxetex polyglossia\else babel\fi\space before loading fmtcount}%
+ }%
+ }%
+ \ifthenelse{\equal{\csname fc@#1@alias@of\endcsname}{#1}}{%
+ \define@key{fc\csname fc@#1@alias@of\endcsname}{fmtord}{%
+ \ifthenelse{\equal{##1}{raise}\or\equal{##1}{level}}{%
+ \expandafter\let\expandafter\@tempa\csname fc@set@ord@as@##1\endcsname
+ \expandafter\@tempa\csname fc@ord@#1\endcsname
+ }{%
+ \ifthenelse{\equal{##1}{undefine}}{%
+ \expandafter\let\csname fc@ord@#1\endcsname\undefined
+ }{%
+ \PackageError{fmtcount}%
+ {Invalid value `##1' to fmtord key}%
+ {Option `fmtord' can only take the values `level', `raise'
+ or `undefine'}%
+ }}
+ }%
+ }{%
+% \end{macrocode}
+% When the language \#1 is an alias, do the same as the language of which it is an alias:
+% \begin{macrocode}
+ \expandafter\let\expandafter\@tempa\csname KV@\csname fc@#1@alias@of\endcsname @fmtord\endcsname
+ \expandafter\let\csname KV@#1@fmtord\endcsname\@tempa
+ }%
+}
+\expandafter\@fc@iterate@on@languages\fc@supported@language@list,\@nil,%
+% \end{macrocode}
+%\begin{option}{fmtord}
+% Key to determine how to display the ordinal
+% \changes{3.01}{2014-12-18}{Apply option directly, rather than doing a border effect on \cs{fmtcount@fmtord},
+% and then postprocessing depending on \cs{fmtcount@fmtord} at the end of \cs{fmtcountsetoptions}}
+% \begin{macrocode}
+\def\fc@set@ord@as@level#1{%
+ \def#1##1{##1}%
+}
+\def\fc@set@ord@as@raise#1{%
+ \let#1\fc@textsuperscript
+}
+\define@key{fmtcount}{fmtord}{%
+ \ifthenelse{\equal{#1}{level}
+ \or\equal{#1}{raise}}%
+ {%
+ \csname fc@set@ord@as@#1\endcsname\fc@orddef@ult
+ \def\fmtcount@fmtord{#1}%
+ }%
+ {%
+ \PackageError{fmtcount}%
+ {Invalid value `#1' to fmtord key}%
+ {Option `fmtord' can only take the values `level' or `raise'}%
+ }%
+}
+% \end{macrocode}
+%\end{option}
+%\begin{macro}{\iffmtord@abbrv}
+% Key to determine whether the ordinal superscript should be
+% abbreviated (language dependent, currently only affects French
+% ordinals, non-abbreviated French ordinals ending --- i.e. `ier' and
+% `i\`eme' --- are considered faulty.)
+% \begin{macrocode}
+\newif\iffmtord@abbrv
+% \end{macrocode}
+% \changes{3.01}{2014-11-12}{Make `true' the default for option
+% `abbr', as in French this is the correct behaviour, and currently
+% only French uses that}
+% \begin{macrocode}
+\fmtord@abbrvtrue
+\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 `abbrv' 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.
+% \changes{3.01}{2014-12-18}{ Move French specific stuff to \styfmt{french.def}.}
+% \begin{macrocode}
+\def\fmtcountsetoptions{%
+ \def\fmtcount@fmtord{}%
+ \setkeys{fmtcount}}%
+% \end{macrocode}
+%\end{macro}
+% Load configuration 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}%
+{%
+ \PackageInfo{fmtcount}{Using configuration file fmtcount.cfg}%
+}%
+{%
+}
+% \end{macrocode}
+%\begin{macro}{\fmtcount@loaded@by@option@lang@list}
+% \changes{3.01}{2014-10-15}{Declare language option so that actual loading happens after \cs{ProcessOptions},
+% and the \cs{ProcessOption} only registers the language for loading.}
+% \begin{macrocode}
+\newcommand*{\fmtcount@loaded@by@option@lang@list}{}
+% \end{macrocode}
+%\end{macro}
+%\begin{option}{\meta{language}}
+%Option \meta{language} causes language \meta{language} to be registered for loading.
+% \begin{macrocode}
+\newcommand*\@fc@declare@language@option[1]{%
+ \DeclareOption{#1}{%
+ \ifx\fmtcount@loaded@by@option@lang@list\@empty
+ \def\fmtcount@loaded@by@option@lang@list{#1}%
+ \else
+ \edef\fmtcount@loaded@by@option@lang@list{\fmtcount@loaded@by@option@lang@list,#1}%
+ \fi
+ }}%
+\fc@iterate@on@languages\@fc@declare@language@option
+% \end{macrocode}
+%\end{option}
+%
+%\begin{option}{level}
+% \begin{macrocode}
+\DeclareOption{level}{\def\fmtcount@fmtord{level}%
+ \def\fc@orddef@ult#1{#1}}
+% \end{macrocode}
+%\end{option}
+%\begin{option}{raise}
+% \begin{macrocode}
+\DeclareOption{raise}{\def\fmtcount@fmtord{raise}%
+ \def\fc@orddef@ult#1{\fc@textsuperscript{#1}}}
+% \end{macrocode}
+%\end{option}
+% Process package options
+% \changes{3.00}{2014-07-18}{Add \cs{relax} after \cs{ProcessOptions} like shown in \texttt{clsguide.pdf}}
+% \begin{macrocode}
+\ProcessOptions\relax
+% \end{macrocode}
+% \changes{3.01}{2014-10-15}{Load languages that have been registered for loading by package option.}
+% Now we do the loading of all languages that have been set by option to be loaded.
+% \begin{macrocode}
+\ifx\fmtcount@loaded@by@option@lang@list\@empty\else
+\def\fc@iterate@on@languages@body#1{%
+ \@FC@iflangloaded{#1}{}{%
+ \fmtcount@language@optiontrue
+ \FCloadlang{#1}%
+ }}
+\expandafter\@fc@iterate@on@languages\fmtcount@loaded@by@option@lang@list,\@nil,%
+\fi
+% \end{macrocode}
+%\begin{macro}{\@FCmodulo}
+%\begin{definition}
+%\cs{@FCmodulo}\marg{count reg}\marg{n}
+%\end{definition}
+%\changes{2.04}{2014-06-09}{renamed \cs{@modulo} to \cs{@FCmodulo}}
+% Sets the count register to be its value modulo \meta{n}.
+% This is used for the
+% date, time, ordinal and numberstring commands. (The
+% \styfmt{fmtcount} package was originally part of the
+% \sty{datetime} package.)
+% \begin{macrocode}
+\newcount\@DT@modctr
+\newcommand*{\@FCmodulo}[2]{%
+ \@DT@modctr=#1\relax
+ \divide \@DT@modctr by #2\relax
+ \multiply \@DT@modctr by #2\relax
+ \advance #1 by -\@DT@modctr
+}
+% \end{macrocode}
+%\end{macro}
+% The following registers are needed by |\@ordinal| etc
+% \begin{macrocode}
+\newcount\@ordinalctr
+\newcount\@orgargctr
+\newcount\@strctr
+\newcount\@tmpstrctr
+% \end{macrocode}
+%Define commands that display numbers in different bases.
+% Define counters and conditionals needed.
+% \begin{macrocode}
+\newif\if@DT@padzeroes
+\newcount\@DT@loopN
+\newcount\@DT@X
+% \end{macrocode}
+%\begin{macro}{\binarynum}
+% Converts a decimal number to binary, and display.
+% \begin{macrocode}
+\newcommand*{\@binary}[1]{%
+ \@DT@padzeroestrue
+ \@DT@loopN=17\relax
+ \@strctr=\@DT@loopN
+ \whiledo{\@strctr<\c@padzeroesN}{0\advance\@strctr by 1}%
+ \@strctr=65536\relax
+ \@DT@X=#1\relax
+ \loop
+ \@DT@modctr=\@DT@X
+ \divide\@DT@modctr by \@strctr
+ \ifthenelse{\boolean{@DT@padzeroes}
+ \and \(\@DT@modctr=0\)
+ \and \(\@DT@loopN>\c@padzeroesN\)}%
+ {}%
+ {\the\@DT@modctr}%
+ \ifnum\@DT@modctr=0\else\@DT@padzeroesfalse\fi
+ \multiply\@DT@modctr by \@strctr
+ \advance\@DT@X by -\@DT@modctr
+ \divide\@strctr by 2\relax
+ \advance\@DT@loopN by -1\relax
+ \ifnum\@strctr>1
+ \repeat
+ \the\@DT@X
+}
+
+\let\binarynum=\@binary
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\octalnum}
+% Converts a decimal number to octal, and displays.
+% \begin{macrocode}
+\newcommand*{\@octal}[1]{%
+ \ifnum#1>32768
+ \PackageError{fmtcount}%
+ {Value of counter too large for \protect\@octal}
+ {Maximum value 32768}
+ \else
+ \@DT@padzeroestrue
+ \@DT@loopN=6\relax
+ \@strctr=\@DT@loopN
+ \whiledo{\@strctr<\c@padzeroesN}{0\advance\@strctr by 1}%
+ \@strctr=32768\relax
+ \@DT@X=#1\relax
+ \loop
+ \@DT@modctr=\@DT@X
+ \divide\@DT@modctr by \@strctr
+ \ifthenelse{\boolean{@DT@padzeroes}
+ \and \(\@DT@modctr=0\)
+ \and \(\@DT@loopN>\c@padzeroesN\)}%
+ {}{\the\@DT@modctr}%
+ \ifnum\@DT@modctr=0\else\@DT@padzeroesfalse\fi
+ \multiply\@DT@modctr by \@strctr
+ \advance\@DT@X by -\@DT@modctr
+ \divide\@strctr by 8\relax
+ \advance\@DT@loopN by -1\relax
+ \ifnum\@strctr>1
+ \repeat
+ \the\@DT@X
+ \fi
+}
+\let\octalnum=\@octal
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\@@hexadecimalnum}
+% Converts 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]{%
+ \@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]{%
+ \@DT@padzeroestrue
+ \@DT@loopN=5\relax
+ \@strctr=\@DT@loopN
+ \whiledo{\@strctr<\c@padzeroesN}{0\advance\@strctr by 1}%
+ \@strctr=65536\relax
+ \@DT@X=#1\relax
+ \loop
+ \@DT@modctr=\@DT@X
+ \divide\@DT@modctr by \@strctr
+ \ifthenelse{\boolean{@DT@padzeroes}
+ \and \(\@DT@modctr=0\)
+ \and \(\@DT@loopN>\c@padzeroesN\)}%
+ {}{\@@Hexadecimal\@DT@modctr}%
+ \ifnum\@DT@modctr=0\else\@DT@padzeroesfalse\fi
+ \multiply\@DT@modctr by \@strctr
+ \advance\@DT@X by -\@DT@modctr
+ \divide\@strctr by 16\relax
+ \advance\@DT@loopN by -1\relax
+ \ifnum\@strctr>1
+ \repeat
+ \@@Hexadecimal\@DT@X
+}
+
+\let\Hexadecimalnum=\@Hexadecimal
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\aaalphnum}
+% Lowercase alphabetical representation (a \ldots\ z aa \ldots\ zz)
+% \begin{macrocode}
+\newcommand*{\@aaalph}[1]{%
+ \@DT@loopN=#1\relax
+ \advance\@DT@loopN by -1\relax
+ \divide\@DT@loopN by 26\relax
+ \@DT@modctr=\@DT@loopN
+ \multiply\@DT@modctr by 26\relax
+ \@DT@X=#1\relax
+ \advance\@DT@X by -1\relax
+ \advance\@DT@X by -\@DT@modctr
+ \advance\@DT@loopN by 1\relax
+ \advance\@DT@X by 1\relax
+ \loop
+ \@alph\@DT@X
+ \advance\@DT@loopN by -1\relax
+ \ifnum\@DT@loopN>0
+ \repeat
+}
+
+\let\aaalphnum=\@aaalph
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\AAAlphnum}
+% Uppercase alphabetical representation (a \ldots\ z aa \ldots\ zz)
+% \begin{macrocode}
+\newcommand*{\@AAAlph}[1]{%
+ \@DT@loopN=#1\relax
+ \advance\@DT@loopN by -1\relax
+ \divide\@DT@loopN by 26\relax
+ \@DT@modctr=\@DT@loopN
+ \multiply\@DT@modctr by 26\relax
+ \@DT@X=#1\relax
+ \advance\@DT@X by -1\relax
+ \advance\@DT@X by -\@DT@modctr
+ \advance\@DT@loopN by 1\relax
+ \advance\@DT@X by 1\relax
+ \loop
+ \@Alph\@DT@X
+ \advance\@DT@loopN by -1\relax
+ \ifnum\@DT@loopN>0
+ \repeat
+}
+
+\let\AAAlphnum=\@AAAlph
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\abalphnum}
+% Lowercase alphabetical representation
+% \begin{macrocode}
+\newcommand*{\@abalph}[1]{%
+ \ifnum#1>17576\relax
+ \PackageError{fmtcount}%
+ {Value of counter too large for \protect\@abalph}%
+ {Maximum value 17576}%
+ \else
+ \@DT@padzeroestrue
+ \@strctr=17576\relax
+ \@DT@X=#1\relax
+ \advance\@DT@X by -1\relax
+ \loop
+ \@DT@modctr=\@DT@X
+ \divide\@DT@modctr by \@strctr
+ \ifthenelse{\boolean{@DT@padzeroes}
+ \and \(\@DT@modctr=1\)}%
+ {}{\@alph\@DT@modctr}%
+ \ifnum\@DT@modctr=1\else\@DT@padzeroesfalse\fi
+ \multiply\@DT@modctr by \@strctr
+ \advance\@DT@X by -\@DT@modctr
+ \divide\@strctr by 26\relax
+ \ifnum\@strctr>1
+ \repeat
+ \advance\@DT@X by 1\relax
+ \@alph\@DT@X
+ \fi
+}
+
+\let\abalphnum=\@abalph
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\ABAlphnum}
+% Uppercase alphabetical representation
+% \begin{macrocode}
+\newcommand*{\@ABAlph}[1]{%
+ \ifnum#1>17576\relax
+ \PackageError{fmtcount}%
+ {Value of counter too large for \protect\@ABAlph}%
+ {Maximum value 17576}%
+ \else
+ \@DT@padzeroestrue
+ \@strctr=17576\relax
+ \@DT@X=#1\relax
+ \advance\@DT@X by -1\relax
+ \loop
+ \@DT@modctr=\@DT@X
+ \divide\@DT@modctr by \@strctr
+ \ifthenelse{\boolean{@DT@padzeroes}\and
+ \(\@DT@modctr=1\)}{}{\@Alph\@DT@modctr}%
+ \ifnum\@DT@modctr=1\else\@DT@padzeroesfalse\fi
+ \multiply\@DT@modctr by \@strctr
+ \advance\@DT@X by -\@DT@modctr
+ \divide\@strctr by 26\relax
+ \ifnum\@strctr>1
+ \repeat
+ \advance\@DT@X by 1\relax
+ \@Alph\@DT@X
+ \fi
+}
+
+\let\ABAlphnum=\@ABAlph
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\@fmtc@count}
+% Recursive command to count number of characters in argument.
+% \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
+}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\@decimal}
+%\changes{1.31}{2009/10/02}{fixed unwanted space.}
+% Format number as a decimal, possibly padded with zeroes in front.
+% \begin{macrocode}
+\newcommand{\@decimal}[1]{%
+ \@strctr=0\relax
+ \expandafter\@fmtc@count\number#1\relax
+ \@DT@loopN=\c@padzeroesN
+ \advance\@DT@loopN by -\@strctr
+ \ifnum\@DT@loopN>0\relax
+ \@strctr=0\relax
+ \whiledo{\@strctr < \@DT@loopN}{0\advance\@strctr by 1\relax}%
+ \fi
+ \number#1\relax
+}
+
+\let\decimalnum=\@decimal
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\FCordinal}
+%\begin{definition}
+%\cs{FCordinal}\marg{number}
+%\end{definition}
+% This is a bit cumbersome. Previously \cs{@ordinal}
+% was defined in a similar way to \cs{abalph} etc.
+% This ensured that the actual value of the counter was
+% written in the new label stuff in the .aux file. However
+% adding in an optional argument to determine the gender
+% for multilingual compatibility messed things up somewhat.
+% This was the only work around I could get to keep the
+% the cross-referencing stuff working, which is why
+% the optional argument comes \emph{after} the compulsory
+% argument, instead of the usual manner of placing it before.
+% Note however, that putting the optional argument means that
+% any spaces will be ignored after the command if the optional
+% argument is omitted.
+% Version 1.04 changed \cs{ordinal} to \cs{FCordinal}
+% to prevent it clashing with the memoir class.
+% \begin{macrocode}
+\newcommand{\FCordinal}[1]{%
+ \expandafter\protect\expandafter\ordinalnum{%
+ \expandafter\the\csname c@#1\endcsname}%
+}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\ordinal}
+% If \cs{ordinal} isn't defined make \cs{ordinal} a synonym
+% for \cs{FCordinal} to maintain compatibility with previous
+% versions.
+% \changes{3.00}{2014-07-18}{Use \cs{protect}, not \cs{string} in \cs{PackageWarning} to quote macros like
+% shown in \texttt{clsguide.pdf}}
+% \begin{macrocode}
+\ifcsundef{ordinal}
+ {\let\ordinal\FCordinal}%
+ {%
+ \PackageWarning{fmtcount}%
+ {\protect\ordinal \space already defined use
+ \protect\FCordinal \space instead.}
+ }
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\ordinalnum}
+% Display ordinal where value is given as a number or
+% count register instead of a counter:
+%\changes{1.31}{2009/10/02}{replaced \cs{@ifnextchar} with
+%\cs{new@ifnextchar}}
+% \begin{macrocode}
+\newcommand*{\ordinalnum}[1]{%
+ \new@ifnextchar[%
+ {\@ordinalnum{#1}}%
+ {\@ordinalnum{#1}[m]}%
+}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\@ordinalnum}
+% Display ordinal according to gender (neuter added in v1.1,
+% \cs{xspace} added in v1.2, and removed in v1.3\footnote{I
+%couldn't get it to work consistently both with and without the
+%optional argument}):
+% \begin{macrocode}
+\def\@ordinalnum#1[#2]{%
+ {%
+ \ifthenelse{\equal{#2}{f}}%
+ {%
+ \protect\@ordinalF{#1}{\@fc@ordstr}%
+ }%
+ {%
+ \ifthenelse{\equal{#2}{n}}%
+ {%
+ \protect\@ordinalN{#1}{\@fc@ordstr}%
+ }%
+ {%
+ \ifthenelse{\equal{#2}{m}}%
+ {}%
+ {%
+ \PackageError{fmtcount}%
+ {Invalid gender option `#2'}%
+ {Available options are m, f or n}%
+ }%
+ \protect\@ordinalM{#1}{\@fc@ordstr}%
+ }%
+ }%
+ \@fc@ordstr
+ }%
+}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\storeordinal}
+% Store the ordinal (first argument
+% is identifying name, second argument is a counter.)
+% \begin{macrocode}
+\newcommand*{\storeordinal}[2]{%
+ \expandafter\protect\expandafter\storeordinalnum{#1}{%
+ \expandafter\the\csname c@#2\endcsname}%
+}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\storeordinalnum}
+% Store ordinal (first argument
+% is identifying name, second argument is a number or
+% count register.)
+% \begin{macrocode}
+\newcommand*{\storeordinalnum}[2]{%
+ \@ifnextchar[%
+ {\@storeordinalnum{#1}{#2}}%
+ {\@storeordinalnum{#1}{#2}[m]}%
+}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\@storeordinalnum}
+% Store ordinal according to gender:
+% \begin{macrocode}
+\def\@storeordinalnum#1#2[#3]{%
+ \ifthenelse{\equal{#3}{f}}%
+ {%
+ \protect\@ordinalF{#2}{\@fc@ord}
+ }%
+ {%
+ \ifthenelse{\equal{#3}{n}}%
+ {%
+ \protect\@ordinalN{#2}{\@fc@ord}%
+ }%
+ {%
+ \ifthenelse{\equal{#3}{m}}%
+ {}%
+ {%
+ \PackageError{fmtcount}%
+ {Invalid gender option `#3'}%
+ {Available options are m or f}%
+ }%
+ \protect\@ordinalM{#2}{\@fc@ord}%
+ }%
+ }%
+ \expandafter\let\csname @fcs@#1\endcsname\@fc@ord
+}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\FMCuse}
+% Get stored information:
+% \begin{macrocode}
+\newcommand*{\FMCuse}[1]{\csname @fcs@#1\endcsname}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\ordinalstring}
+% Display ordinal as a string (argument is a counter)
+% \begin{macrocode}
+\newcommand*{\ordinalstring}[1]{%
+ \expandafter\protect\expandafter\ordinalstringnum{%
+ \expandafter\the\csname c@#1\endcsname}%
+}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\ordinalstringnum}
+% Display ordinal as a string (argument is a count register or
+% number.)
+%\changes{1.31}{2009/10/02}{replaced \cs{@ifnextchar} with
+%\cs{new@ifnextchar}}
+%\changes{1.33}{2009/10/15}{Made robust}
+% \begin{macrocode}
+\newcommand{\ordinalstringnum}[1]{%
+ \new@ifnextchar[%
+ {\@ordinal@string{#1}}%
+ {\@ordinal@string{#1}[m]}%
+}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\@ordinal@string}
+% Display ordinal as a string according to gender.
+% \changes{3.00}{2014-07-18}{Use \cs{protect}, not \cs{string} in \cs{PackageError} to quote macros like
+% shown in \texttt{clsguide.pdf}}
+% \changes{3.00}{2014-07-18}{Correct detailed error message, so `n' is one of available gender options}
+% \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 \protect\ordinalstring}%
+ {Available options are m, f or n}%
+ }%
+ \protect\@ordinalstringM{#1}{\@fc@ordstr}%
+ }%
+ }%
+ \@fc@ordstr
+ }%
+}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\storeordinalstring}
+% Store textual representation of number. First argument is
+% identifying name, second argument is the counter set to the
+% required number.
+% \begin{macrocode}
+\newcommand*{\storeordinalstring}[2]{%
+ \expandafter\protect\expandafter\storeordinalstringnum{#1}{%
+ \expandafter\the\csname c@#2\endcsname}%
+}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\storeordinalstringnum}
+% Store textual representation of number. First argument is
+% identifying name, second argument is a count register or number.
+% \begin{macrocode}
+\newcommand*{\storeordinalstringnum}[2]{%
+ \@ifnextchar[%
+ {\@store@ordinal@string{#1}{#2}}%
+ {\@store@ordinal@string{#1}{#2}[m]}%
+}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\@store@ordinal@string}
+% Store textual representation of number according to gender.
+% \changes{3.00}{2014-07-18}{Use \cs{protect}, not \cs{string} in \cs{PackageWarning} to quote macros like
+% shown in \texttt{clsguide.pdf}}
+% \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 \protect\ordinalstring}%
+ {Available options are m, f or n}%
+ }%
+ \protect\@ordinalstringM{#2}{\@fc@ordstr}%
+ }%
+ }%
+ \expandafter\let\csname @fcs@#1\endcsname\@fc@ordstr
+}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\Ordinalstring}
+% Display ordinal as a string with initial letters in upper case
+% (argument is a counter)
+% \begin{macrocode}
+\newcommand*{\Ordinalstring}[1]{%
+ \expandafter\protect\expandafter\Ordinalstringnum{%
+ \expandafter\the\csname c@#1\endcsname}%
+}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\Ordinalstringnum}
+% Display ordinal as a string with initial letters in upper case
+% (argument is a number or count register)
+%\changes{1.31}{2009/10/02}{replaced \cs{@ifnextchar} with
+%\cs{new@ifnextchar}}
+% \begin{macrocode}
+\newcommand*{\Ordinalstringnum}[1]{%
+ \new@ifnextchar[%
+ {\@Ordinal@string{#1}}%
+ {\@Ordinal@string{#1}[m]}%
+}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\@Ordinal@string}
+% Display ordinal as a string with initial letters in upper case
+% according to gender
+% \begin{macrocode}
+\def\@Ordinal@string#1[#2]{%
+ {%
+ \ifthenelse{\equal{#2}{f}}%
+ {%
+ \protect\@OrdinalstringF{#1}{\@fc@ordstr}%
+ }%
+ {%
+ \ifthenelse{\equal{#2}{n}}%
+ {%
+ \protect\@OrdinalstringN{#1}{\@fc@ordstr}%
+ }%
+ {%
+ \ifthenelse{\equal{#2}{m}}%
+ {}%
+ {%
+ \PackageError{fmtcount}%
+ {Invalid gender option `#2'}%
+ {Available options are m, f or n}%
+ }%
+ \protect\@OrdinalstringM{#1}{\@fc@ordstr}%
+ }%
+ }%
+ \@fc@ordstr
+ }%
+}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\storeOrdinalstring}
+% Store textual representation of number, with initial letters in
+% upper case. First argument is identifying name, second argument
+% is the counter set to the
+% required number.
+% \begin{macrocode}
+\newcommand*{\storeOrdinalstring}[2]{%
+ \expandafter\protect\expandafter\storeOrdinalstringnum{#1}{%
+ \expandafter\the\csname c@#2\endcsname}%
+}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\storeOrdinalstringnum}
+% Store textual representation of number, with initial letters in
+% upper case. First argument is identifying name, second argument
+% is a count register or number.
+% \begin{macrocode}
+\newcommand*{\storeOrdinalstringnum}[2]{%
+ \@ifnextchar[%
+ {\@store@Ordinal@string{#1}{#2}}%
+ {\@store@Ordinal@string{#1}{#2}[m]}%
+}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\@store@Ordinal@string}
+% Store textual representation of number according to gender,
+% with initial letters in upper case.
+% \begin{macrocode}
+\def\@store@Ordinal@string#1#2[#3]{%
+ \ifthenelse{\equal{#3}{f}}%
+ {%
+ \protect\@OrdinalstringF{#2}{\@fc@ordstr}%
+ }%
+ {%
+ \ifthenelse{\equal{#3}{n}}%
+ {%
+ \protect\@OrdinalstringN{#2}{\@fc@ordstr}%
+ }%
+ {%
+ \ifthenelse{\equal{#3}{m}}%
+ {}%
+ {%
+ \PackageError{fmtcount}%
+ {Invalid gender option `#3'}%
+ {Available options are m or f}%
+ }%
+ \protect\@OrdinalstringM{#2}{\@fc@ordstr}%
+ }%
+ }%
+ \expandafter\let\csname @fcs@#1\endcsname\@fc@ordstr
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\storeORDINALstring}
+% Store upper case textual representation of ordinal. The first
+% argument is identifying name, the second argument is a counter.
+% \begin{macrocode}
+\newcommand*{\storeORDINALstring}[2]{%
+ \expandafter\protect\expandafter\storeORDINALstringnum{#1}{%
+ \expandafter\the\csname c@#2\endcsname}%
+}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\storeORDINALstringnum}
+% As above, but the second argument is a count register or a
+% number.
+% \begin{macrocode}
+\newcommand*{\storeORDINALstringnum}[2]{%
+ \@ifnextchar[%
+ {\@store@ORDINAL@string{#1}{#2}}%
+ {\@store@ORDINAL@string{#1}{#2}[m]}%
+}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\@store@ORDINAL@string}
+% Gender is specified as an optional argument at the end.
+% \begin{macrocode}
+\def\@store@ORDINAL@string#1#2[#3]{%
+ \ifthenelse{\equal{#3}{f}}%
+ {%
+ \protect\@ordinalstringF{#2}{\@fc@ordstr}%
+ }%
+ {%
+ \ifthenelse{\equal{#3}{n}}%
+ {%
+ \protect\@ordinalstringN{#2}{\@fc@ordstr}%
+ }%
+ {%
+ \ifthenelse{\equal{#3}{m}}%
+ {}%
+ {%
+ \PackageError{fmtcount}%
+ {Invalid gender option `#3'}%
+ {Available options are m or f}%
+ }%
+ \protect\@ordinalstringM{#2}{\@fc@ordstr}%
+ }%
+ }%
+% \end{macrocode}
+% \changes{3.01}{2014-11-10}{Protect \cs{`}.}
+% \begin{macrocode}
+ \expandafter\protected@edef\csname @fcs@#1\endcsname{%
+ \noexpand\MakeUppercase{\@fc@ordstr}%
+ }%
+}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\ORDINALstring}
+% Display upper case textual representation of an ordinal. The
+% argument must be a counter.
+% \begin{macrocode}
+\newcommand*{\ORDINALstring}[1]{%
+ \expandafter\protect\expandafter\ORDINALstringnum{%
+ \expandafter\the\csname c@#1\endcsname
+ }%
+}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\ORDINALstringnum}
+% As above, but the argument is a count register or a number.
+%\changes{1.31}{2009/10/02}{replaced \cs{@ifnextchar} with
+%\cs{new@ifnextchar}}
+% \begin{macrocode}
+\newcommand*{\ORDINALstringnum}[1]{%
+ \new@ifnextchar[%
+ {\@ORDINAL@string{#1}}%
+ {\@ORDINAL@string{#1}[m]}%
+}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\@ORDINAL@string}
+% Gender is specified as an optional argument at the end.
+% \begin{macrocode}
+\def\@ORDINAL@string#1[#2]{%
+ {%
+ \ifthenelse{\equal{#2}{f}}%
+ {%
+ \protect\@ordinalstringF{#1}{\@fc@ordstr}%
+ }%
+ {%
+ \ifthenelse{\equal{#2}{n}}%
+ {%
+ \protect\@ordinalstringN{#1}{\@fc@ordstr}%
+ }%
+ {%
+ \ifthenelse{\equal{#2}{m}}%
+ {}%
+ {%
+ \PackageError{fmtcount}%
+ {Invalid gender option `#2'}%
+ {Available options are m, f or n}%
+ }%
+ \protect\@ordinalstringM{#1}{\@fc@ordstr}%
+ }%
+ }%
+ \MakeUppercase{\@fc@ordstr}%
+ }%
+}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\storenumberstring}
+% Convert number to textual respresentation, and store. First
+% argument is the identifying name, second argument is a counter
+% containing the number.
+% \begin{macrocode}
+\newcommand*{\storenumberstring}[2]{%
+ \expandafter\protect\expandafter\storenumberstringnum{#1}{%
+ \expandafter\the\csname c@#2\endcsname}%
+}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\storenumberstringnum}
+% As above, but second argument is a number or count register.
+% \begin{macrocode}
+\newcommand{\storenumberstringnum}[2]{%
+ \@ifnextchar[%
+ {\@store@number@string{#1}{#2}}%
+ {\@store@number@string{#1}{#2}[m]}%
+}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\@store@number@string}
+% Gender is given as optional argument, \emph{at the end}.
+% \begin{macrocode}
+\def\@store@number@string#1#2[#3]{%
+ \ifthenelse{\equal{#3}{f}}%
+ {%
+ \protect\@numberstringF{#2}{\@fc@numstr}%
+ }%
+ {%
+ \ifthenelse{\equal{#3}{n}}%
+ {%
+ \protect\@numberstringN{#2}{\@fc@numstr}%
+ }%
+ {%
+ \ifthenelse{\equal{#3}{m}}%
+ {}%
+ {%
+ \PackageError{fmtcount}
+ {Invalid gender option `#3'}%
+ {Available options are m, f or n}%
+ }%
+ \protect\@numberstringM{#2}{\@fc@numstr}%
+ }%
+ }%
+ \expandafter\let\csname @fcs@#1\endcsname\@fc@numstr
+}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\numberstring}
+% Display textual representation of a number. The argument
+% must be a counter.
+% \begin{macrocode}
+\newcommand*{\numberstring}[1]{%
+ \expandafter\protect\expandafter\numberstringnum{%
+ \expandafter\the\csname c@#1\endcsname}%
+}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\numberstringnum}
+% As above, but the argument is a count register or a number.
+%\changes{1.31}{2009/10/02}{replaced \cs{@ifnextchar} with
+%\cs{new@ifnextchar}}
+% \begin{macrocode}
+\newcommand*{\numberstringnum}[1]{%
+ \new@ifnextchar[%
+ {\@number@string{#1}}%
+ {\@number@string{#1}[m]}%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\@number@string}
+% Gender is specified as an optional argument \emph{at the end}.
+% \begin{macrocode}
+\def\@number@string#1[#2]{%
+ {%
+ \ifthenelse{\equal{#2}{f}}%
+ {%
+ \protect\@numberstringF{#1}{\@fc@numstr}%
+ }%
+ {%
+ \ifthenelse{\equal{#2}{n}}%
+ {%
+ \protect\@numberstringN{#1}{\@fc@numstr}%
+ }%
+ {%
+ \ifthenelse{\equal{#2}{m}}%
+ {}%
+ {%
+ \PackageError{fmtcount}%
+ {Invalid gender option `#2'}%
+ {Available options are m, f or n}%
+ }%
+ \protect\@numberstringM{#1}{\@fc@numstr}%
+ }%
+ }%
+ \@fc@numstr
+ }%
+}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\storeNumberstring}
+% Store textual representation of number. First argument is
+% identifying name, second argument is a counter.
+% \begin{macrocode}
+\newcommand*{\storeNumberstring}[2]{%
+ \expandafter\protect\expandafter\storeNumberstringnum{#1}{%
+ \expandafter\the\csname c@#2\endcsname}%
+}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\storeNumberstringnum}
+% As above, but second argument is a count register or number.
+% \begin{macrocode}
+\newcommand{\storeNumberstringnum}[2]{%
+ \@ifnextchar[%
+ {\@store@Number@string{#1}{#2}}%
+ {\@store@Number@string{#1}{#2}[m]}%
+}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\@store@Number@string}
+% Gender is specified as an optional argument \emph{at the end}:
+% \begin{macrocode}
+\def\@store@Number@string#1#2[#3]{%
+ \ifthenelse{\equal{#3}{f}}%
+ {%
+ \protect\@NumberstringF{#2}{\@fc@numstr}%
+ }%
+ {%
+ \ifthenelse{\equal{#3}{n}}%
+ {%
+ \protect\@NumberstringN{#2}{\@fc@numstr}%
+ }%
+ {%
+ \ifthenelse{\equal{#3}{m}}%
+ {}%
+ {%
+ \PackageError{fmtcount}%
+ {Invalid gender option `#3'}%
+ {Available options are m, f or n}%
+ }%
+ \protect\@NumberstringM{#2}{\@fc@numstr}%
+ }%
+ }%
+ \expandafter\let\csname @fcs@#1\endcsname\@fc@numstr
+}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\Numberstring}
+% Display textual representation of number. The argument must be
+% a counter.
+% \begin{macrocode}
+\newcommand*{\Numberstring}[1]{%
+ \expandafter\protect\expandafter\Numberstringnum{%
+ \expandafter\the\csname c@#1\endcsname}%
+}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\Numberstringnum}
+% As above, but the argument is a count register or number.
+%\changes{1.31}{2009/10/02}{replaced \cs{@ifnextchar} with
+%\cs{new@ifnextchar}}
+% \begin{macrocode}
+\newcommand*{\Numberstringnum}[1]{%
+ \new@ifnextchar[%
+ {\@Number@string{#1}}%
+ {\@Number@string{#1}[m]}%
+}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\@Number@string}
+% Gender is specified as an optional argument at the end.
+% \begin{macrocode}
+\def\@Number@string#1[#2]{%
+ {%
+ \ifthenelse{\equal{#2}{f}}%
+ {%
+ \protect\@NumberstringF{#1}{\@fc@numstr}%
+ }%
+ {%
+ \ifthenelse{\equal{#2}{n}}%
+ {%
+ \protect\@NumberstringN{#1}{\@fc@numstr}%
+ }%
+ {%
+ \ifthenelse{\equal{#2}{m}}%
+ {}%
+ {%
+ \PackageError{fmtcount}%
+ {Invalid gender option `#2'}%
+ {Available options are m, f or n}%
+ }%
+ \protect\@NumberstringM{#1}{\@fc@numstr}%
+ }%
+ }%
+ \@fc@numstr
+ }%
+}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\storeNUMBERstring}
+% Store upper case textual representation of number. The first
+% argument is identifying name, the second argument is a counter.
+% \begin{macrocode}
+\newcommand{\storeNUMBERstring}[2]{%
+ \expandafter\protect\expandafter\storeNUMBERstringnum{#1}{%
+ \expandafter\the\csname c@#2\endcsname}%
+}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\storeNUMBERstringnum}
+% As above, but the second argument is a count register or a
+% number.
+% \begin{macrocode}
+\newcommand{\storeNUMBERstringnum}[2]{%
+ \@ifnextchar[%
+ {\@store@NUMBER@string{#1}{#2}}%
+ {\@store@NUMBER@string{#1}{#2}[m]}%
+}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\@store@NUMBER@string}
+% Gender is specified as an optional argument at the end.
+% \begin{macrocode}
+\def\@store@NUMBER@string#1#2[#3]{%
+ \ifthenelse{\equal{#3}{f}}%
+ {%
+ \protect\@numberstringF{#2}{\@fc@numstr}%
+ }%
+ {%
+ \ifthenelse{\equal{#3}{n}}%
+ {%
+ \protect\@numberstringN{#2}{\@fc@numstr}%
+ }%
+ {%
+ \ifthenelse{\equal{#3}{m}}%
+ {}%
+ {%
+ \PackageError{fmtcount}%
+ {Invalid gender option `#3'}%
+ {Available options are m or f}%
+ }%
+ \protect\@numberstringM{#2}{\@fc@numstr}%
+ }%
+ }%
+ \expandafter\edef\csname @fcs@#1\endcsname{%
+ \noexpand\MakeUppercase{\@fc@numstr}%
+ }%
+}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\NUMBERstring}
+% Display upper case textual representation of a number. The
+% argument must be a counter.
+% \begin{macrocode}
+\newcommand*{\NUMBERstring}[1]{%
+ \expandafter\protect\expandafter\NUMBERstringnum{%
+ \expandafter\the\csname c@#1\endcsname}%
+}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\NUMBERstringnum}
+% As above, but the argument is a count register or a number.
+%\changes{1.31}{2009/10/02}{replaced \cs{@ifnextchar} with
+%\cs{new@ifnextchar}}
+% \begin{macrocode}
+\newcommand*{\NUMBERstringnum}[1]{%
+ \new@ifnextchar[%
+ {\@NUMBER@string{#1}}%
+ {\@NUMBER@string{#1}[m]}%
+}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\@NUMBER@string}
+% Gender is specified as an optional argument at the end.
+% \begin{macrocode}
+\def\@NUMBER@string#1[#2]{%
+ {%
+ \ifthenelse{\equal{#2}{f}}%
+ {%
+ \protect\@numberstringF{#1}{\@fc@numstr}%
+ }%
+ {%
+ \ifthenelse{\equal{#2}{n}}%
+ {%
+ \protect\@numberstringN{#1}{\@fc@numstr}%
+ }%
+ {%
+ \ifthenelse{\equal{#2}{m}}%
+ {}%
+ {%
+ \PackageError{fmtcount}%
+ {Invalid gender option `#2'}%
+ {Available options are m, f or n}%
+ }%
+ \protect\@numberstringM{#1}{\@fc@numstr}%
+ }%
+ }%
+ \MakeUppercase{\@fc@numstr}%
+ }%
+}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\binary}
+% Number representations in other bases. Binary:
+% \begin{macrocode}
+\providecommand*{\binary}[1]{%
+ \expandafter\protect\expandafter\@binary{%
+ \expandafter\the\csname c@#1\endcsname}%
+}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\aaalph}
+% Like \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}%
+}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\AAAlph}
+% As before, but upper case.
+% \begin{macrocode}
+\providecommand*{\AAAlph}[1]{%
+ \expandafter\protect\expandafter\@AAAlph{%
+ \expandafter\the\csname c@#1\endcsname}%
+}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\abalph}
+% Like \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}%
+}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\ABAlph}
+% As above, but upper case.
+% \begin{macrocode}
+\providecommand*{\ABAlph}[1]{%
+ \expandafter\protect\expandafter\@ABAlph{%
+ \expandafter\the\csname c@#1\endcsname}%
+}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\hexadecimal}
+% Hexadecimal:
+% \begin{macrocode}
+\providecommand*{\hexadecimal}[1]{%
+ \expandafter\protect\expandafter\@hexadecimal{%
+ \expandafter\the\csname c@#1\endcsname}%
+}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\Hexadecimal}
+% As above, but in upper case.
+% \begin{macrocode}
+\providecommand*{\Hexadecimal}[1]{%
+ \expandafter\protect\expandafter\@Hexadecimal{%
+ \expandafter\the\csname c@#1\endcsname}%
+}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\octal}
+% Octal:
+% \begin{macrocode}
+\providecommand*{\octal}[1]{%
+ \expandafter\protect\expandafter\@octal{%
+ \expandafter\the\csname c@#1\endcsname}%
+}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\decimal}
+% Decimal:
+% \begin{macrocode}
+\providecommand*{\decimal}[1]{%
+ \expandafter\protect\expandafter\@decimal{%
+ \expandafter\the\csname c@#1\endcsname}%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\subsection{Multilinguage Definitions}
+%\begin{macro}{\@setdef@ultfmtcount}
+% If multilingual support is provided, make \cs{@numberstring}
+% etc use the correct language (if defined).
+% Otherwise use English definitions. \cs{@setdef@ultfmtcount}
+% sets the macros to use English.
+% \begin{macrocode}
+\def\@setdef@ultfmtcount{%
+ \ifcsundef{@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
+ \let\fmtord\fc@orddef@ult
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\fc@multiling}
+%\changes{2.02}{2012-10-24}{new}
+%\cs{fc@multiling}\marg{name}\marg{gender}
+%\changes{3.00}{2014-07-18}{Use \cs{protect}, not \cs{string} in \cs{PackageWarning} to quote macros like
+% shown in \texttt{clsguide.pdf}}
+% \begin{macrocode}
+\newcommand*{\fc@multiling}[2]{%
+ \ifcsundef{@#1#2\languagename}%
+ {% try loading it
+ \FCloadlang{\languagename}%
+ }%
+ {%
+ }%
+ \ifcsundef{@#1#2\languagename}%
+ {%
+ \PackageWarning{fmtcount}%
+ {No support for \expandafter\protect\csname #1\endcsname\space for
+ language '\languagename'}%
+ \ifthenelse{\equal{\languagename}{\fc@mainlang}}%
+ {%
+ \FCloadlang{english}%
+ }%
+ {%
+ }%
+ \ifcsdef{@#1#2\fc@mainlang}%
+ {%
+ \csuse{@#1#2\fc@mainlang}%
+ }%
+ {%
+ \PackageWarningNoLine{fmtcount}%
+ {No languages loaded at all! Loading english definitions}%
+ \FCloadlang{english}%
+ \def\fc@mainlang{english}%
+ \csuse{@#1#2english}%
+ }%
+ }%
+ {%
+ \csuse{@#1#2\languagename}%
+ }%
+}
+% \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{%
+ \fc@multiling{numberstring}{M}%
+ }%
+% \end{macrocode}
+% The feminine version of \cs{numberstring}:
+% \begin{macrocode}
+ \def\@numberstringF{%
+ \fc@multiling{numberstring}{F}%
+ }%
+% \end{macrocode}
+% The neuter version of \cs{numberstring}:
+% \begin{macrocode}
+ \def\@numberstringN{%
+ \fc@multiling{numberstring}{N}%
+ }%
+% \end{macrocode}
+% The masculine version of \cs{Numberstring}:
+% \begin{macrocode}
+ \def\@NumberstringM{%
+ \fc@multiling{Numberstring}{M}%
+ }%
+% \end{macrocode}
+% The feminine version of \cs{Numberstring}:
+% \begin{macrocode}
+ \def\@NumberstringF{%
+ \fc@multiling{Numberstring}{F}%
+ }%
+% \end{macrocode}
+% The neuter version of \cs{Numberstring}:
+% \begin{macrocode}
+ \def\@NumberstringN{%
+ \fc@multiling{Numberstring}{N}%
+ }%
+% \end{macrocode}
+% The masculine version of \cs{ordinal}:
+% \begin{macrocode}
+ \def\@ordinalM{%
+ \fc@multiling{ordinal}{M}%
+ }%
+% \end{macrocode}
+% The feminine version of \cs{ordinal}:
+% \begin{macrocode}
+ \def\@ordinalF{%
+ \fc@multiling{ordinal}{F}%
+ }%
+% \end{macrocode}
+% The neuter version of \cs{ordinal}:
+% \begin{macrocode}
+ \def\@ordinalN{%
+ \fc@multiling{ordinal}{N}%
+ }%
+% \end{macrocode}
+% The masculine version of \cs{ordinalstring}:
+% \begin{macrocode}
+ \def\@ordinalstringM{%
+ \fc@multiling{ordinalstring}{M}%
+ }%
+% \end{macrocode}
+% The feminine version of \cs{ordinalstring}:
+% \begin{macrocode}
+ \def\@ordinalstringF{%
+ \fc@multiling{ordinalstring}{F}%
+ }%
+% \end{macrocode}
+% The neuter version of \cs{ordinalstring}:
+% \begin{macrocode}
+ \def\@ordinalstringN{%
+ \fc@multiling{ordinalstring}{N}%
+ }%
+% \end{macrocode}
+% The masculine version of \cs{Ordinalstring}:
+% \begin{macrocode}
+ \def\@OrdinalstringM{%
+ \fc@multiling{Ordinalstring}{M}%
+ }%
+% \end{macrocode}
+% The feminine version of \cs{Ordinalstring}:
+% \begin{macrocode}
+ \def\@OrdinalstringF{%
+ \fc@multiling{Ordinalstring}{F}%
+ }%
+% \end{macrocode}
+% The neuter version of \cs{Ordinalstring}:
+% \begin{macrocode}
+ \def\@OrdinalstringN{%
+ \fc@multiling{Ordinalstring}{N}%
+ }%
+% \end{macrocode}
+% Make \cs{fmtord} language dependent:
+% \changes{3.01}{2014-12-18}{Make \cs{fmtord} language dependent.}
+% \begin{macrocode}
+ \let\fmtord\fc@ord@multiling
+}
+% \end{macrocode}
+%\end{macro}
+% Check to see if \styfmt{babel}, \styfmt{polyglossia} or \styfmt{ngerman} packages have been loaded, and if
+% yes set \styfmt{fmtcount} in multiling.
+% \begin{macrocode}
+\expandafter\@ifpackageloaded
+\expandafter{\ifxetex polyglossia\else babel\fi}%
+{%
+ \@set@mulitling@fmtcount
+}%
+{%
+ \@ifpackageloaded{ngerman}%
+ {%
+ \FCloadlang{ngerman}%
+ \@set@mulitling@fmtcount
+ }%
+ {%
+% \end{macrocode}
+% In the case that neither babel/polyglossia, nor ngerman has been loaded, then we go to multiling if a
+% language has been loaded by package option, and to delfault language otherwise.
+% \begin{macrocode}
+ \iffmtcount@language@option
+ \@set@mulitling@fmtcount
+% \end{macrocode}
+% Some sanity check at the beginning of document may help the end user understand what is wrong:
+% \begin{macrocode}
+ \AtBeginDocument{%
+ \ifcsundef{languagename}%
+ {%
+ \PackageWarning{fmtcount}{%
+ `\protect\languagename' is undefined, you should use package babel/polyglossia when loading a
+ language via package option. Reverting to default language.
+ }%
+ \@setdef@ultfmtcount
+ }{%
+ \@FC@iflangloaded{\languagename}{}{%
+% \end{macrocode}
+% The current \cs{languagename} is not a language that has been previously loaded. The correction is to have
+% \cs{languagename} let to \cs{fc@mainlang}. Please note that, as \cs{iffmtcount@language@option} is true,
+% we know that \texttt{fmtcount} has loaded some language.
+% \begin{macrocode}
+ \PackageWarning{fmtcount}{%
+ Setting `\protect\languagename' to `\fc@mainlang'.\MessageBreak
+ Reason is that `\protect\languagename' was `\languagename',\MessageBreak
+ but `\languagename' was not loaded by fmtcount,\MessageBreak
+ whereas `\fc@mainlang' was the last language loaded by fmtcount ;
+ }%
+ \let\languagename\fc@mainlang
+ }
+ }%
+ }
+ \else
+ \@setdef@ultfmtcount
+ \fi
+ }%
+}
+% \end{macrocode}
+% \changes{3.01}{2014-12-21}{Substitute \cs{textsuperscript} for \cs{fc@textsuperscript}, and define
+% \cs{fc@textsuperscript} as \cs{fup} when defined at beginning of document, or as \cs{textsuperscript}
+% otherwise}
+% \begin{macrocode}
+\AtBeginDocument{%
+ \ifcsundef{FBsupR}{\let\fc@textsuperscript\textsuperscript}{\let\fc@textsuperscript\fup}%
+}
+% \end{macrocode}
+% Backwards compatibility:
+% \begin{macrocode}
+\let\@ordinal=\@ordinalM
+\let\@ordinalstring=\@ordinalstringM
+\let\@Ordinalstring=\@OrdinalstringM
+\let\@numberstring=\@numberstringM
+\let\@Numberstring=\@NumberstringM
+% \end{macrocode}
+\iffalse Local variables: \fi
+\iffalse mode: docTeX \fi
+\iffalse End: \fi
+%\iffalse
+% \begin{macrocode}
+%</fmtcount.sty>
+% \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 40258ccff79..5a40522adae 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 2014/7/28 7:55
+% fmtcount.ins generated using makedtx version 0.94b 2015/5/8 16:50
\input docstrip
\preamble
fmtcount.dtx
- Copyright 2014 Nicola Talbot and Vincent Belaïche
+ Copyright 2015 Nicola Talbot and Vincent Belaïche
This work may be distributed and/or modified under the
conditions of the LaTeX Project Public License, either version 1.3
@@ -18,19 +18,13 @@
The Current Maintainer of this work is Nicola Talbot and Vincent Belaïche.
- 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-portuguese.def, fc-spanish.def, fc-UKenglish.def, fc-USenglish.def.
+ This work consists of the files fmtcount.dtx and fmtcount.ins and the derived files 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-portuguese.def, fc-spanish.def, fc-UKenglish.def, fc-USenglish.def, fcnumparser.sty, fcprefix.sty, fmtcount.sty.
\endpreamble
\askforoverwritefalse
-\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
+\generate{\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}}
@@ -62,6 +56,12 @@
\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{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}}
}
\endbatchfile