diff options
author | Karl Berry <karl@freefriends.org> | 2007-04-24 23:55:24 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2007-04-24 23:55:24 +0000 |
commit | c65c25c59074eaa09621f4fd782362b2c5227e32 (patch) | |
tree | 70d64612457606868bfbc0f31af7dc82dde56ab5 | |
parent | 0f300547ff60c57ac58422c1d92660da8bf5efb0 (diff) |
fmtcount 1.09 (24apr07)
git-svn-id: svn://tug.org/texlive/trunk@4182 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r-- | Master/texmf-dist/doc/latex/fmtcount/CHANGES | 11 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/fmtcount/README | 4 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/fmtcount/fc-lang.tex | 14 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/fmtcount/fc-samp.tex | 3 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/fmtcount/fmtcount.pdf | bin | 121492 -> 133652 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/latex/fmtcount/fmtcount.perl | 470 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/fmtcount/manual.html | 148 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/fmtcount/fmtcount.dtx | 3058 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/fmtcount/fmtcount.ins | 2 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/fmtcount/fc-english.def | 345 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/fmtcount/fc-french.def | 572 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/fmtcount/fc-portuges.def | 323 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/fmtcount/fc-spanish.def | 266 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/fmtcount/fmtcount.sty | 223 | ||||
-rw-r--r-- | Master/texmf-dist/tpm/fmtcount.tpm | 4 |
15 files changed, 3924 insertions, 1519 deletions
diff --git a/Master/texmf-dist/doc/latex/fmtcount/CHANGES b/Master/texmf-dist/doc/latex/fmtcount/CHANGES index 412416bd5d7..13afa7d9565 100644 --- a/Master/texmf-dist/doc/latex/fmtcount/CHANGES +++ b/Master/texmf-dist/doc/latex/fmtcount/CHANGES @@ -1,5 +1,16 @@ fmtcount package versions: +Version 1.09: Added upper case variants \ORDINALstring etc +(\MakeUppercase{\ordinalstring{<counter>}} doesn't work because +of the way \MakeUppercase expands its argument). + +Added commands to store textual representations \storeordinalstring etc + +Version 1.08: fixed Portugues spelling mistakes (tr\`es -> tr\^es +centa -> cento) + +Version 1.07: fixed bug that causes fc-english.def to be loaded twice + Version 1.06: fixed language-related bug Version 1.05: fixed bug in \padzeroes diff --git a/Master/texmf-dist/doc/latex/fmtcount/README b/Master/texmf-dist/doc/latex/fmtcount/README index bad070ef6f2..6d2c2d426f0 100644 --- a/Master/texmf-dist/doc/latex/fmtcount/README +++ b/Master/texmf-dist/doc/latex/fmtcount/README @@ -1,6 +1,6 @@ -LaTeX Package : fmtcount v 1.06 +LaTeX Package : fmtcount v 1.09 -Last Modified : 6 January 2007 +Last Modified : 21 April 2007 Author : Nicola Talbot diff --git a/Master/texmf-dist/doc/latex/fmtcount/fc-lang.tex b/Master/texmf-dist/doc/latex/fmtcount/fc-lang.tex index 3600e0b5abd..0c81dc887fd 100644 --- a/Master/texmf-dist/doc/latex/fmtcount/fc-lang.tex +++ b/Master/texmf-dist/doc/latex/fmtcount/fc-lang.tex @@ -138,8 +138,10 @@ Current language: French (Belgium). \typeout{Which format?^^J} \typeout{[1] ordinalstring} \typeout{[2] Ordinalstring} -\typeout{[3] numberstring} -\typeout{[4] Numberstring} +\typeout{[3] ORDINALstring} +\typeout{[4] numberstring} +\typeout{[5] Numberstring} +\typeout{[6] NUMBERstring} \typein[\response]{Default: 1} @@ -147,16 +149,20 @@ Current language: French (Belgium). \ifthenelse{\equal{\response}{1}}{\myctr=1}{ \ifthenelse{\equal{\response}{2}}{\myctr=2}{ \ifthenelse{\equal{\response}{3}}{\myctr=3}{ -\ifthenelse{\equal{\response}{4}}{\myctr=4}{\myctr=-1 -\typeout{Invalid response '\response', please select a number from 1 to 4}}}}} +\ifthenelse{\equal{\response}{4}}{\myctr=4}{ +\ifthenelse{\equal{\response}{5}}{\myctr=5}{ +\ifthenelse{\equal{\response}{6}}{\myctr=6}{\myctr=-1 +\typeout{Invalid response '\response', please select a number from 1 to 4}}}}}}} \ifnum\myctr=-1 \repeat \ifcase\myctr \or\def\stringtype{ordinalstring} \or\def\stringtype{Ordinalstring} +\or\def\stringtype{ORDINALstring} \or\def\stringtype{numberstring} \or\def\stringtype{Numberstring} +\or\def\stringtype{NUMBERstring} \fi \ifnum\langid>3 diff --git a/Master/texmf-dist/doc/latex/fmtcount/fc-samp.tex b/Master/texmf-dist/doc/latex/fmtcount/fc-samp.tex index 4c5a6e47f4e..1a18321c004 100644 --- a/Master/texmf-dist/doc/latex/fmtcount/fc-samp.tex +++ b/Master/texmf-dist/doc/latex/fmtcount/fc-samp.tex @@ -120,7 +120,8 @@ numberstring Referencing a label: \ref{ex}. Passing numbers explicitly: \ordinalnum{10}, -\Numberstringnum{10}, \Ordinalstringnum{10}. +\Numberstringnum{10}, \NUMBERstringnum{10}, \Ordinalstringnum{10}, +\ORDINALstringnum{10}. \end{document} \endinput diff --git a/Master/texmf-dist/doc/latex/fmtcount/fmtcount.pdf b/Master/texmf-dist/doc/latex/fmtcount/fmtcount.pdf Binary files differindex 8f4ba512f43..64163d43156 100644 --- a/Master/texmf-dist/doc/latex/fmtcount/fmtcount.pdf +++ b/Master/texmf-dist/doc/latex/fmtcount/fmtcount.pdf diff --git a/Master/texmf-dist/doc/latex/fmtcount/fmtcount.perl b/Master/texmf-dist/doc/latex/fmtcount/fmtcount.perl index 875f41febc1..2cf6bb3a091 100644 --- a/Master/texmf-dist/doc/latex/fmtcount/fmtcount.perl +++ b/Master/texmf-dist/doc/latex/fmtcount/fmtcount.perl @@ -1,7 +1,7 @@ # File : fmtcount.perl # Author : Nicola Talbot -# Date : 3 Mar 2005 -# Version : 1.02 +# Date : 21 April 2007 +# Version : 1.04 # Description : LaTeX2HTML implementation of fmtcount package package main; @@ -171,6 +171,58 @@ sub do_cmd_ordinal{ } } +sub do_cmd_storeordinal{ + local($_) = @_; + local($key); + + $key = &missing_braces + unless ((s/$next_pair_pr_rx//o)&&($key=$2)); + + local($ctr, $val, $id, $_) = &read_counter_value($_); + local($gender)='m'; + + $_ =~ s/${OP}$id${CP}$ctr${OP}$id${CP}//; + + if ($_ =~s/\s*\[(.)\]//) + { + $gender = $1; + } + + if ($ctr eq 'DAY' or $ctr eq 'MONTH' or $ctr eq 'YEAR') + { + # this is a cludge to make it work with newdateformat + $fmtcntvar{$key} = join('', '{ORDINAL{', $ctr, '}}'); + } + else + { + $fmtcntvar{$key} = &getordinal($val, $gender); + } + + $_; +} + +sub do_cmd_storeordinalnum{ + local($_) = @_; + local($key, $val); + + $key = &missing_braces + unless ((s/$next_pair_pr_rx//o)&&($key=$2)); + + $val = &missing_braces + unless ((s/$next_pair_pr_rx//o)&&($val=$2)); + + local($gender)='m'; + + if ($_ =~s/\s*\[(.)\]//) + { + $gender = $1; + } + + $fmtcntvar{$key} = &getordinal($val, $gender); + + $_; +} + @unitthstring = ('zeroth', 'first', 'second', @@ -496,7 +548,7 @@ $thousandthnamespanish = "mil\\'esimo"; @unitstringportuges = ('zero', 'um', 'dois', - 'tr\`es', + 'tr\^es', 'quatro', 'cinco', 'seis', @@ -762,7 +814,7 @@ sub get_numberstringportuges{ { $hundreds = $hundredstringportuges[$num/100]; - if ($gender eq 'f') + if ($gender eq 'f' and $num >= 200) { $hundreds =~s/o(s?)$/a\1/; } @@ -860,6 +912,58 @@ sub do_cmd_numberstring{ } } +sub do_cmd_storenumberstring{ + local($_) = @_; + local($key); + + $key = &missing_braces + unless ((s/$next_pair_pr_rx//o)&&($key=$2)); + + local($ctr, $val, $id, $_) = &read_counter_value($_); + local($gender)='m'; + + $_ =~ s/${OP}$id${CP}$ctr${OP}$id${CP}//; + + if ($_ =~s/\s*\[(.)\]//) + { + $gender = $1; + } + + if ($ctr eq 'DAY' or $ctr eq 'MONTH' or $ctr eq 'YEAR') + { + # this is a cludge to make it work with newdateformat + $fmtcntvar{$key} = join('', '{NUMBERSTRING{', $ctr, '}}'); + } + else + { + $fmtcntvar{$key} = join('', &get_numberstring($val, $gender)); + } + + $_; +} + +sub do_cmd_storenumberstringnum{ + local($_) = @_; + local($key, $val); + + $key = &missing_braces + unless ((s/$next_pair_pr_rx//o)&&($key=$2)); + + $val = &missing_braces + unless ((s/$next_pair_pr_rx//o)&&($val=$2)); + + local($gender)='m'; + + if ($_ =~s/\s*\[(.)\]//) + { + $gender = $1; + } + + $fmtcntvar{$key} = join('', &get_numberstring($val, $gender)); + + $_; +} + sub get_Numberstring{ local($val,$gender) = @_; local($string) = &get_numberstring($val,$gender); @@ -925,6 +1029,150 @@ sub do_cmd_Numberstring{ } } +sub do_cmd_storeNumberstring{ + local($_) = @_; + local($key); + + $key = &missing_braces + unless ((s/$next_pair_pr_rx//o)&&($key=$2)); + + local($ctr, $val, $id, $_) = &read_counter_value($_); + local($gender)='m'; + + $_ =~ s/${OP}$id${CP}$ctr${OP}$id${CP}//; + + if ($_ =~s/\s*\[(.)\]//) + { + $gender = $1; + } + + if ($ctr eq 'DAY' or $ctr eq 'MONTH' or $ctr eq 'YEAR') + { + # this is a cludge to make it work with newdateformat + $fmtcntvar{$key} = join('', '{NNUMBERSTRING{', $ctr, '}}'); + } + else + { + $fmtcntvar{$key} = join('', &get_Numberstring($val, $gender)); + } + + $_; +} + +sub do_cmd_storeNumberstringnum{ + local($_) = @_; + local($key, $val); + + $key = &missing_braces + unless ((s/$next_pair_pr_rx//o)&&($key=$2)); + + $val = &missing_braces + unless ((s/$next_pair_pr_rx//o)&&($val=$2)); + + local($gender)='m'; + + if ($_ =~s/\s*\[(.)\]//) + { + $gender = $1; + } + + $fmtcntvar{$key} = join('', &get_Numberstring($val, $gender)); + + $_; +} + +sub do_cmd_NUMBERstringnum{ + local($_) = @_; + local($num,$gender); + $num = &missing_braces + unless (($_[0]=~s/$next_pair_pr_rx//o)&&($num=$2)); + + if ($_[0] =~ s/\[(m|f)\]//) + { + $gender = $1; + } + else + { + $gender = 'm'; + } + + join('', uc(&get_numberstring($num,$gender)), $_[0]); +} + +sub do_cmd_NUMBERstring{ + local($ctr, $val, $id, $_) = &read_counter_value($_[0]); + local($gender)='m'; + + $_[0] =~ s/${OP}$id${CP}$ctr${OP}$id${CP}//; + + if ($_[0]=~s/\[(.)\]//) + { + $gender = $1; + } + + if ($ctr eq 'DAY' or $ctr eq 'MONTH' or $ctr eq 'YEAR') + { + # this is a cludge to make it work with newdateformat + join('', '{CAPNUMBERSTRING{', $ctr, '}}', $_); + } + else + { + join('', uc(&get_numberstring($val, $gender)), $_); + } +} + +sub do_cmd_storeNUMBERstring{ + local($_) = @_; + local($key); + + $key = &missing_braces + unless ((s/$next_pair_pr_rx//o)&&($key=$2)); + + local($ctr, $val, $id, $_) = &read_counter_value($_); + local($gender)='m'; + + $_ =~ s/${OP}$id${CP}$ctr${OP}$id${CP}//; + + if ($_ =~s/\s*\[(.)\]//) + { + $gender = $1; + } + + if ($ctr eq 'DAY' or $ctr eq 'MONTH' or $ctr eq 'YEAR') + { + # this is a cludge to make it work with newdateformat + $fmtcntvar{$key} = join('', '{CAPNUMBERSTRING{', $ctr, '}}'); + } + else + { + $fmtcntvar{$key} = uc(&get_numberstring($val, $gender)); + } + + $_; +} + +sub do_cmd_storeNUMBERstringnum{ + local($_) = @_; + local($key, $val); + + $key = &missing_braces + unless ((s/$next_pair_pr_rx//o)&&($key=$2)); + + $val = &missing_braces + unless ((s/$next_pair_pr_rx//o)&&($val=$2)); + + local($gender)='m'; + + if ($_ =~s/\s*\[(.)\]//) + { + $gender = $1; + } + + $fmtcntvar{$key} = uc(&get_numberstring($val, $gender)); + + $_; +} + sub get_ordinalstringenglish{ local($num) = @_; local($name)=""; @@ -1361,18 +1609,82 @@ sub do_cmd_ordinalstring{ if ($ctr eq 'DAY' or $ctr eq 'MONTH' or $ctr eq 'YEAR') { # this is a cludge to make it work with newdateformat - join('', '{ORDINALSTRING{', $ctr, '}}', $_[0]); + join('', '{ORDINALSTRING{', $ctr, '}}', $_); } else { - join('', &get_ordinalstring($val, $gender), $_[0]); + join('', &get_ordinalstring($val, $gender), $_); } } + %fmtcntvar = (); + +sub do_cmd_FMCuse{ + local($_) = @_; + local($key); + + $key = &missing_braces + unless ((s/$next_pair_pr_rx//o)&&($key=$2)); + + $fmtcntvar{$key}.$_; +} + +sub do_cmd_storeordinalstring{ + local($_) = @_; + local($key); + + $key = &missing_braces + unless ((s/$next_pair_pr_rx//o)&&($key=$2)); + + local($ctr, $val, $id, $_) = &read_counter_value($_); + local($gender)='m'; + + $_ =~ s/${OP}$id${CP}$ctr${OP}$id${CP}//; + + if ($_ =~s/\s*\[(.)\]//) + { + $gender = $1; + } + + if ($ctr eq 'DAY' or $ctr eq 'MONTH' or $ctr eq 'YEAR') + { + # this is a cludge to make it work with newdateformat + $fmtcntvar{$key} = join('', '{ORDINALSTRING{', $ctr, '}}'); + } + else + { + $fmtcntvar{$key} = join('', &get_ordinalstring($val, $gender)); + } + + $_; +} + +sub do_cmd_storeordinalstringnum{ + local($_) = @_; + local($key, $val); + + $key = &missing_braces + unless ((s/$next_pair_pr_rx//o)&&($key=$2)); + + $val = &missing_braces + unless ((s/$next_pair_pr_rx//o)&&($val=$2)); + + local($gender)='m'; + + if ($_ =~s/\s*\[(.)\]//) + { + $gender = $1; + } + + $fmtcntvar{$key} = join('', &get_ordinalstring($val, $gender)); + + $_; +} + sub get_Ordinalstring{ local($val,$gender) = @_; local($string) = &get_ordinalstring($val,$gender); - $string =~ s/([a-z])([^\s\-]+)/\u\1\2/g; + $string =~ s/\b([a-z])([^\s\-]+)/\u\1\2/g; if ($default_language eq 'french') { @@ -1426,6 +1738,150 @@ sub do_cmd_Ordinalstring{ } } +sub do_cmd_storeOrdinalstring{ + local($_) = @_; + local($key); + + $key = &missing_braces + unless ((s/$next_pair_pr_rx//o)&&($key=$2)); + + local($ctr, $val, $id, $_) = &read_counter_value($_); + local($gender)='m'; + + $_ =~ s/${OP}$id${CP}$ctr${OP}$id${CP}//; + + if ($_ =~s/\s*\[(.)\]//) + { + $gender = $1; + } + + if ($ctr eq 'DAY' or $ctr eq 'MONTH' or $ctr eq 'YEAR') + { + # this is a cludge to make it work with newdateformat + $fmtcntvar{$key} = join('', '{OORDINALSTRING{', $ctr, '}}'); + } + else + { + $fmtcntvar{$key} = join('', &get_Ordinalstring($val, $gender)); + } + + $_; +} + +sub do_cmd_storeOrdinalstringnum{ + local($_) = @_; + local($key, $val); + + $key = &missing_braces + unless ((s/$next_pair_pr_rx//o)&&($key=$2)); + + $val = &missing_braces + unless ((s/$next_pair_pr_rx//o)&&($val=$2)); + + local($gender)='m'; + + if ($_ =~s/\s*\[(.)\]//) + { + $gender = $1; + } + + $fmtcntvar{$key} = join('', &get_Ordinalstring($val, $gender)); + + $_; +} + +sub do_cmd_ORDINALstringnum{ + local($_) = @_; + local($num,$gender); + $num = &missing_braces + unless (($_[0]=~s/$next_pair_pr_rx//o)&&($num=$2)); + + if ($_[0] =~ s/\[(m|f)\]//) + { + $gender = $1; + } + else + { + $gender = 'm'; + } + + join('', uc(&get_ordinalstring($num,$gender)), $_[0]); +} + +sub do_cmd_ORDINALstring{ + local($ctr, $val, $id, $_) = &read_counter_value($_[0]); + local($gender)='m'; + + $_[0] =~ s/${OP}$id${CP}$ctr${OP}$id${CP}//; + + if ($_[0]=~s/\[(.)\]//) + { + $gender = $1; + } + + if ($ctr eq 'DAY' or $ctr eq 'MONTH' or $ctr eq 'YEAR') + { + # this is a cludge to make it work with newdateformat + join('', '{CAPORDINALSTRING{', $ctr, '}}', $_); + } + else + { + join('', uc(&get_ordinalstring($val, $gender)), $_); + } +} + +sub do_cmd_storeORDINALstring{ + local($_) = @_; + local($key); + + $key = &missing_braces + unless ((s/$next_pair_pr_rx//o)&&($key=$2)); + + local($ctr, $val, $id, $_) = &read_counter_value($_); + local($gender)='m'; + + $_ =~ s/${OP}$id${CP}$ctr${OP}$id${CP}//; + + if ($_ =~s/\s*\[(.)\]//) + { + $gender = $1; + } + + if ($ctr eq 'DAY' or $ctr eq 'MONTH' or $ctr eq 'YEAR') + { + # this is a cludge to make it work with newdateformat + $fmtcntvar{$key} = join('', '{CAPORDINALSTRING{', $ctr, '}}'); + } + else + { + $fmtcntvar{$key} = uc(&get_ordinalstring($val, $gender)); + } + + $_; +} + +sub do_cmd_storeORDINALstringnum{ + local($_) = @_; + local($key, $val); + + $key = &missing_braces + unless ((s/$next_pair_pr_rx//o)&&($key=$2)); + + $val = &missing_braces + unless ((s/$next_pair_pr_rx//o)&&($val=$2)); + + local($gender)='m'; + + if ($_ =~s/\s*\[(.)\]//) + { + $gender = $1; + } + + $fmtcntvar{$key} = uc(&get_ordinalstring($val, $gender)); + + $_; +} + sub do_cmd_fmtcountsetoptions{ local($_) = @_; local($options) = &missing_braces unless ($_[0]=~(s/$next_pair_pr_rx//o)&&($options=$2)); diff --git a/Master/texmf-dist/doc/latex/fmtcount/manual.html b/Master/texmf-dist/doc/latex/fmtcount/manual.html index d8ae7bd7712..c1cbfa97cc8 100644 --- a/Master/texmf-dist/doc/latex/fmtcount/manual.html +++ b/Master/texmf-dist/doc/latex/fmtcount/manual.html @@ -7,8 +7,8 @@ original version by: Nikos Drakos, CBLU, University of Leeds Jens Lippmann, Marek Rouchal, Martin Wilck and others --> <HTML> <HEAD> -<TITLE>fmtcount.sty v1.06: Displaying the Values of LaTeX Counters</TITLE> -<META NAME="description" CONTENT="fmtcount.sty v1.06: Displaying the Values of LaTeX Counters"> +<TITLE>fmtcount.sty v1.09: Displaying the Values of LaTeX Counters</TITLE> +<META NAME="description" CONTENT="fmtcount.sty v1.09: Displaying the Values of LaTeX Counters"> <META NAME="keywords" CONTENT="manual"> <META NAME="resource-type" CONTENT="document"> <META NAME="distribution" CONTENT="global"> @@ -32,10 +32,10 @@ original version by: Nikos Drakos, CBLU, University of Leeds <P> - <H1 ALIGN="CENTER">fmtcount.sty v1.06: Displaying the Values of + <H1 ALIGN="CENTER">fmtcount.sty v1.09: Displaying the Values of LaTeX Counters</H1> <P ALIGN="CENTER"><STRONG>Nicola L.C. Talbot</STRONG></P> -<P ALIGN="CENTER"><STRONG>6 January 2007</STRONG></P> +<P ALIGN="CENTER"><STRONG>21st April 2007</STRONG></P> <BR> <H2><A NAME="SECTION00010000000000000000"> @@ -44,25 +44,25 @@ Contents</A> <!--Table of Contents--> <UL> -<LI><A NAME="tex2html18" - HREF="manual.html#SECTION00020000000000000000">Introduction</A> <LI><A NAME="tex2html19" - HREF="manual.html#SECTION00030000000000000000">Installation</A> + HREF="manual.html#SECTION00020000000000000000">Introduction</A> <LI><A NAME="tex2html20" - HREF="manual.html#SECTION00040000000000000000">Available Commands</A> + HREF="manual.html#SECTION00030000000000000000">Installation</A> <LI><A NAME="tex2html21" - HREF="manual.html#SECTION00050000000000000000">Package Options</A> + HREF="manual.html#SECTION00040000000000000000">Available Commands</A> <LI><A NAME="tex2html22" - HREF="manual.html#SECTION00060000000000000000">Multilingual Support</A> + HREF="manual.html#SECTION00050000000000000000">Package Options</A> <LI><A NAME="tex2html23" - HREF="manual.html#SECTION00070000000000000000">Configuration File fmtcount.cfg</A> + HREF="manual.html#SECTION00060000000000000000">Multilingual Support</A> <LI><A NAME="tex2html24" - HREF="manual.html#SECTION00080000000000000000">LaTeX2HTML style</A> + HREF="manual.html#SECTION00070000000000000000">Configuration File fmtcount.cfg</A> <LI><A NAME="tex2html25" - HREF="manual.html#SECTION00090000000000000000">Acknowledgements</A> + HREF="manual.html#SECTION00080000000000000000">LaTeX2HTML style</A> <LI><A NAME="tex2html26" - HREF="manual.html#SECTION000100000000000000000">Troubleshooting</A> + HREF="manual.html#SECTION00090000000000000000">Acknowledgements</A> <LI><A NAME="tex2html27" + HREF="manual.html#SECTION000100000000000000000">Troubleshooting</A> +<LI><A NAME="tex2html28" HREF="manual.html#SECTION000110000000000000000">Contact Details</A> </UL> <!--End of Table of Contents--> @@ -139,11 +139,20 @@ The macro <code>\numberstring{</code><I>counter</I><code>}</code> will print the <code>\numberstring</code>, but with initial letters in uppercase. For example, <code>\Numberstring{section}</code> will produce: Three. +The macro <code>\NUMBERstring{</code><I>counter</I><code>}</code> does the same +as <code>\numberstring</code>, but converted to upper case. Note that +<code>\MakeUppercase{\NUMBERstring{</code><I>counter</I><code>}}</code> doesn't +work, due to the way that <code>\MakeUppercase</code> expands its +argument<A NAME="tex2html4" + HREF="#foot288"><SUP>1</SUP></A>. + <P> -The macros <code>\numberstringnum</code> and -<code>\Numberstringnum</code> work like -<code>\numberstring</code> and -<code>\Numberstring</code>, respectively, but take an actual number +The macros <code>\numberstringnum</code>, +<code>\Numberstringnum</code> and +<code>\NUMBERstringnum</code> work like +<code>\numberstring</code>, +<code>\Numberstring</code> and +<code>\NUMBERstring</code>, respectively, but take an actual number rather than a counter as the argument. For example: <code>\Numberstringnum{105}</code> will produce: One Hundred and Five. @@ -154,16 +163,92 @@ The macro <code>\ordinalstring{</code><I>counter</I><code>}</code> will print th The macro <code>\Ordinalstring{</code><I>counter</I><code>}</code> does the same as <code>\ordinalstring</code>, but with initial letters in uppercase. For example, <code>\Ordinalstring{section}</code> will produce: Third. + + The macro <code>\ORDINALstring{</code><I>counter</I><code>}</code> does the same as +<code>\ordinalstring</code>, but with all words in upper case (see previous +note about <TT>\MakeUppercase</TT>). <P> -The macros <code>\ordinalstringnum</code> and -<code>\Ordinalstringnum</code> work like -<code>\Ordinalstring</code> and -<code>\Ordinalstring</code>, respectively, but take an actual number +The macros <code>\ordinalstringnum</code>, +<code>\Ordinalstringnum</code> and <TT>\ORDINALstringnum</TT> work like +<code>\ordinalstring</code>, +<code>\Ordinalstring</code> and <TT>\ORDINALstring</TT>, respectively, but take an actual number rather than a counter as the argument. For example, <code>\ordinalstringnum{3}</code> will produce: third. <P> +As from version 1.09, textual representations can be stored for +later use. This overcomes the problems encountered when you +attempt to use one of the above commands in <TT>\edef</TT>. + +<P> +Each of the following commands takes a label as the first argument, +the other arguments are as the analogous commands above. These +commands do not display anything, but store the textual +representation. This can later be retrieved using +<TT>\FMCuse</TT>{<I>label</I>}. +Note: with <TT>\storeordinal</TT> and <TT>\storeordinalnum</TT>, the +only bit that doesn't get expanded is <TT>\fmtord</TT>. So, for +example, <code>\storeordinalnum{mylabel}{3}</code> will be stored as +<code>3\relax \fmtord{rd}</code>. + +<P> + +<TT>\storeordinal</TT>{<I>label</I>}{<I>counter</I>}[<I>gender</I>] + +<P> + +<TT>\storeordinalstring</TT>{<I>label</I>}{<I>counter</I>}[<I>gender</I>] + +<P> + +<TT>\storeOrdinalstring</TT>{<I>label</I>}{<I>counter</I>}[<I>gender</I>] + +<P> + +<TT>\storeORDINALstring</TT>{<I>label</I>}{<I>counter</I>}[<I>gender</I>] + +<P> + +<TT>\storenumberstring</TT>{<I>label</I>}{<I>counter</I>}[<I>gender</I>] + +<P> + +<TT>\storeNumberstring</TT>{<I>label</I>}{<I>counter</I>}[<I>gender</I>] + +<P> + +<TT>\storeNUMBERstring</TT>{<I>label</I>}{<I>counter</I>}[<I>gender</I>] + +<P> + +<TT>\storeordinalnum</TT>{<I>label</I>}{<I>number</I>}[<I>gender</I>] + +<P> + +<TT>\storeordinalstring</TT>{<I>label</I>}{<I>number</I>}[<I>gender</I>] + +<P> + +<TT>\storeOrdinalstringnum</TT>{<I>label</I>}{<I>number</I>}[<I>gender</I>] + +<P> + +<TT>\storeORDINALstringnum</TT>{<I>label</I>}{<I>number</I>}[<I>gender</I>] + +<P> + +<TT>\storenumberstring</TT>{<I>label</I>}{<I>number</I>}[<I>gender</I>] + +<P> + +<TT>\storeNumberstring</TT>{<I>label</I>}{<I>number</I>}[<I>gender</I>] + +<P> + +<TT>\storeNUMBERstring</TT>{<I>label</I>}{<I>number</I>}[<I>gender</I>] + +<P> The macro <code>\binary{</code><I>counter</I><code>}</code> will print the value of <I>counter</I> as a binary number. E.g. <code>\binary{section}</code> will produce: 11. The declaration @@ -306,8 +391,8 @@ Version 1.02 of the <TT>fmtcount</TT> package now has limited multilingual support. The following languages are implemented: English, Spanish, Portuguese, French, French (Swiss) and French (Belgian). The package checks to see if the -command <code>\date</code><I>language</I> is defined<A NAME="tex2html4" - HREF="#foot192"><SUP>1</SUP></A>, and will +command <code>\date</code><I>language</I> is defined<A NAME="tex2html5" + HREF="#foot289"><SUP>2</SUP></A>, and will load the code for those languages. The commands <code>\ordinal</code>, <code>\ordinalstring</code> and <code>\numberstring</code> (and their variants) will then be formatted in the currently @@ -418,7 +503,7 @@ Troubleshooting</A> </H1> <P> -There is a FAQ available at: <TT><A NAME="tex2html5" +There is a FAQ available at: <TT><A NAME="tex2html6" HREF="http://theoval.cmp.uea.ac.uk/~nlct/latex/packages/faq/">http://theoval.cmp.uea.ac.uk/~nlct/latex/packages/faq/</A></TT>. <P> @@ -435,12 +520,19 @@ University of East Anglia Norwich. NR4 7TJ. <BR> United Kingdom. -<BR> <TT><A NAME="tex2html6" +<BR> <TT><A NAME="tex2html7" HREF="http://theoval.cmp.uea.ac.uk/~nlct/">http://theoval.cmp.uea.ac.uk/~nlct/</A></TT> <BR><HR><H4>Footnotes</H4> <DL> -<DT><A NAME="foot192">... defined</A><A +<DT><A NAME="foot288">... +argument</A><A HREF="manual.html#tex2html4"><SUP>1</SUP></A></DT> +<DD>See all the various postings to +<TT>comp.text.tex</TT> about <TT>\MakeUppercase</TT> + +</DD> +<DT><A NAME="foot289">... defined</A><A + HREF="manual.html#tex2html5"><SUP>2</SUP></A></DT> <DD>this will be true if you have loaded <TT>babel</TT> @@ -451,7 +543,7 @@ will be true if you have loaded <TT>babel</TT> <A href=http://theoval.cmp.uea.ac.uk/~nlct/>Nicola L. C. Talbot</A>. <A HREF=http://www.cmp.uea.ac.uk/>School of Computing Sciences</A>. <A HREF=http://www.uea.ac.uk/>University of East Anglia.</A> -Last Modified: 2007-01-06 +Last Modified: 2007-04-21 </ADDRESS> </BODY> </HTML> diff --git a/Master/texmf-dist/source/latex/fmtcount/fmtcount.dtx b/Master/texmf-dist/source/latex/fmtcount/fmtcount.dtx index ba813b38d30..4a1bf4eb979 100644 --- a/Master/texmf-dist/source/latex/fmtcount/fmtcount.dtx +++ b/Master/texmf-dist/source/latex/fmtcount/fmtcount.dtx @@ -12,7 +12,7 @@ % -author "Nicola Talbot" % -dir "source" % fmtcount -% Created on 2007/1/6 16:52 +% Created on 2007/4/21 19:25 %\fi %\iffalse %<*package> @@ -50,7 +50,8 @@ -\newcommand{\styname}[1]{\textsf{#1}}\newcommand{\clsname}[1]{\textsf{#1}} +\newcommand{\styname}[1]{\textsf{#1}}\newcommand{\clsname}[1]{\textsf{#1}}\newcommand{\cmdname}[1]{\texttt{\symbol{92}#1}} + \begin{document} \DocInput{fmtcount.dtx} \end{document} @@ -58,11 +59,12 @@ %\fi % %\RecordChanges +%\CheckSum{7392} %\OnlyDescription -%\def\filedate{6 January 2007} -%\def\fileversion{1.06} +%\def\filedate{20 April 2007} +%\def\fileversion{1.09} %\def\filename{fmtcount.dtx} -%\def\docdate{6 January 2007} +%\def\docdate{21st April 2007} % % \title{fmtcount.sty v\fileversion: Displaying the Values of %\LaTeX\ Counters} @@ -129,16 +131,27 @@ % The macro \verb"\Numberstring{"\meta{counter}\verb!}! does the same as % \verb"\numberstring", but with initial letters in uppercase. For % example, \verb"\Numberstring{section}" will produce: Three. +%\DescribeMacro{\NUMBERstring} +%The macro \verb"\NUMBERstring{"\meta{counter}\verb'}' does the same +%as \verb"\numberstring", but converted to upper case. Note that +%\verb"\MakeUppercase{\NUMBERstring{"\meta{counter}\verb'}}' doesn't +%work, due to the way that \verb"\MakeUppercase" expands its +%argument\footnote{See all the various postings to +%\texttt{comp.text.tex} about \cmdname{MakeUppercase}}. % %\DescribeMacro{\numberstringnum} %\DescribeMacro{\Numberstringnum} -%The macros \verb!\numberstringnum! and -%\verb!\Numberstringnum! work like -%\verb!\numberstring! and -%\verb!\Numberstring!, respectively, but take an actual number +%\DescribeMacro{\NUMBERstringnum} +%The macros \verb!\numberstringnum!, +%\verb!\Numberstringnum! and +%\verb"\NUMBERstringnum" work like +%\verb!\numberstring!, +%\verb!\Numberstring! and +%\verb"\NUMBERstring", respectively, but take an actual number %rather than a counter as the argument. For example: %\verb'\Numberstringnum{105}' will produce: One Hundred and Five. % +% % \DescribeMacro{\ordinalstring} % The macro \verb"\ordinalstring{"\meta{counter}\verb!}! will print the % value of \meta{counter} as a textual ordinal. E.g.\ @@ -147,16 +160,78 @@ % The macro \verb"\Ordinalstring{"\meta{counter}\verb!}! does the same as % \verb"\ordinalstring", but with initial letters in uppercase. For example, % \verb"\Ordinalstring{section}" will produce: Third. +% \DescribeMacro{\ORDINALstring} +% The macro \verb"\ORDINALstring{"\meta{counter}\verb!}! does the same as +%\verb"\ordinalstring", but with all words in upper case (see previous +%note about \cmdname{MakeUppercase}). % %\DescribeMacro{\ordinalstringnum} %\DescribeMacro{\Ordinalstringnum} -%The macros \verb!\ordinalstringnum! and -%\verb!\Ordinalstringnum! work like -%\verb!\Ordinalstring! and -%\verb!\Ordinalstring!, respectively, but take an actual number +%\DescribeMacro{\ORDINALstringnum} +%The macros \verb!\ordinalstringnum!, +%\verb!\Ordinalstringnum! and \cmdname{ORDINALstringnum} work like +%\verb!\ordinalstring!, +%\verb!\Ordinalstring! and \cmdname{ORDINALstring}, respectively, but take an actual number %rather than a counter as the argument. For example, %\verb"\ordinalstringnum{3}" will produce: third. % +%\changes{v.1.09}{21 Apr 2007}{store facility added} +%As from version 1.09, textual representations can be stored for +%later use. This overcomes the problems encountered when you +%attempt to use one of the above commands in \cmdname{edef}. +% +%Each of the following commands takes a label as the first argument, +%the other arguments are as the analogous commands above. These +%commands do not display anything, but store the textual +%representation. This can later be retrieved using +%\DescribeMacro{\FMCuse}\cmdname{FMCuse}\{\meta{label}\}. +%Note: with \cmdname{storeordinal} and \cmdname{storeordinalnum}, the +%only bit that doesn't get expanded is \cmdname{fmtord}. So, for +%example, \verb"\storeordinalnum{mylabel}{3}" will be stored as +%\verb"3\relax \fmtord{rd}". +% +%\DescribeMacro{\storeordinal} +%\cmdname{storeordinal}\{\meta{label}\}\{\meta{counter}\}[\meta{gender}] +%\par +%\DescribeMacro{\storeordinalstring} +%\cmdname{storeordinalstring}\{\meta{label}\}\{\meta{counter}\}[\meta{gender}] +%\par +%\DescribeMacro{\storeOrdinalstring} +%\cmdname{storeOrdinalstring}\{\meta{label}\}\{\meta{counter}\}[\meta{gender}] +%\par +%\DescribeMacro{\storeORDINALstring} +%\cmdname{storeORDINALstring}\{\meta{label}\}\{\meta{counter}\}[\meta{gender}] +%\par +%\DescribeMacro{\storenumberstring} +%\cmdname{storenumberstring}\{\meta{label}\}\{\meta{counter}\}[\meta{gender}] +%\par +%\DescribeMacro{\storeNumberstring} +%\cmdname{storeNumberstring}\{\meta{label}\}\{\meta{counter}\}[\meta{gender}] +%\par +%\DescribeMacro{\storeNUMBERstring} +%\cmdname{storeNUMBERstring}\{\meta{label}\}\{\meta{counter}\}[\meta{gender}] +%\par +%\DescribeMacro{\storeordinalnum} +%\cmdname{storeordinalnum}\{\meta{label}\}\{\meta{number}\}[\meta{gender}] +%\par +%\DescribeMacro{\storeordinalstringnum} +%\cmdname{storeordinalstring}\{\meta{label}\}\{\meta{number}\}[\meta{gender}] +%\par +%\DescribeMacro{\storeOrdinalstringnum} +%\cmdname{storeOrdinalstringnum}\{\meta{label}\}\{\meta{number}\}[\meta{gender}] +%\par +%\DescribeMacro{\storeORDINALstringnum} +%\cmdname{storeORDINALstringnum}\{\meta{label}\}\{\meta{number}\}[\meta{gender}] +%\par +%\DescribeMacro{\storenumberstringnum} +%\cmdname{storenumberstring}\{\meta{label}\}\{\meta{number}\}[\meta{gender}] +%\par +%\DescribeMacro{\storeNumberstringnum} +%\cmdname{storeNumberstring}\{\meta{label}\}\{\meta{number}\}[\meta{gender}] +%\par +%\DescribeMacro{\storeNUMBERstringnum} +%\cmdname{storeNUMBERstring}\{\meta{label}\}\{\meta{number}\}[\meta{gender}] +% % \DescribeMacro{\binary} %\changes{v2.4}{25 Sept 2004}{'binary added} % The macro \verb"\binary{"\meta{counter}\verb!}! will print the @@ -390,47 +465,55 @@ %<*fc-english.def> % \end{macrocode} %\fi +% \subsection{fc-english.def} % English definitions % \begin{macrocode} -\ProvidesFile{fc-english}[2005/04/29] +\ProvidesFile{fc-english}[2007/04/20] % \end{macrocode} -% Define macro that prints the value of the \TeX\ count -% register as an ordinal. +% Define macro that converts a number or count register (first +% argument) to an ordinal, and stores the result in the +% second argument, which should be a control sequence. % \begin{macrocode} -\newcommand{\@ordinalMenglish}[1]{% +\newcommand*{\@ordinalMenglish}[2]{% +\def\@fc@ord{}% \@orgargctr=#1\relax \@ordinalctr=#1% \@modulo{\@ordinalctr}{100}% -\ifnum\@ordinalctr=11 -\the\@orgargctr\fmtord{th}% +\ifnum\@ordinalctr=11\relax + \def\@fc@ord{th}% \else -\ifnum\@ordinalctr=12 -\the\@orgargctr\fmtord{th}% -\else -\ifnum\@ordinalctr=13 -\the\@orgargctr\fmtord{th}% -\else -\@modulo{\@ordinalctr}{10}% -\ifcase\@ordinalctr -\the\@orgargctr\fmtord{th}% case 0 -\or \the\@orgargctr\fmtord{st}% case 1 -\or \the\@orgargctr\fmtord{nd}% case 2 -\or \the\@orgargctr\fmtord{rd}% case 3 -\else -\the\@orgargctr\fmtord{th}% default case -\fi -\fi -\fi + \ifnum\@ordinalctr=12\relax + \def\@fc@ord{th}% + \else + \ifnum\@ordinalctr=13\relax + \def\@fc@ord{th}% + \else + \@modulo{\@ordinalctr}{10}% + \ifcase\@ordinalctr + \def\@fc@ord{th}% case 0 + \or \def\@fc@ord{st}% case 1 + \or \def\@fc@ord{nd}% case 2 + \or \def\@fc@ord{rd}% case 3 + \else + \def\@fc@ord{th}% default case + \fi + \fi + \fi \fi +\edef#2{\number#1\relax\noexpand\fmtord{\@fc@ord}}% } +% \end{macrocode} +% There is no gender difference in English, so make feminine +% the same as the masculine. +% \begin{macrocode} \let\@ordinalFenglish=\@ordinalMenglish % \end{macrocode} % Define the macro that prints the value of a \TeX\ count register -% as text +% as text. To make it easier, break it up into units, teens and +% tens. First, the units: the argument should be between 0 and 9 +% inclusive. % \begin{macrocode} -\providecommand{\andname}{and} - -\newcommand{\@@unitstringenglish}[1]{% +\newcommand*{\@@unitstringenglish}[1]{% \ifcase#1\relax zero% \or one% @@ -444,8 +527,11 @@ zero% \or nine% \fi } - -\newcommand{\@@tenstringenglish}[1]{% +% \end{macrocode} +% Next the tens, again the argument should be between 0 and 9 +% inclusive. +% \begin{macrocode} +\newcommand*{\@@tenstringenglish}[1]{% \ifcase#1\relax \or ten% \or twenty% @@ -458,8 +544,11 @@ zero% \or ninety% \fi } - -\newcommand{\@@teenstringenglish}[1]{% +% \end{macrocode} +% Finally the teens, again the argument should be between 0 and 9 +% inclusive. +% \begin{macrocode} +\newcommand*{\@@teenstringenglish}[1]{% \ifcase#1\relax ten% \or eleven% @@ -473,8 +562,10 @@ ten% \or nineteen% \fi } - -\newcommand{\@@Unitstringenglish}[1]{% +% \end{macrocode} +% As above, but with the initial letter in uppercase. The units: +% \begin{macrocode} +\newcommand*{\@@Unitstringenglish}[1]{% \ifcase#1\relax Zero% \or One% @@ -488,8 +579,10 @@ Zero% \or Nine% \fi } - -\newcommand{\@@Tenstringenglish}[1]{% +% \end{macrocode} +% The tens: +% \begin{macrocode} +\newcommand*{\@@Tenstringenglish}[1]{% \ifcase#1\relax \or Ten% \or Twenty% @@ -502,8 +595,10 @@ Zero% \or Ninety% \fi } - -\newcommand{\@@Teenstringenglish}[1]{% +% \end{macrocode} +% The teens: +% \begin{macrocode} +\newcommand*{\@@Teenstringenglish}[1]{% \ifcase#1\relax Ten% \or Eleven% @@ -517,8 +612,14 @@ Ten% \or Nineteen% \fi } - -\newcommand{\@@numberstringenglish}[1]{% +% \end{macrocode} +% This has changed in version 1.09, so that it now stores +% the result in the second argument, but doesn't display anything. +% Since it only affects internal macros, it shouldn't affect +% documents created with older versions. (These internal macros are +% not meant for use in documents.) +% \begin{macrocode} +\newcommand*{\@@numberstringenglish}[2]{% \ifnum#1>99999 \PackageError{fmtcount}{Out of range}% {This macro only works for values less than 100000}% @@ -530,74 +631,118 @@ you can try typing "minus" first, and then pass the modulus of this number}% \fi \fi +\def#2{}% \@strctr=#1\relax \divide\@strctr by 1000\relax \ifnum\@strctr>9 % #1 is greater or equal to 10000 -\divide\@strctr by 10 -\ifnum\@strctr>1 -\@tenstring{\@strctr}% -\@strctr=#1 \divide\@strctr by 1000\relax -\@modulo{\@strctr}{10}% -\ifnum\@strctr>0 -\@unitstring{\@strctr}\fi -\else -\@strctr=#1\relax -\divide\@strctr by 1000 -\@modulo{\@strctr}{10}% -\@teenstring{\@strctr}% -\fi -\ \@thousand% + \divide\@strctr by 10 + \ifnum\@strctr>1\relax + \let\@@fc@numstr#2\relax + \edef#2{\@@fc@numstr\@tenstring{\@strctr}}% + \@strctr=#1 \divide\@strctr by 1000\relax + \@modulo{\@strctr}{10}% + \ifnum\@strctr>0\relax + \let\@@fc@numstr#2\relax + \edef#2{\@@fc@numstr-\@unitstring{\@strctr}}% + \fi + \else + \@strctr=#1\relax + \divide\@strctr by 1000\relax + \@modulo{\@strctr}{10}% + \let\@@fc@numstr#2\relax + \edef#2{\@@fc@numstr\@teenstring{\@strctr}}% + \fi + \let\@@fc@numstr#2\relax + \edef#2{\@@fc@numstr\ \@thousand}% \else -\ifnum\@strctr>0 \@unitstring{\@strctr}\ \@thousand\fi + \ifnum\@strctr>0\relax + \let\@@fc@numstr#2\relax + \edef#2{\@@fc@numstr\@unitstring{\@strctr}\ \@thousand}% + \fi \fi \@strctr=#1\relax \@modulo{\@strctr}{1000}% \divide\@strctr by 100 -\ifnum\@strctr>0 -\ifnum#1>1000 \ \fi\@unitstring{\@strctr}\ \@hundred% +\ifnum\@strctr>0\relax + \ifnum#1>1000\relax + \let\@@fc@numstr#2\relax + \edef#2{\@@fc@numstr\ }% + \fi + \let\@@fc@numstr#2\relax + \edef#2{\@@fc@numstr\@unitstring{\@strctr}\ \@hundred}% \fi \@strctr=#1\relax \@modulo{\@strctr}{100}% -\ifnum#1>100 \ifnum\@strctr>0 \ \andname\ \fi\fi -\ifnum\@strctr>19 -\divide\@strctr by 10 -\@tenstring{\@strctr}% -\@strctr=#1\relax \@modulo{\@strctr}{10}% -\ifnum\@strctr>0 --\@unitstring{\@strctr}% -\fi -\else -\ifnum\@strctr<10 -\ifnum\@strctr=0 -\ifnum#1<100 \@unitstring{\@strctr}\fi -\else -\@unitstring{\@strctr}% +\ifnum#1>100\relax + \ifnum\@strctr>0\relax + \let\@@fc@numstr#2\relax + \edef#2{\@@fc@numstr\ \@andname\ }% + \fi \fi +\ifnum\@strctr>19\relax + \divide\@strctr by 10\relax + \let\@@fc@numstr#2\relax + \edef#2{\@@fc@numstr\@tenstring{\@strctr}}% + \@strctr=#1\relax \@modulo{\@strctr}{10}% + \ifnum\@strctr>0\relax + \let\@@fc@numstr#2\relax + \edef#2{\@@fc@numstr-\@unitstring{\@strctr}}% + \fi \else -\@modulo{\@strctr}{10}% -\@teenstring{\@strctr}% -\fi + \ifnum\@strctr<10\relax + \ifnum\@strctr=0\relax + \ifnum#1<100\relax + \let\@@fc@numstr#2\relax + \edef#2{\@@fc@numstr\@unitstring{\@strctr}}% + \fi + \else + \let\@@fc@numstr#2\relax + \edef#2{\@@fc@numstr\@unitstring{\@strctr}}% + \fi + \else + \@modulo{\@strctr}{10}% + \let\@@fc@numstr#2\relax + \edef#2{\@@fc@numstr\@teenstring{\@strctr}}% + \fi \fi } - -\newcommand{\@numberstringMenglish}[1]{% +% \end{macrocode} +% All lower case version, the second argument must be a +% control sequence. +% \begin{macrocode} +\DeclareRobustCommand{\@numberstringMenglish}[2]{% \let\@unitstring=\@@unitstringenglish \let\@teenstring=\@@teenstringenglish \let\@tenstring=\@@tenstringenglish \def\@hundred{hundred}\def\@thousand{thousand}% -\@@numberstringenglish{#1}} - +\def\@andname{and}% +\@@numberstringenglish{#1}{#2}% +} +% \end{macrocode} +% There is no gender in English, so make feminine form the same +% as the masculine. +% \begin{macrocode} \let\@numberstringFenglish=\@numberstringMenglish - -\newcommand{\@NumberstringMenglish}[1]{% +% \end{macrocode} +% This version makes the first letter of each word an uppercase +% character (except ``and''). The second argument must be a control +% sequence. +% \begin{macrocode} +\newcommand*{\@NumberstringMenglish}[2]{% \let\@unitstring=\@@Unitstringenglish \let\@teenstring=\@@Teenstringenglish \let\@tenstring=\@@Tenstringenglish \def\@hundred{Hundred}\def\@thousand{Thousand}% -\@@numberstringenglish{#1}} - +\def\@andname{and}% +\@@numberstringenglish{#1}{#2}} +% \end{macrocode} +% There is no gender in English, so make feminine form the same +% as the masculine. +% \begin{macrocode} \let\@NumberstringFenglish=\@NumberstringMenglish % \end{macrocode} -% Define a macro that produces an ordinal as a string. +% Define a macro that produces an ordinal as a string. Again, break +% it up into units, teens and tens. First the units: % \begin{macrocode} -\newcommand{\@@unitthstringenglish}[1]{% +\newcommand*{\@@unitthstringenglish}[1]{% \ifcase#1\relax zeroth% \or first% @@ -611,8 +756,10 @@ zeroth% \or ninth% \fi } - -\newcommand{\@@tenthstringenglish}[1]{% +% \end{macrocode} +% Next the tens: +% \begin{macrocode} +\newcommand*{\@@tenthstringenglish}[1]{% \ifcase#1\relax \or tenth% \or twentieth% @@ -625,8 +772,10 @@ zeroth% \or ninetieth% \fi } - -\newcommand{\@@teenthstringenglish}[1]{% +% \end{macrocode} +% The teens: +% \begin{macrocode} +\newcommand*{\@@teenthstringenglish}[1]{% \ifcase#1\relax tenth% \or eleventh% @@ -640,8 +789,10 @@ tenth% \or nineteenth% \fi } - -\newcommand{\@@Unitthstringenglish}[1]{% +% \end{macrocode} +% As before, but with the first letter in upper case. The units: +% \begin{macrocode} +\newcommand*{\@@Unitthstringenglish}[1]{% \ifcase#1\relax Zeroth% \or First% @@ -655,8 +806,10 @@ Zeroth% \or Ninth% \fi } - -\newcommand{\@@Tenthstringenglish}[1]{% +% \end{macrocode} +% The tens: +% \begin{macrocode} +\newcommand*{\@@Tenthstringenglish}[1]{% \ifcase#1\relax \or Tenth% \or Twentieth% @@ -669,8 +822,10 @@ Zeroth% \or Ninetieth% \fi } - -\newcommand{\@@Teenthstringenglish}[1]{% +% \end{macrocode} +% The teens: +% \begin{macrocode} +\newcommand*{\@@Teenthstringenglish}[1]{% \ifcase#1\relax Tenth% \or Eleventh% @@ -684,8 +839,13 @@ Tenth% \or Nineteenth% \fi } - -\newcommand{\@@ordinalstringenglish}[1]{% +% \end{macrocode} +% Again, as from version 1.09, this has been changed to take two +% arguments, where the second argument is a control sequence. +% The resulting text is stored in the control sequence, and nothing +% is displayed. +% \begin{macrocode} +\newcommand*{\@@ordinalstringenglish}[2]{% \@strctr=#1\relax \ifnum#1>99999 \PackageError{fmtcount}{Out of range}% @@ -697,89 +857,143 @@ Tenth% you can try typing "minus" first, and then pass the modulus of this number}% \fi +\def#2{}% \fi \@strctr=#1\relax \divide\@strctr by 1000\relax -\ifnum\@strctr>9 +\ifnum\@strctr>9\relax % #1 is greater or equal to 10000 -\divide\@strctr by 10 -\ifnum\@strctr>1\relax - \@tenstring{\@strctr}% - \@strctr=#1\relax - \divide\@strctr by 1000\relax - \@modulo{\@strctr}{10}% - \ifnum\@strctr>0 -\@unitstring{\@strctr}\fi -\else - \@strctr=#1\relax \divide\@strctr by 1000\relax - \@modulo{\@strctr}{10}% - \@teenstring{\@strctr}% -\fi -\@strctr=#1\relax \@modulo{\@strctr}{1000}% -\ifnum\@strctr=0\ \@thousandth\else\ \@thousand \fi + \divide\@strctr by 10 + \ifnum\@strctr>1\relax + \let\@@fc@ordstr#2\relax + \edef#2{\@@fc@ordstr\@tenstring{\@strctr}}% + \@strctr=#1\relax + \divide\@strctr by 1000\relax + \@modulo{\@strctr}{10}% + \ifnum\@strctr>0\relax + \let\@@fc@ordstr#2\relax + \edef#2{\@@fc@ordstr-\@unitstring{\@strctr}}% + \fi + \else + \@strctr=#1\relax \divide\@strctr by 1000\relax + \@modulo{\@strctr}{10}% + \let\@@fc@ordstr#2\relax + \edef#2{\@@fc@ordstr\@teenstring{\@strctr}}% + \fi + \@strctr=#1\relax \@modulo{\@strctr}{1000}% + \ifnum\@strctr=0\relax + \let\@@fc@ordstr#2\relax + \edef#2{\@@fc@ordstr\ \@thousandth}% + \else + \let\@@fc@ordstr#2\relax + \edef#2{\@@fc@ordstr\ \@thousand}% + \fi \else -\ifnum\@strctr>0\relax -\@unitstring{\@strctr}% -\@strctr=#1\relax \@modulo{\@strctr}{1000}% -\ifnum\@strctr=0\ \@thousandth\else\ \@thousand\fi -\fi + \ifnum\@strctr>0\relax + \let\@@fc@ordstr#2\relax + \edef#2{\@@fc@ordstr\@unitstring{\@strctr}}% + \@strctr=#1\relax \@modulo{\@strctr}{1000}% + \let\@@fc@ordstr#2\relax + \ifnum\@strctr=0\relax + \edef#2{\@@fc@ordstr\ \@thousandth}% + \else + \edef#2{\@@fc@ordstr\ \@thousand}% + \fi + \fi \fi \@strctr=#1\relax \@modulo{\@strctr}{1000}% \divide\@strctr by 100 -\ifnum\@strctr>0 -\ifnum#1>1000 \ \fi\@unitstring{\@strctr}% -\@strctr=#1\relax \@modulo{\@strctr}{100}% -\ifnum\@strctr=0\ \@hundredth\else\ \@hundred\fi +\ifnum\@strctr>0\relax + \ifnum#1>1000\relax + \let\@@fc@ordstr#2\relax + \edef#2{\@@fc@ordstr\ }% + \fi + \let\@@fc@ordstr#2\relax + \edef#2{\@@fc@ordstr\@unitstring{\@strctr}}% + \@strctr=#1\relax \@modulo{\@strctr}{100}% + \let\@@fc@ordstr#2\relax + \ifnum\@strctr=0\relax + \edef#2{\@@fc@ordstr\ \@hundredth}% + \else + \edef#2{\@@fc@ordstr\ \@hundred}% + \fi \fi \@strctr=#1\relax \@modulo{\@strctr}{100}% -\ifnum#1>100 \ifnum\@strctr>0\ and \fi\fi -\ifnum\@strctr>19 -\@tmpstrctr=\@strctr -\divide\@strctr by 10 -\@modulo{\@tmpstrctr}{10}% -\ifnum\@tmpstrctr=0 \@tenthstring{\@strctr}\else \@tenstring{\@strctr}\fi -\@strctr=#1\relax \@modulo{\@strctr}{10}% -\ifnum\@strctr>0 --\@unitthstring{\@strctr}% -\fi -\else -\ifnum\@strctr<10 -\ifnum\@strctr=0 -\ifnum#1<100 \@unitthstring{\@strctr}\fi -\else -\@unitthstring{\@strctr}% +\ifnum#1>100\relax + \ifnum\@strctr>0\relax + \let\@@fc@ordstr#2\relax + \edef#2{\@@fc@ordstr\ \@andname\ }% + \fi \fi +\ifnum\@strctr>19\relax + \@tmpstrctr=\@strctr + \divide\@strctr by 10\relax + \@modulo{\@tmpstrctr}{10}% + \let\@@fc@ordstr#2\relax + \ifnum\@tmpstrctr=0\relax + \edef#2{\@@fc@ordstr\@tenthstring{\@strctr}}% + \else + \edef#2{\@@fc@ordstr\@tenstring{\@strctr}}% + \fi + \@strctr=#1\relax \@modulo{\@strctr}{10}% + \ifnum\@strctr>0\relax + \let\@@fc@ordstr#2\relax + \edef#2{\@@fc@ordstr-\@unitthstring{\@strctr}}% + \fi \else -\@modulo{\@strctr}{10}% -\@teenthstring{\@strctr}% -\fi + \ifnum\@strctr<10\relax + \ifnum\@strctr=0\relax + \ifnum#1<100\relax + \let\@@fc@ordstr#2\relax + \edef#2{\@@fc@ordstr\@unitthstring{\@strctr}}% + \fi + \else + \let\@@fc@ordstr#2\relax + \edef#2{\@@fc@ordstr\@unitthstring{\@strctr}}% + \fi + \else + \@modulo{\@strctr}{10}% + \let\@@fc@ordstr#2\relax + \edef#2{\@@fc@ordstr\@teenthstring{\@strctr}}% + \fi \fi } - -\newcommand{\@ordinalstringMenglish}[1]{% +% \end{macrocode} +% All lower case version. Again, the second argument must be a +% control sequence in which the resulting text is stored. +% \begin{macrocode} +\DeclareRobustCommand{\@ordinalstringMenglish}[2]{% \let\@unitthstring=\@@unitthstringenglish \let\@teenthstring=\@@teenthstringenglish \let\@tenthstring=\@@tenthstringenglish \let\@unitstring=\@@unitstringenglish \let\@teenstring=\@@teenstringenglish \let\@tenstring=\@@tenstringenglish +\def\@andname{and}% \def\@hundred{hundred}\def\@thousand{thousand}% \def\@hundredth{hundredth}\def\@thousandth{thousandth}% -\@@ordinalstringenglish{#1}} - +\@@ordinalstringenglish{#1}{#2}} +% \end{macrocode} +% No gender in English, so make feminine form same as masculine: +% \begin{macrocode} \let\@ordinalstringFenglish=\@ordinalstringMenglish - -\newcommand{\@OrdinalstringMenglish}[1]{% +% \end{macrocode} +% First letter of each word in upper case: +% \begin{macrocode} +\DeclareRobustCommand{\@OrdinalstringMenglish}[2]{% \let\@unitthstring=\@@Unitthstringenglish \let\@teenthstring=\@@Teenthstringenglish \let\@tenthstring=\@@Tenthstringenglish \let\@unitstring=\@@Unitstringenglish \let\@teenstring=\@@Teenstringenglish \let\@tenstring=\@@Tenstringenglish +\def\@andname{and}% \def\@hundred{Hundred}\def\@thousand{Thousand}% \def\@hundredth{Hundredth}\def\@thousandth{Thousandth}% -\@@ordinalstringenglish{#1}} - +\@@ordinalstringenglish{#1}{#2}} +% \end{macrocode} +% No gender in English, so make feminine form same as masculine: +% \begin{macrocode} \let\@OrdinalstringFenglish=\@OrdinalstringMenglish - % \end{macrocode} %\iffalse % \begin{macrocode} @@ -791,12 +1005,43 @@ this number}% %<*fc-french.def> % \end{macrocode} %\fi -% French +% \subsection{fc-french.def} +% French definitions +% \begin{macrocode} +\ProvidesFile{fc-french.def}[2007/04/20] +% \end{macrocode} +% Define macro that converts a number or count register (first +% argument) to an ordinal, and store the result in the second +% argument, which must be a control sequence. Masculine: % \begin{macrocode} -\ProvidesFile{fc-french.def}[2005/04/29] +\newcommand*{\@ordinalMfrench}[2]{% +\iffmtord@abbrv + \edef#2{\number#1\relax\noexpand\fmtord{e}}% +\else + \ifnum#1=1\relax + \edef#2{\number#1\relax\noexpand\fmtord{er}}% + \else + \edef#2{\number#1\relax\noexpand\fmtord{eme}}% + \fi +\fi} % \end{macrocode} +% Feminine: % \begin{macrocode} -\newcommand{\@@unitstringfrench}[1]{% +\newcommand*{\@ordinalFfrench}[2]{% +\iffmtord@abbrv + \edef#2{\number#1\relax\noexpand\fmtord{e}}% +\else + \ifnum#1=1\relax + \edef#2{\number#1\relax\noexpand\fmtord{ere}}% + \else + \edef#2{\number#1\relax\noexpand\fmtord{eme}}% + \fi +\fi} +% \end{macrocode} +% Textual representation of a number. To make it easier break it +% into units, tens and teens. First the units: +% \begin{macrocode} +\newcommand*{\@@unitstringfrench}[1]{% \ifcase#1\relax zero% \or un% @@ -810,15 +1055,20 @@ zero% \or neuf% \fi } - -\newcommand{\@@unitstringFfrench}[1]{% +% \end{macrocode} +% Feminine only changes for 1: +% \begin{macrocode} +\newcommand*{\@@unitstringFfrench}[1]{% \ifnum#1=1\relax une% \else\@@unitstringfrench{#1}% \fi } - -\newcommand{\@@tenstringfrench}[1]{% +% \end{macrocode} +% Tens (this includes the Belgian and Swiss variants, special +% cases employed lower down.) +% \begin{macrocode} +\newcommand*{\@@tenstringfrench}[1]{% \ifcase#1\relax \or dix% \or vingt% @@ -832,8 +1082,10 @@ une% \or cent% \fi } - -\newcommand{\@@teenstringfrench}[1]{% +% \end{macrocode} +% Teens: +% \begin{macrocode} +\newcommand*{\@@teenstringfrench}[1]{% \ifcase#1\relax dix% \or onze% @@ -847,8 +1099,10 @@ dix% \or dix-neuf% \fi } - -\newcommand{\@@seventiesfrench}[1]{% +% \end{macrocode} +% Seventies are a special case, depending on dialect: +% \begin{macrocode} +\newcommand*{\@@seventiesfrench}[1]{% \@tenstring{6}% \ifnum#1=1\relax \ \@andname\ @@ -857,8 +1111,10 @@ dix% \fi \@teenstring{#1}% } - -\newcommand{\@@eightiesfrench}[1]{% +% \end{macrocode} +% Eighties are a special case, depending on dialect: +% \begin{macrocode} +\newcommand*{\@@eightiesfrench}[1]{% \@unitstring{4}-\@tenstring{2}% \ifnum#1>0 -\@unitstring{#1}% @@ -866,33 +1122,43 @@ dix% s% \fi } - -\newcommand{\@@ninetiesfrench}[1]{% +% \end{macrocode} +% Nineties are a special case, depending on dialect: +% \begin{macrocode} +\newcommand*{\@@ninetiesfrench}[1]{% \@unitstring{4}-\@tenstring{2}-\@teenstring{#1}% } - -\newcommand{\@@seventiesfrenchswiss}[1]{% +% \end{macrocode} +% Swiss seventies: +% \begin{macrocode} +\newcommand*{\@@seventiesfrenchswiss}[1]{% \@tenstring{7}% \ifnum#1=1\ \@andname\ \fi \ifnum#1>1-\fi \ifnum#1>0\@unitstring{#1}\fi } - -\newcommand{\@@eightiesfrenchswiss}[1]{% +% \end{macrocode} +% Swiss eighties: +% \begin{macrocode} +\newcommand*{\@@eightiesfrenchswiss}[1]{% \@tenstring{8}% \ifnum#1=1\ \@andname\ \fi \ifnum#1>1-\fi \ifnum#1>0\@unitstring{#1}\fi } - -\newcommand{\@@ninetiesfrenchswiss}[1]{% +% \end{macrocode} +% Swiss nineties: +% \begin{macrocode} +\newcommand*{\@@ninetiesfrenchswiss}[1]{% \@tenstring{9}% \ifnum#1=1\ \@andname\ \fi \ifnum#1>1-\fi \ifnum#1>0\@unitstring{#1}\fi } - -\newcommand{\@@Unitstringfrench}[1]{% +% \end{macrocode} +% Units with initial letter in upper case: +% \begin{macrocode} +\newcommand*{\@@Unitstringfrench}[1]{% \ifcase#1\relax Zero% \or Un% @@ -906,15 +1172,20 @@ Zero% \or Neuf% \fi } - -\newcommand{\@@UnitstringFfrench}[1]{% +% \end{macrocode} +% As above, but feminine: +% \begin{macrocode} +\newcommand*{\@@UnitstringFfrench}[1]{% \ifnum#1=1\relax Une% \else \@@Unitstringfrench{#1}% \fi } - -\newcommand{\@@Tenstringfrench}[1]{% +% \end{macrocode} +% Tens, with initial letter in upper case (includes Swiss and +% Belgian variants): +% \begin{macrocode} +\newcommand*{\@@Tenstringfrench}[1]{% \ifcase#1\relax \or Dix% \or Vingt% @@ -928,8 +1199,10 @@ Une% \or Cent% \fi } - -\newcommand{\@@Teenstringfrench}[1]{% +% \end{macrocode} +% Teens, with initial letter in upper case: +% \begin{macrocode} +\newcommand*{\@@Teenstringfrench}[1]{% \ifcase#1\relax Dix% \or Onze% @@ -943,8 +1216,15 @@ Dix% \or Dix-Neuf% \fi } - -\newcommand{\@numberstringMfrenchswiss}[1]{% +% \end{macrocode} +% This has changed in version 1.09, so that it now stores the +% result in the second argument, but doesn't display anything. +% Since it only affects internal macros, it shouldn't affect +% documents created with older versions. (These internal macros +% are not defined for use in documents.) Firstly, the Swiss +% version: +% \begin{macrocode} +\DeclareRobustCommand{\@numberstringMfrenchswiss}[2]{% \let\@unitstring=\@@unitstringfrench \let\@teenstring=\@@teenstringfrench \let\@tenstring=\@@tenstringfrench @@ -953,9 +1233,11 @@ Dix% \let\@nineties=\@@ninetiesfrenchswiss \def\@hundred{cent}\def\@thousand{mille}% \def\@andname{et}% -\@@numberstringfrench{#1}} - -\newcommand{\@numberstringMfrenchfrance}[1]{% +\@@numberstringfrench{#1}{#2}} +% \end{macrocode} +% Same as above, but for French as spoken in France: +% \begin{macrocode} +\DeclareRobustCommand{\@numberstringMfrenchfrance}[2]{% \let\@unitstring=\@@unitstringfrench \let\@teenstring=\@@teenstringfrench \let\@tenstring=\@@tenstringfrench @@ -964,9 +1246,11 @@ Dix% \let\@nineties=\@@ninetiesfrench \def\@hundred{cent}\def\@thousand{mille}% \def\@andname{et}% -\@@numberstringfrench{#1}} - -\newcommand{\@numberstringMfrenchbelgian}[1]{% +\@@numberstringfrench{#1}{#2}} +% \end{macrocode} +% Same as above, but for Belgian dialect: +% \begin{macrocode} +\DeclareRobustCommand{\@numberstringMfrenchbelgian}[2]{% \let\@unitstring=\@@unitstringfrench \let\@teenstring=\@@teenstringfrench \let\@tenstring=\@@tenstringfrench @@ -975,11 +1259,15 @@ Dix% \let\@nineties=\@@ninetiesfrench \def\@hundred{cent}\def\@thousand{mille}% \def\@andname{et}% -\@@numberstringfrench{#1}} - +\@@numberstringfrench{#1}{#2}} +% \end{macrocode} +% Set default dialect: +% \begin{macrocode} \let\@numberstringMfrench=\@numberstringMfrenchfrance - -\newcommand{\@numberstringFfrenchswiss}[1]{% +% \end{macrocode} +% As above, but for feminine version. Swiss: +% \begin{macrocode} +\DeclareRobustCommand{\@numberstringFfrenchswiss}[2]{% \let\@unitstring=\@@unitstringFfrench \let\@teenstring=\@@teenstringfrench \let\@tenstring=\@@tenstringfrench @@ -988,9 +1276,11 @@ Dix% \let\@nineties=\@@ninetiesfrenchswiss \def\@hundred{cent}\def\@thousand{mille}% \def\@andname{et}% -\@@numberstringfrench{#1}} - -\newcommand{\@numberstringFfrenchfrance}[1]{% +\@@numberstringfrench{#1}{#2}} +% \end{macrocode} +% French: +% \begin{macrocode} +\DeclareRobustCommand{\@numberstringFfrenchfrance}[2]{% \let\@unitstring=\@@unitstringFfrench \let\@teenstring=\@@teenstringfrench \let\@tenstring=\@@tenstringfrench @@ -999,9 +1289,11 @@ Dix% \let\@nineties=\@@ninetiesfrench \def\@hundred{cent}\def\@thousand{mille}% \def\@andname{et}% -\@@numberstringfrench{#1}} - -\newcommand{\@numberstringFfrenchbelgian}[1]{% +\@@numberstringfrench{#1}{#2}} +% \end{macrocode} +% Belgian: +% \begin{macrocode} +\DeclareRobustCommand{\@numberstringFfrenchbelgian}[2]{% \let\@unitstring=\@@unitstringFfrench \let\@teenstring=\@@teenstringfrench \let\@tenstring=\@@tenstringfrench @@ -1010,11 +1302,15 @@ Dix% \let\@nineties=\@@ninetiesfrench \def\@hundred{cent}\def\@thousand{mille}% \def\@andname{et}% -\@@numberstringfrench{#1}} - +\@@numberstringfrench{#1}{#2}} +% \end{macrocode} +% Set default dialect: +% \begin{macrocode} \let\@numberstringFfrench=\@numberstringFfrenchfrance - -\newcommand{\@NumberstringMfrenchswiss}[1]{% +% \end{macrocode} +% As above, but with initial letter in upper case. Swiss (masculine): +% \begin{macrocode} +\DeclareRobustCommand{\@NumberstringMfrenchswiss}[2]{% \let\@unitstring=\@@Unitstringfrench \let\@teenstring=\@@Teenstringfrench \let\@tenstring=\@@Tenstringfrench @@ -1023,9 +1319,11 @@ Dix% \let\@nineties=\@@ninetiesfrenchswiss \def\@hundred{Cent}\def\@thousand{Mille}% \def\@andname{et}% -\@@numberstringfrench{#1}} - -\newcommand{\@NumberstringMfrenchfrance}[1]{% +\@@numberstringfrench{#1}{#2}} +% \end{macrocode} +% French: +% \begin{macrocode} +\DeclareRobustCommand{\@NumberstringMfrenchfrance}[2]{% \let\@unitstring=\@@Unitstringfrench \let\@teenstring=\@@Teenstringfrench \let\@tenstring=\@@Tenstringfrench @@ -1034,9 +1332,11 @@ Dix% \let\@nineties=\@@ninetiesfrench \def\@hundred{Cent}\def\@thousand{Mille}% \def\@andname{et}% -\@@numberstringfrench{#1}} - -\newcommand{\@NumberstringMfrenchbelgian}[1]{% +\@@numberstringfrench{#1}{#2}} +% \end{macrocode} +% Belgian: +% \begin{macrocode} +\DeclareRobustCommand{\@NumberstringMfrenchbelgian}[2]{% \let\@unitstring=\@@Unitstringfrench \let\@teenstring=\@@Teenstringfrench \let\@tenstring=\@@Tenstringfrench @@ -1045,11 +1345,15 @@ Dix% \let\@nineties=\@@ninetiesfrench \def\@hundred{Cent}\def\@thousand{Mille}% \def\@andname{et}% -\@@numberstringfrench{#1}} - +\@@numberstringfrench{#1}{#2}} +% \end{macrocode} +% Set default dialect: +% \begin{macrocode} \let\@NumberstringMfrench=\@NumberstringMfrenchfrance - -\newcommand{\@NumberstringFfrenchswiss}[1]{% +% \end{macrocode} +% As above, but feminine. Swiss: +% \begin{macrocode} +\DeclareRobustCommand{\@NumberstringFfrenchswiss}[2]{% \let\@unitstring=\@@UnitstringFfrench \let\@teenstring=\@@Teenstringfrench \let\@tenstring=\@@Tenstringfrench @@ -1058,9 +1362,11 @@ Dix% \let\@nineties=\@@ninetiesfrenchswiss \def\@hundred{Cent}\def\@thousand{Mille}% \def\@andname{et}% -\@@numberstringfrench{#1}} - -\newcommand{\@NumberstringFfrenchfrance}[1]{% +\@@numberstringfrench{#1}{#2}} +% \end{macrocode} +% French (feminine): +% \begin{macrocode} +\DeclareRobustCommand{\@NumberstringFfrenchfrance}[2]{% \let\@unitstring=\@@UnitstringFfrench \let\@teenstring=\@@Teenstringfrench \let\@tenstring=\@@Tenstringfrench @@ -1069,9 +1375,11 @@ Dix% \let\@nineties=\@@ninetiesfrench \def\@hundred{Cent}\def\@thousand{Mille}% \def\@andname{et}% -\@@numberstringfrench{#1}} - -\newcommand{\@NumberstringFfrenchbelgian}[1]{% +\@@numberstringfrench{#1}{#2}} +% \end{macrocode} +% Belgian (feminine): +% \begin{macrocode} +\DeclareRobustCommand{\@NumberstringFfrenchbelgian}[2]{% \let\@unitstring=\@@UnitstringFfrench \let\@teenstring=\@@Teenstringfrench \let\@tenstring=\@@Tenstringfrench @@ -1080,13 +1388,20 @@ Dix% \let\@nineties=\@@ninetiesfrench \def\@hundred{Cent}\def\@thousand{Mille}% \def\@andname{et}% -\@@numberstringfrench{#1}} - +\@@numberstringfrench{#1}{#2}} +% \end{macrocode} +% Set default dialect: +% \begin{macrocode} \let\@NumberstringFfrench=\@NumberstringFfrenchfrance - -\newcommand{\@ordinalstringMfrenchswiss}[1]{% +% \end{macrocode} +% Again, as from version 1.09, this has been changed to take +% two arguments, where the second argument is a control +% sequence, and nothing is displayed. Store textual representation +% of an ordinal in the given control sequence. Swiss dialect (masculine): +% \begin{macrocode} +\DeclareRobustCommand{\@ordinalstringMfrenchswiss}[2]{% \ifnum#1=1\relax -premier% +\def#2{premier}% \else \let\@unitthstring=\@@unitthstringfrench \let\@unitstring=\@@unitstringfrench @@ -1103,12 +1418,14 @@ premier% \def\@hundredth{centi\`eme}\def\@hundred{cent}% \def\@thousandth{mili\`eme}\def\@thousand{mille}% \def\@andname{et}% -\@@ordinalstringfrench{#1}% +\@@ordinalstringfrench{#1}{#2}% \fi} - -\newcommand{\@ordinalstringMfrenchfrance}[1]{% +% \end{macrocode} +% French (masculine): +% \begin{macrocode} +\DeclareRobustCommand{\@ordinalstringMfrenchfrance}[2]{% \ifnum#1=1\relax -premier% +\def#2{premier}% \else \let\@unitthstring=\@@unitthstringfrench \let\@unitstring=\@@unitstringfrench @@ -1126,12 +1443,14 @@ premier% \def\@hundredth{centi\`eme}\def\@hundred{cent}% \def\@thousandth{mili\`eme}\def\@thousand{mille}% \def\@andname{et}% -\@@ordinalstringfrench{#1}% +\@@ordinalstringfrench{#1}{#2}% \fi} - -\newcommand{\@ordinalstringMfrenchbelgian}[1]{% +% \end{macrocode} +% Belgian dialect (masculine): +% \begin{macrocode} +\DeclareRobustCommand{\@ordinalstringMfrenchbelgian}[2]{% \ifnum#1=1\relax -premier% +\def#2{premier}% \else \let\@unitthstring=\@@unitthstringfrench \let\@unitstring=\@@unitstringfrench @@ -1149,14 +1468,18 @@ premier% \def\@hundredth{centi\`eme}\def\@hundred{cent}% \def\@thousandth{mili\`eme}\def\@thousand{mille}% \def\@andname{et}% -\@@ordinalstringfrench{#1}% +\@@ordinalstringfrench{#1}{#2}% \fi} - +% \end{macrocode} +% Set up default dialect: +% \begin{macrocode} \let\@ordinalstringMfrench=\@ordinalstringMfrenchfrance - -\newcommand{\@ordinalstringFfrenchswiss}[1]{% +% \end{macrocode} +% As above, but feminine. Swiss: +% \begin{macrocode} +\DeclareRobustCommand{\@ordinalstringFfrenchswiss}[2]{% \ifnum#1=1\relax -premi\`ere% +\def#2{premi\`ere}% \else \let\@unitthstring=\@@unitthstringfrench \let\@unitstring=\@@unitstringFfrench @@ -1173,12 +1496,14 @@ premi\`ere% \def\@hundredth{centi\`eme}\def\@hundred{cent}% \def\@thousandth{mili\`eme}\def\@thousand{mille}% \def\@andname{et}% -\@@ordinalstringfrench{#1}% +\@@ordinalstringfrench{#1}{#2}% \fi} - -\newcommand{\@ordinalstringFfrenchfrance}[1]{% +% \end{macrocode} +% French (feminine): +% \begin{macrocode} +\DeclareRobustCommand{\@ordinalstringFfrenchfrance}[2]{% \ifnum#1=1\relax -premi\`ere% +\def#2{premi\`ere}% \else \let\@unitthstring=\@@unitthstringfrench \let\@unitstring=\@@unitstringFfrench @@ -1196,12 +1521,14 @@ premi\`ere% \def\@hundredth{centi\`eme}\def\@hundred{cent}% \def\@thousandth{mili\`eme}\def\@thousand{mille}% \def\@andname{et}% -\@@ordinalstringfrench{#1}% +\@@ordinalstringfrench{#1}{#2}% \fi} - -\newcommand{\@ordinalstringFfrenchbelgian}[1]{% +% \end{macrocode} +% Belgian (feminine): +% \begin{macrocode} +\DeclareRobustCommand{\@ordinalstringFfrenchbelgian}[2]{% \ifnum#1=1\relax -premi\`ere% +\def#2{premi\`ere}% \else \let\@unitthstring=\@@unitthstringfrench \let\@unitstring=\@@unitstringFfrench @@ -1219,14 +1546,18 @@ premi\`ere% \def\@hundredth{centi\`eme}\def\@hundred{cent}% \def\@thousandth{mili\`eme}\def\@thousand{mille}% \def\@andname{et}% -\@@ordinalstringfrench{#1}% +\@@ordinalstringfrench{#1}{#2}% \fi} - +% \end{macrocode} +% Set up default dialect: +% \begin{macrocode} \let\@ordinalstringFfrench=\@ordinalstringFfrenchfrance - -\newcommand{\@OrdinalstringMfrenchswiss}[1]{% +% \end{macrocode} +% As above, but with initial letters in upper case. Swiss (masculine): +% \begin{macrocode} +\DeclareRobustCommand{\@OrdinalstringMfrenchswiss}[2]{% \ifnum#1=1\relax -Premi\`ere% +\def#2{Premi\`ere}% \else \let\@unitthstring=\@@Unitthstringfrench \let\@unitstring=\@@Unitstringfrench @@ -1243,12 +1574,14 @@ Premi\`ere% \def\@hundredth{Centi\`eme}\def\@hundred{Cent}% \def\@thousandth{Mili\`eme}\def\@thousand{Mille}% \def\@andname{et}% -\@@ordinalstringfrench{#1}% +\@@ordinalstringfrench{#1}{#2}% \fi} - -\newcommand{\@OrdinalstringMfrenchfrance}[1]{% +% \end{macrocode} +% French (masculine): +% \begin{macrocode} +\DeclareRobustCommand{\@OrdinalstringMfrenchfrance}[2]{% \ifnum#1=1\relax -Premi\`ere% +\def#2{Premi\`ere}% \else \let\@unitthstring=\@@Unitthstringfrench \let\@unitstring=\@@Unitstringfrench @@ -1266,12 +1599,14 @@ Premi\`ere% \def\@hundredth{Centi\`eme}\def\@hundred{Cent}% \def\@thousandth{Mili\`eme}\def\@thousand{Mille}% \def\@andname{et}% -\@@ordinalstringfrench{#1}% +\@@ordinalstringfrench{#1}{#2}% \fi} - -\newcommand{\@OrdinalstringMfrenchbelgian}[1]{% +% \end{macrocode} +% Belgian (masculine): +% \begin{macrocode} +\DeclareRobustCommand{\@OrdinalstringMfrenchbelgian}[2]{% \ifnum#1=1\relax -Premi\`ere% +\def#2{Premi\`ere}% \else \let\@unitthstring=\@@Unitthstringfrench \let\@unitstring=\@@Unitstringfrench @@ -1289,14 +1624,18 @@ Premi\`ere% \def\@hundredth{Centi\`eme}\def\@hundred{Cent}% \def\@thousandth{Mili\`eme}\def\@thousand{Mille}% \def\@andname{et}% -\@@ordinalstringfrench{#1}% +\@@ordinalstringfrench{#1}{#2}% \fi} - +% \end{macrocode} +% Set up default dialect: +% \begin{macrocode} \let\@OrdinalstringMfrench=\@OrdinalstringMfrenchfrance - -\newcommand{\@OrdinalstringFfrenchswiss}[1]{% +% \end{macrocode} +% As above, but feminine form. Swiss: +% \begin{macrocode} +\DeclareRobustCommand{\@OrdinalstringFfrenchswiss}[2]{% \ifnum#1=1\relax -Premi\`ere% +\def#2{Premi\`ere}% \else \let\@unitthstring=\@@Unitthstringfrench \let\@unitstring=\@@UnitstringFfrench @@ -1313,12 +1652,14 @@ Premi\`ere% \def\@hundredth{Centi\`eme}\def\@hundred{Cent}% \def\@thousandth{Mili\`eme}\def\@thousand{Mille}% \def\@andname{et}% -\@@ordinalstringfrench{#1}% +\@@ordinalstringfrench{#1}{#2}% \fi} - -\newcommand{\@OrdinalstringFfrenchfrance}[1]{% +% \end{macrocode} +% French (feminine): +% \begin{macrocode} +\DeclareRobustCommand{\@OrdinalstringFfrenchfrance}[2]{% \ifnum#1=1\relax -Premi\`ere% +\def#2{Premi\`ere}% \else \let\@unitthstring=\@@Unitthstringfrench \let\@unitstring=\@@UnitstringFfrench @@ -1336,12 +1677,14 @@ Premi\`ere% \def\@hundredth{Centi\`eme}\def\@hundred{Cent}% \def\@thousandth{Mili\`eme}\def\@thousand{Mille}% \def\@andname{et}% -\@@ordinalstringfrench{#1}% +\@@ordinalstringfrench{#1}{#2}% \fi} - -\newcommand{\@OrdinalstringFfrenchbelgian}[1]{% +% \end{macrocode} +% Belgian (feminine): +% \begin{macrocode} +\DeclareRobustCommand{\@OrdinalstringFfrenchbelgian}[2]{% \ifnum#1=1\relax -Premi\`ere% +\def#2{Premi\`ere}% \else \let\@unitthstring=\@@Unitthstringfrench \let\@unitstring=\@@UnitstringFfrench @@ -1359,26 +1702,19 @@ Premi\`ere% \def\@hundredth{Centi\`eme}\def\@hundred{Cent}% \def\@thousandth{Mili\`eme}\def\@thousand{Mille}% \def\@andname{et}% -\@@ordinalstringfrench{#1}% +\@@ordinalstringfrench{#1}{#2}% \fi} - +% \end{macrocode} +% Set up default dialect: +% \begin{macrocode} \let\@OrdinalstringFfrench=\@OrdinalstringFfrenchfrance - -\newcommand{\@ordinalMfrench}[1]{% -\iffmtord@abbrv -#1\fmtord{e}% -\else -#1\ifnum#1=1\fmtord{er}\else\fmtord{eme}\fi -\fi} - -\newcommand{\@ordinalFfrench}[1]{% -\iffmtord@abbrv -#1\fmtord{e}% -\else -#1\ifnum#1=1\fmtord{ere}\else\fmtord{eme}\fi -\fi} - -\newcommand{\@@unitthstringfrench}[1]{% +% \end{macrocode} +% In order to convert numbers into textual ordinals, need +% to break it up into units, tens and teens. First the units. +% The argument must be a number or count register between 0 +% and 9. +% \begin{macrocode} +\newcommand*{\@@unitthstringfrench}[1]{% \ifcase#1\relax zero% \or uni\`eme% @@ -1392,8 +1728,11 @@ zero% \or neuvi\`eme% \fi } - -\newcommand{\@@tenthstringfrench}[1]{% +% \end{macrocode} +% Tens (includes Swiss and Belgian variants, special cases are +% dealt with later.) +% \begin{macrocode} +\newcommand*{\@@tenthstringfrench}[1]{% \ifcase#1\relax \or dixi\`eme% \or vingti\`eme% @@ -1406,8 +1745,10 @@ zero% \or nonenti\`eme% \fi } - -\newcommand{\@@teenthstringfrench}[1]{% +% \end{macrocode} +% Teens: +% \begin{macrocode} +\newcommand*{\@@teenthstringfrench}[1]{% \ifcase#1\relax dixi\`eme% \or onzi\`eme% @@ -1421,8 +1762,10 @@ dixi\`eme% \or dix-neuvi\`eme% \fi } - -\newcommand{\@@seventiethsfrenchswiss}[1]{% +% \end{macrocode} +% Seventies vary depending on dialect. Swiss: +% \begin{macrocode} +\newcommand*{\@@seventiethsfrenchswiss}[1]{% \ifcase#1\relax \@tenthstring{7}% \or @@ -1430,8 +1773,10 @@ dixi\`eme% \else \@tenstring{7}-\@unitthstring{#1}% \fi} - -\newcommand{\@@eightiethsfrenchswiss}[1]{% +% \end{macrocode} +% Eighties vary depending on dialect. Swiss: +% \begin{macrocode} +\newcommand*{\@@eightiethsfrenchswiss}[1]{% \ifcase#1\relax \@tenthstring{8}% \or @@ -1439,8 +1784,10 @@ dixi\`eme% \else \@tenstring{8}-\@unitthstring{#1}% \fi} - -\newcommand{\@@ninetiethsfrenchswiss}[1]{% +% \end{macrocode} +% Nineties vary depending on dialect. Swiss: +% \begin{macrocode} +\newcommand*{\@@ninetiethsfrenchswiss}[1]{% \ifcase#1\relax \@tenthstring{9}% \or @@ -1448,8 +1795,10 @@ dixi\`eme% \else \@tenstring{9}-\@unitthstring{#1}% \fi} - -\newcommand{\@@seventiethsfrench}[1]{% +% \end{macrocode} +% French (as spoken in France) version: +% \begin{macrocode} +\newcommand*{\@@seventiethsfrench}[1]{% \ifnum#1=0\relax \@tenstring{6}% -% @@ -1459,8 +1808,10 @@ dixi\`eme% \fi \@teenthstring{#1}% } - -\newcommand{\@@eightiethsfrench}[1]{% +% \end{macrocode} +% Eighties (as spoken in France): +% \begin{macrocode} +\newcommand*{\@@eightiethsfrench}[1]{% \ifnum#1>0\relax \@unitstring{4}-\@tenstring{2}% -\@unitthstring{#1}% @@ -1468,12 +1819,16 @@ dixi\`eme% \@unitstring{4}-\@tenthstring{2}% \fi } - -\newcommand{\@@ninetiethsfrench}[1]{% +% \end{macrocode} +% Nineties (as spoken in France): +% \begin{macrocode} +\newcommand*{\@@ninetiethsfrench}[1]{% \@unitstring{4}-\@tenstring{2}-\@teenthstring{#1}% } - -\newcommand{\@@Unitthstringfrench}[1]{% +% \end{macrocode} +% As above, but with initial letter in upper case. Units: +% \begin{macrocode} +\newcommand*{\@@Unitthstringfrench}[1]{% \ifcase#1\relax Zero% \or Uni\`eme% @@ -1487,8 +1842,10 @@ Zero% \or Neuvi\`eme% \fi } - -\newcommand{\@@Tenthstringfrench}[1]{% +% \end{macrocode} +% Tens (includes Belgian and Swiss variants): +% \begin{macrocode} +\newcommand*{\@@Tenthstringfrench}[1]{% \ifcase#1\relax \or Dixi\`eme% \or Vingti\`eme% @@ -1501,8 +1858,10 @@ Zero% \or Nonenti\`eme% \fi } - -\newcommand{\@@Teenthstringfrench}[1]{% +% \end{macrocode} +% Teens: +% \begin{macrocode} +\newcommand*{\@@Teenthstringfrench}[1]{% \ifcase#1\relax Dixi\`eme% \or Onzi\`eme% @@ -1516,10 +1875,11 @@ Dixi\`eme% \or Dix-Neuvi\`eme% \fi } - % \end{macrocode} +% Store textual representation of number (first argument) in given control +% sequence (second argument). % \begin{macrocode} -\newcommand{\@@numberstringfrench}[1]{% +\newcommand*{\@@numberstringfrench}[2]{% \ifnum#1>99999 \PackageError{fmtcount}{Out of range}% {This macro only works for values less than 100000}% @@ -1531,57 +1891,78 @@ you can try typing "minus" first, and then pass the modulus of this number}% \fi \fi +\def#2{}% \@strctr=#1\relax \divide\@strctr by 1000\relax -\ifnum\@strctr>9 +\ifnum\@strctr>9\relax % #1 is greater or equal to 10000 \@tmpstrctr=\@strctr - \divide\@strctr by 10 - \ifnum\@strctr>1 + \divide\@strctr by 10\relax + \ifnum\@strctr>1\relax \ifthenelse{\(\@strctr>6\)\and\(\@strctr<10\)}{% \@modulo{\@tmpstrctr}{10}% \ifnum\@strctr<8\relax - \@seventies{\@tmpstrctr}% + \let\@@fc@numstr#2\relax + \edef#2{\@@fc@numstr\@seventies{\@tmpstrctr}}% \else \ifnum\@strctr<9\relax - \@eighties{\@tmpstrctr}% + \let\@@fc@numstr#2\relax + \edef#2{\@@fc@numstr\@eighties{\@tmpstrctr}}% \else - \ifnum\@strctr<10\@nineties{\@tmpstrctr}\fi + \ifnum\@strctr<10\relax + \let\@@fc@numstr#2\relax + \edef#2{\@@fc@numstr\@nineties{\@tmpstrctr}}% + \fi \fi \fi }{% - \@tenstring{\@strctr}% + \let\@@fc@numstr#2\relax + \edef#2{\@@fc@numstr\@tenstring{\@strctr}}% \@strctr=#1\relax \divide\@strctr by 1000\relax \@modulo{\@strctr}{10}% \ifnum\@strctr>0\relax -% \ifnum\@strctr=1\ \@andname\fi - \ \@unitstring{\@strctr}% + \let\@@fc@numstr#2\relax + \edef#2{\@@fc@numstr\ \@unitstring{\@strctr}}% \fi }% \else \@strctr=#1\relax \divide\@strctr by 1000 \@modulo{\@strctr}{10}% - \@teenstring{\@strctr}% + \let\@@fc@numstr#2\relax + \edef#2{\@@fc@numstr\@teenstring{\@strctr}}% \fi - \ \@thousand% + \let\@@fc@numstr#2\relax + \edef#2{\@@fc@numstr\ \@thousand}% \else - \ifnum\@strctr>0 - \ifnum\@strctr>1\@unitstring{\@strctr}\ \fi - \@thousand + \ifnum\@strctr>0\relax + \ifnum\@strctr>1\relax + \let\@@fc@numstr#2\relax + \edef#2{\@@fc@numstr\@unitstring{\@strctr}\ }% + \fi + \let\@@fc@numstr#2\relax + \edef#2{\@@fc@numstr\@thousand}% \fi \fi \@strctr=#1\relax \@modulo{\@strctr}{1000}% \divide\@strctr by 100 \ifnum\@strctr>0\relax - \ifnum#1>1000 \ \fi + \ifnum#1>1000\relax + \let\@@fc@numstr#2\relax + \edef#2{\@@fc@numstr\ }% + \fi \@tmpstrctr=#1\relax \@modulo{\@tmpstrctr}{1000}\relax \ifnum\@tmpstrctr=100\relax - \@tenstring{10}\relax + \let\@@fc@numstr#2\relax + \edef#2{\@@fc@numstr\@tenstring{10}}% \else - \ifnum\@strctr>1\@unitstring{\@strctr}\ \fi - \@hundred + \ifnum\@strctr>1\relax + \let\@@fc@numstr#2\relax + \edef#2{\@@fc@numstr\@unitstring{\@strctr}\ }% + \fi + \let\@@fc@numstr#2\relax + \edef#2{\@@fc@numstr\@hundred}% \fi \fi \@strctr=#1\relax \@modulo{\@strctr}{100}% @@ -1589,49 +1970,71 @@ this number}% %\divide\@tmpstrctr by 100\relax \ifnum#1>100\relax \ifnum\@strctr>0\relax -\ % \ \@andname\ + \let\@@fc@numstr#2\relax + \edef#2{\@@fc@numstr\ }% \else - \ifnum\@tmpstrctr>0s\fi% + \ifnum\@tmpstrctr>0\relax + \let\@@fc@numstr#2\relax + \edef#2{\@@fc@numstr s}% + \fi% \fi \fi -\ifnum\@strctr>19 -\@tmpstrctr=\@strctr -\divide\@strctr by 10 -\ifthenelse{\@strctr>6}{% -\@modulo{\@tmpstrctr}{10}% -\ifnum\@strctr<8 -\@seventies{\@tmpstrctr}% -\else -\ifnum\@strctr<9 -\@eighties{\@tmpstrctr}% -\else -\@nineties{\@tmpstrctr}% -\fi -\fi -}{% -\@tenstring{\@strctr}% -\@strctr=#1\relax \@modulo{\@strctr}{10}% -\ifnum\@strctr>0\relax - \ifnum\@strctr=1\ \@andname\ \else-\fi - \@unitstring{\@strctr}% -\fi -}% +\ifnum\@strctr>19\relax + \@tmpstrctr=\@strctr + \divide\@strctr by 10\relax + \ifthenelse{\@strctr>6}{% + \@modulo{\@tmpstrctr}{10}% + \ifnum\@strctr<8\relax + \let\@@fc@numstr#2\relax + \edef#2{\@@fc@numstr\@seventies{\@tmpstrctr}}% + \else + \ifnum\@strctr<9\relax + \let\@@fc@numstr#2\relax + \edef#2{\@@fc@numstr\@eighties{\@tmpstrctr}}% + \else + \let\@@fc@numstr#2\relax + \edef#2{\@@fc@numstr\@nineties{\@tmpstrctr}}% + \fi + \fi + }{% + \let\@@fc@numstr#2\relax + \edef#2{\@@fc@numstr\@tenstring{\@strctr}}% + \@strctr=#1\relax \@modulo{\@strctr}{10}% + \ifnum\@strctr>0\relax + \let\@@fc@numstr#2\relax + \ifnum\@strctr=1\relax + \edef#2{\@@fc@numstr\ \@andname\ }% + \else + \edef#2{\@@fc@numstr-}% + \fi + \let\@@fc@numstr#2\relax + \edef#2{\@@fc@numstr\@unitstring{\@strctr}}% + \fi + }% \else -\ifnum\@strctr<10 -\ifnum\@strctr=0 -\ifnum#1<100 \@unitstring{\@strctr}\fi -\else%(>0,<10) -\@unitstring{\@strctr}% -\fi -\else%>10 -\@modulo{\@strctr}{10}% -\@teenstring{\@strctr}% -\fi + \ifnum\@strctr<10\relax + \ifnum\@strctr=0\relax + \ifnum#1<100\relax + \let\@@fc@numstr#2\relax + \edef#2{\@@fc@numstr\@unitstring{\@strctr}}% + \fi + \else%(>0,<10) + \let\@@fc@numstr#2\relax + \edef#2{\@@fc@numstr\@unitstring{\@strctr}}% + \fi + \else%>10 + \@modulo{\@strctr}{10}% + \let\@@fc@numstr#2\relax + \edef#2{\@@fc@numstr\@teenstring{\@strctr}}% + \fi \fi } % \end{macrocode} +% Store textual representation of an ordinal (from number +% specified in first argument) in given control +% sequence (second argument). % \begin{macrocode} -\newcommand{\@@ordinalstringfrench}[1]{% +\newcommand*{\@@ordinalstringfrench}[2]{% \ifnum#1>99999 \PackageError{fmtcount}{Out of range}% {This macro only works for values less than 100000}% @@ -1643,6 +2046,7 @@ you can try typing "minus" first, and then pass the modulus of this number}% \fi \fi +\def#2{}% \@strctr=#1\relax \divide\@strctr by 1000\relax \ifnum\@strctr>9 % #1 is greater or equal to 10000 @@ -1652,85 +2056,137 @@ this number}% \ifthenelse{\@strctr>6}{% \@modulo{\@tmpstrctr}{10}% \ifnum\@strctr=7\relax - \@seventies{\@tmpstrctr}% + \let\@@fc@ordstr#2\relax + \edef#2{\@@fc@ordstr\@seventies{\@tmpstrctr}}% \else \ifnum\@strctr=8\relax - \@eighties{\@tmpstrctr}% + \let\@@fc@ordstr#2\relax + \edef#2{\@@fc@ordstr\@eighties{\@tmpstrctr}}% \else - \@nineties{\@tmpstrctr}% + \let\@@fc@ordstr#2\relax + \edef#2{\@@fc@ordstr\@nineties{\@tmpstrctr}}% \fi \fi }{% - \@tenstring{\@strctr}% + \let\@@fc@ordstr#2\relax + \edef#2{\@@fc@ordstr\@tenstring{\@strctr}}% \@strctr=#1\relax \divide\@strctr by 1000\relax \@modulo{\@strctr}{10}% - \ifnum\@strctr=1\ \@andname\fi - \ifnum\@strctr>0\ \@unitstring{\@strctr}\fi + \ifnum\@strctr=1\relax + \let\@@fc@ordstr#2\relax + \edef#2{\@@fc@ordstr\ \@andname}% + \fi + \ifnum\@strctr>0\relax + \let\@@fc@ordstr#2\relax + \edef#2{\@@fc@ordstr\ \@unitstring{\@strctr}}% + \fi }% \else \@strctr=#1\relax \divide\@strctr by 1000\relax \@modulo{\@strctr}{10}% - \@teenstring{\@strctr}% + \let\@@fc@ordstr#2\relax + \edef#2{\@@fc@ordstr\@teenstring{\@strctr}}% \fi \@strctr=#1\relax \@modulo{\@strctr}{1000}% - \ifnum\@strctr=0\ \@thousandth\else\ \@thousand \fi + \ifnum\@strctr=0\relax + \let\@@fc@ordstr#2\relax + \edef#2{\@@fc@ordstr\ \@thousandth}% + \else + \let\@@fc@ordstr#2\relax + \edef#2{\@@fc@ordstr\ \@thousand}% + \fi \else \ifnum\@strctr>0\relax - \@unitstring{\@strctr}% + \let\@@fc@ordstr#2\relax + \edef#2{\@@fc@ordstr\@unitstring{\@strctr}}% \@strctr=#1\relax \@modulo{\@strctr}{1000}% - \ifnum\@strctr=0\ \@thousandth\else\ \@thousand\fi + \ifnum\@strctr=0\relax + \let\@@fc@ordstr#2\relax + \edef#2{\@@fc@ordstr\ \@thousandth}% + \else + \let\@@fc@ordstr#2\relax + \edef#2{\@@fc@ordstr\ \@thousand}% + \fi \fi \fi \@strctr=#1\relax \@modulo{\@strctr}{1000}% -\divide\@strctr by 100 -\ifnum\@strctr>0 -\ifnum#1>1000 \ \fi\@unitstring{\@strctr}% -\@strctr=#1\relax \@modulo{\@strctr}{100}% -\ifnum\@strctr=0\ \@hundredth\else\ \@hundred\fi +\divide\@strctr by 100\relax +\ifnum\@strctr>0\relax + \ifnum#1>1000\relax + \let\@@fc@ordstr#2\relax + \edef#2{\@@fc@ordstr\ }% + \fi + \let\@@fc@ordstr#2\relax + \edef#2{\@@fc@ordstr\@unitstring{\@strctr}}% + \@strctr=#1\relax \@modulo{\@strctr}{100}% + \let\@@fc@ordstr#2\relax + \ifnum\@strctr=0\relax + \edef#2{\@@fc@ordstr\ \@hundredth}% + \else + \edef#2{\@@fc@ordstr\ \@hundred}% + \fi \fi \@tmpstrctr=\@strctr \@strctr=#1\relax \@modulo{\@strctr}{100}% \ifnum#1>100\relax -\ifnum\@strctr>0\ \@andname\ \fi\fi -\ifnum\@strctr>19 -\@tmpstrctr=\@strctr -\divide\@strctr by 10 -\@modulo{\@tmpstrctr}{10}% -\ifthenelse{\@strctr>6}{% -\ifnum\@strctr=7\relax -\@seventieths{\@tmpstrctr}% -\else -\ifnum\@strctr=8\relax -\@eightieths{\@tmpstrctr}% -\else -\@ninetieths{\@tmpstrctr}% -\fi -\fi -}{% -\ifnum\@tmpstrctr=0\relax - \@tenthstring{\@strctr}% -\else - \@tenstring{\@strctr}% -\fi -\@strctr=#1\relax \@modulo{\@strctr}{10}% -\ifnum\@strctr=1\ \@andname\fi -\ifnum\@strctr>0 -\ \@unitthstring{\@strctr}% -\fi -}% -\else -\ifnum\@strctr<10 -\ifnum\@strctr=0 -\ifnum#1<100 \@unitthstring{\@strctr}\fi -\else -\@unitthstring{\@strctr}% + \ifnum\@strctr>0\relax + \let\@@fc@ordstr#2\relax + \edef#2{\@@fc@ordstr\ \@andname\ }% + \fi \fi +\ifnum\@strctr>19\relax + \@tmpstrctr=\@strctr + \divide\@strctr by 10\relax + \@modulo{\@tmpstrctr}{10}% + \ifthenelse{\@strctr>6}{% + \ifnum\@strctr=7\relax + \let\@@fc@ordstr#2\relax + \edef#2{\@@fc@ordstr\@seventieths{\@tmpstrctr}}% + \else + \ifnum\@strctr=8\relax + \let\@@fc@ordstr#2\relax + \edef#2{\@@fc@ordstr\@eightieths{\@tmpstrctr}}% + \else + \let\@@fc@ordstr#2\relax + \edef#2{\@@fc@ordstr\@ninetieths{\@tmpstrctr}}% + \fi + \fi + }{% + \ifnum\@tmpstrctr=0\relax + \let\@@fc@ordstr#2\relax + \edef#2{\@@fc@ordstr\@tenthstring{\@strctr}}% + \else + \let\@@fc@ordstr#2\relax + \edef#2{\@@fc@ordstr\@tenstring{\@strctr}}% + \fi + \@strctr=#1\relax \@modulo{\@strctr}{10}% + \ifnum\@strctr=1\relax + \let\@@fc@ordstr#2\relax + \edef#2{\@@fc@ordstr\ \@andname}% + \fi + \ifnum\@strctr>0\relax + \let\@@fc@ordstr#2\relax + \edef#2{\@@fc@ordstr\ \@unitthstring{\@strctr}}% + \fi + }% \else -\@modulo{\@strctr}{10}% -\@teenthstring{\@strctr}% -\fi + \ifnum\@strctr<10\relax + \ifnum\@strctr=0\relax + \ifnum#1<100\relax + \let\@@fc@ordstr#2\relax + \edef#2{\@@fc@ordstr\@unitthstring{\@strctr}}% + \fi + \else + \let\@@fc@ordstr#2\relax + \edef#2{\@@fc@ordstr\@unitthstring{\@strctr}}% + \fi + \else + \@modulo{\@strctr}{10}% + \let\@@fc@ordstr#2\relax + \edef#2{\@@fc@ordstr\@teenthstring{\@strctr}}% + \fi \fi } % \end{macrocode} @@ -1744,17 +2200,41 @@ this number}% %<*fc-portuges.def> % \end{macrocode} %\fi -% Portuguse +% \subsection{fc-portuges.def} +% Portuguse definitions % \begin{macrocode} -\ProvidesFile{fc-portuges.def}[2005/04/29] +\ProvidesFile{fc-portuges.def}[2007/04/20] +% \end{macrocode} +% Define macro that converts a number or count register (first +% argument) to an ordinal, and stores the result in the second +% argument, which should be a control sequence. Masculine: +% \begin{macrocode} +\newcommand*{\@ordinalMportuges}[2]{% +\ifnum#1=0\relax + \edef#2{\number#1}% +\else + \edef#2{\number#1\relax\noexpand\fmtord{o}}% +\fi} % \end{macrocode} +% Feminine: % \begin{macrocode} -\newcommand{\@@unitstringportuges}[1]{% +\newcommand*{\@ordinalFportuges}[2]{% +\ifnum#1=0\relax + \edef#2{\number#1}% +\else + \edef#2{\number#1\relax\noexpand\fmtord{a}}% +\fi} +% \end{macrocode} +% Convert a number to a textual representation. To make it easier, +% split it up into units, tens, teens and hundreds. Units (argument must +% be a number from 0 to 9): +% \begin{macrocode} +\newcommand*{\@@unitstringportuges}[1]{% \ifcase#1\relax zero% \or um% \or dois% -\or tr\`es% +\or tr\^es% \or quatro% \or cinco% \or seis% @@ -1763,13 +2243,15 @@ zero% \or nove% \fi } - -\newcommand{\@@unitstringFportuges}[1]{% +% \end{macrocode} +% As above, but for feminine: +% \begin{macrocode} +\newcommand*{\@@unitstringFportuges}[1]{% \ifcase#1\relax zero% \or uma% \or duas% -\or tr\`es% +\or tr\^es% \or quatro% \or cinco% \or seis% @@ -1778,8 +2260,10 @@ zero% \or nove% \fi } - -\newcommand{\@@tenstringportuges}[1]{% +% \end{macrocode} +% Tens (argument must be a number from 0 to 10): +% \begin{macrocode} +\newcommand*{\@@tenstringportuges}[1]{% \ifcase#1\relax \or dez% \or vinte% @@ -1793,8 +2277,10 @@ zero% \or cem% \fi } - -\newcommand{\@@teenstringportuges}[1]{% +% \end{macrocode} +% Teens (argument must be a number from 0 to 9): +% \begin{macrocode} +\newcommand*{\@@teenstringportuges}[1]{% \ifcase#1\relax dez% \or onze% @@ -1808,8 +2294,10 @@ dez% \or dezenove% \fi } - -\newcommand{\@@hundredstringportuges}[1]{% +% \end{macrocode} +% Hundreds: +% \begin{macrocode} +\newcommand*{\@@hundredstringportuges}[1]{% \ifcase#1\relax \or cento% \or duzentos% @@ -1821,10 +2309,12 @@ dez% \or oitocentos% \or novecentos% \fi} - -\newcommand{\@@hundredstringFportuges}[1]{% +% \end{macrocode} +% Hundreds (feminine): +% \begin{macrocode} +\newcommand*{\@@hundredstringFportuges}[1]{% \ifcase#1\relax -\or centa% +\or cento% \or duzentas% \or trezentas% \or quatrocentas% @@ -1834,13 +2324,15 @@ dez% \or oitocentas% \or novecentas% \fi} - -\newcommand{\@@Unitstringportuges}[1]{% +% \end{macrocode} +% Units (initial letter in upper case): +% \begin{macrocode} +\newcommand*{\@@Unitstringportuges}[1]{% \ifcase#1\relax Zero% \or Um% \or Dois% -\or Tr\`es% +\or Tr\^es% \or Quatro% \or Cinco% \or Seis% @@ -1849,13 +2341,15 @@ Zero% \or Nove% \fi } - -\newcommand{\@@UnitstringFportuges}[1]{% +% \end{macrocode} +% As above, but feminine: +% \begin{macrocode} +\newcommand*{\@@UnitstringFportuges}[1]{% \ifcase#1\relax Zera% \or Uma% \or Duas% -\or Tr\`es% +\or Tr\^es% \or Quatro% \or Cinco% \or Seis% @@ -1864,8 +2358,10 @@ Zera% \or Nove% \fi } - -\newcommand{\@@Tenstringportuges}[1]{% +% \end{macrocode} +% Tens (with initial letter in upper case): +% \begin{macrocode} +\newcommand*{\@@Tenstringportuges}[1]{% \ifcase#1\relax \or Dez% \or Vinte% @@ -1879,8 +2375,10 @@ Zera% \or Cem% \fi } - -\newcommand{\@@Teenstringportuges}[1]{% +% \end{macrocode} +% Teens (with initial letter in upper case): +% \begin{macrocode} +\newcommand*{\@@Teenstringportuges}[1]{% \ifcase#1\relax Dez% \or Onze% @@ -1894,8 +2392,10 @@ Dez% \or Dezenove% \fi } - -\newcommand{\@@Hundredstringportuges}[1]{% +% \end{macrocode} +% Hundreds (with initial letter in upper case): +% \begin{macrocode} +\newcommand*{\@@Hundredstringportuges}[1]{% \ifcase#1\relax \or Cento% \or Duzentos% @@ -1907,10 +2407,12 @@ Dez% \or Oitocentos% \or Novecentos% \fi} - -\newcommand{\@@HundredstringFportuges}[1]{% +% \end{macrocode} +% As above, but feminine: +% \begin{macrocode} +\newcommand*{\@@HundredstringFportuges}[1]{% \ifcase#1\relax -\or Centa% +\or Cento% \or Duzentas% \or Trezentas% \or Quatrocentas% @@ -1920,85 +2422,103 @@ Dez% \or Oitocentas% \or Novecentas% \fi} - -\newcommand{\@numberstringMportuges}[1]{% +% \end{macrocode} +% This has changed in version 1.08, so that it now stores +% the result in the second argument, but doesn't display +% anything. Since it only affects internal macros, it shouldn't +% affect documents created with older versions. (These internal +% macros are not meant for use in documents.) +% \begin{macrocode} +\DeclareRobustCommand{\@numberstringMportuges}[2]{% \let\@unitstring=\@@unitstringportuges \let\@teenstring=\@@teenstringportuges \let\@tenstring=\@@tenstringportuges \let\@hundredstring=\@@hundredstringportuges \def\@hundred{cem}\def\@thousand{mil}% \def\@andname{e}% -\@@numberstringportuges{#1}} - -\newcommand{\@numberstringFportuges}[1]{% +\@@numberstringportuges{#1}{#2}} +% \end{macrocode} +% As above, but feminine form: +% \begin{macrocode} +\DeclareRobustCommand{\@numberstringFportuges}[2]{% \let\@unitstring=\@@unitstringFportuges \let\@teenstring=\@@teenstringportuges \let\@tenstring=\@@tenstringportuges \let\@hundredstring=\@@hundredstringFportuges \def\@hundred{cem}\def\@thousand{mil}% \def\@andname{e}% -\@@numberstringportuges{#1}} - -\newcommand{\@NumberstringMportuges}[1]{% +\@@numberstringportuges{#1}{#2}} +% \end{macrocode} +% As above, but initial letters in upper case: +% \begin{macrocode} +\DeclareRobustCommand{\@NumberstringMportuges}[2]{% \let\@unitstring=\@@Unitstringportuges \let\@teenstring=\@@Teenstringportuges \let\@tenstring=\@@Tenstringportuges \let\@hundredstring=\@@Hundredstringportuges \def\@hundred{Cem}\def\@thousand{Mil}% \def\@andname{e}% -\@@numberstringportuges{#1}} - -\newcommand{\@NumberstringFportuges}[1]{% +\@@numberstringportuges{#1}{#2}} +% \end{macrocode} +% As above, but feminine form: +% \begin{macrocode} +\DeclareRobustCommand{\@NumberstringFportuges}[2]{% \let\@unitstring=\@@UnitstringFportuges \let\@teenstring=\@@Teenstringportuges \let\@tenstring=\@@Tenstringportuges \let\@hundredstring=\@@HundredstringFportuges \def\@hundred{Cem}\def\@thousand{Mil}% \def\@andname{e}% -\@@numberstringportuges{#1}} - -\newcommand{\@ordinalstringMportuges}[1]{% +\@@numberstringportuges{#1}{#2}} +% \end{macrocode} +% As above, but for ordinals. +% \begin{macrocode} +\DeclareRobustCommand{\@ordinalstringMportuges}[2]{% \let\@unitthstring=\@@unitthstringportuges \let\@unitstring=\@@unitstringportuges \let\@teenthstring=\@@teenthstringportuges \let\@tenthstring=\@@tenthstringportuges \let\@hundredthstring=\@@hundredthstringportuges \def\@thousandth{mil\'esimo}% -\@@ordinalstringportuges{#1}} - -\newcommand{\@ordinalstringFportuges}[1]{% +\@@ordinalstringportuges{#1}{#2}} +% \end{macrocode} +% Feminine form: +% \begin{macrocode} +\DeclareRobustCommand{\@ordinalstringFportuges}[2]{% \let\@unitthstring=\@@unitthstringFportuges \let\@unitstring=\@@unitstringFportuges \let\@teenthstring=\@@teenthstringportuges \let\@tenthstring=\@@tenthstringFportuges \let\@hundredthstring=\@@hundredthstringFportuges \def\@thousandth{mil\'esima}% -\@@ordinalstringportuges{#1}} - -\newcommand{\@OrdinalstringMportuges}[1]{% +\@@ordinalstringportuges{#1}{#2}} +% \end{macrocode} +% As above, but initial letters in upper case (masculine): +% \begin{macrocode} +\DeclareRobustCommand{\@OrdinalstringMportuges}[2]{% \let\@unitthstring=\@@Unitthstringportuges \let\@unitstring=\@@Unitstringportuges \let\@teenthstring=\@@teenthstringportuges \let\@tenthstring=\@@Tenthstringportuges \let\@hundredthstring=\@@Hundredthstringportuges \def\@thousandth{Mil\'esimo}% -\@@ordinalstringportuges{#1}} - -\newcommand{\@OrdinalstringFportuges}[1]{% +\@@ordinalstringportuges{#1}{#2}} +% \end{macrocode} +% Feminine form: +% \begin{macrocode} +\DeclareRobustCommand{\@OrdinalstringFportuges}[2]{% \let\@unitthstring=\@@UnitthstringFportuges \let\@unitstring=\@@UnitstringFportuges \let\@teenthstring=\@@teenthstringportuges \let\@tenthstring=\@@TenthstringFportuges \let\@hundredthstring=\@@HundredthstringFportuges \def\@thousandth{Mil\'esima}% -\@@ordinalstringportuges{#1}} - -\newcommand{\@ordinalMportuges}[1]{% -#1\ifnum#1=0\else\fmtord{o}\fi} -\newcommand{\@ordinalFportuges}[1]{% -#1\ifnum#1=0\else\fmtord{a}\fi} - -\newcommand{\@@unitthstringportuges}[1]{% +\@@ordinalstringportuges{#1}{#2}} +% \end{macrocode} +% In order to do the ordinals, split into units, teens, tens +% and hundreds. Units: +% \begin{macrocode} +\newcommand*{\@@unitthstringportuges}[1]{% \ifcase#1\relax zero% \or primeiro% @@ -2012,8 +2532,10 @@ zero% \or nono% \fi } - -\newcommand{\@@tenthstringportuges}[1]{% +% \end{macrocode} +% Tens: +% \begin{macrocode} +\newcommand*{\@@tenthstringportuges}[1]{% \ifcase#1\relax \or d\'ecimo% \or vig\'esimo% @@ -2026,14 +2548,18 @@ zero% \or nonag\'esimo% \fi } - -\newcommand{\@@teenthstringportuges}[1]{% +% \end{macrocode} +% Teens: +% \begin{macrocode} +\newcommand*{\@@teenthstringportuges}[1]{% \@tenthstring{1}% \ifnum#1>0\relax -\@unitthstring{#1}% \fi} - -\newcommand{\@@hundredthstringportuges}[1]{% +% \end{macrocode} +% Hundreds: +% \begin{macrocode} +\newcommand*{\@@hundredthstringportuges}[1]{% \ifcase#1\relax \or cent\'esimo% \or ducent\'esimo% @@ -2045,8 +2571,10 @@ zero% \or octingent\'esimo% \or nongent\'esimo% \fi} - -\newcommand{\@@unitthstringFportuges}[1]{% +% \end{macrocode} +% Units (feminine): +% \begin{macrocode} +\newcommand*{\@@unitthstringFportuges}[1]{% \ifcase#1\relax zero% \or primeira% @@ -2060,8 +2588,10 @@ zero% \or nona% \fi } - -\newcommand{\@@tenthstringFportuges}[1]{% +% \end{macrocode} +% Tens (feminine): +% \begin{macrocode} +\newcommand*{\@@tenthstringFportuges}[1]{% \ifcase#1\relax \or d\'ecima% \or vig\'esima% @@ -2074,8 +2604,10 @@ zero% \or nonag\'esima% \fi } - -\newcommand{\@@hundredthstringFportuges}[1]{% +% \end{macrocode} +% Hundreds (feminine): +% \begin{macrocode} +\newcommand*{\@@hundredthstringFportuges}[1]{% \ifcase#1\relax \or cent\'esima% \or ducent\'esima% @@ -2087,8 +2619,10 @@ zero% \or octingent\'esima% \or nongent\'esima% \fi} - -\newcommand{\@@Unitthstringportuges}[1]{% +% \end{macrocode} +% As above, but with initial letter in upper case. Units: +% \begin{macrocode} +\newcommand*{\@@Unitthstringportuges}[1]{% \ifcase#1\relax Zero% \or Primeiro% @@ -2102,8 +2636,10 @@ Zero% \or Nono% \fi } - -\newcommand{\@@Tenthstringportuges}[1]{% +% \end{macrocode} +% Tens: +% \begin{macrocode} +\newcommand*{\@@Tenthstringportuges}[1]{% \ifcase#1\relax \or D\'ecimo% \or Vig\'esimo% @@ -2116,8 +2652,10 @@ Zero% \or Nonag\'esimo% \fi } - -\newcommand{\@@Hundredthstringportuges}[1]{% +% \end{macrocode} +% Hundreds: +% \begin{macrocode} +\newcommand*{\@@Hundredthstringportuges}[1]{% \ifcase#1\relax \or Cent\'esimo% \or Ducent\'esimo% @@ -2129,8 +2667,10 @@ Zero% \or Octingent\'esimo% \or Nongent\'esimo% \fi} - -\newcommand{\@@UnitthstringFportuges}[1]{% +% \end{macrocode} +% As above, but feminine. Units: +% \begin{macrocode} +\newcommand*{\@@UnitthstringFportuges}[1]{% \ifcase#1\relax Zera% \or Primeira% @@ -2144,8 +2684,10 @@ Zera% \or Nona% \fi } - -\newcommand{\@@TenthstringFportuges}[1]{% +% \end{macrocode} +% Tens (feminine); +% \begin{macrocode} +\newcommand*{\@@TenthstringFportuges}[1]{% \ifcase#1\relax \or D\'ecima% \or Vig\'esima% @@ -2158,8 +2700,10 @@ Zera% \or Nonag\'esima% \fi } - -\newcommand{\@@HundredthstringFportuges}[1]{% +% \end{macrocode} +% Hundreds (feminine): +% \begin{macrocode} +\newcommand*{\@@HundredthstringFportuges}[1]{% \ifcase#1\relax \or Cent\'esima% \or Ducent\'esima% @@ -2172,8 +2716,13 @@ Zera% \or Nongent\'esima% \fi} % \end{macrocode} +% This has changed in version 1.09, so that it now stores +% the result in the second argument (a control sequence), but it +% doesn't display anything. Since it only affects internal macros, +% it shouldn't affect documents created with older versions. +% (These internal macros are not meant for use in documents.) % \begin{macrocode} -\newcommand{\@@numberstringportuges}[1]{% +\newcommand*{\@@numberstringportuges}[2]{% \ifnum#1>99999 \PackageError{fmtcount}{Out of range}% {This macro only works for values less than 100000}% @@ -2185,66 +2734,106 @@ you can try typing "minus" first, and then pass the modulus of this number}% \fi \fi +\def#2{}% \@strctr=#1\relax \divide\@strctr by 1000\relax \ifnum\@strctr>9 % #1 is greater or equal to 10000 \divide\@strctr by 10 - \ifnum\@strctr>1 - \@tenstring{\@strctr}% + \ifnum\@strctr>1\relax + \let\@@fc@numstr#2\relax + \edef#2{\@@fc@numstr\@tenstring{\@strctr}}% \@strctr=#1 \divide\@strctr by 1000\relax \@modulo{\@strctr}{10}% \ifnum\@strctr>0 - \ifnum\@strctr=1\ \@andname\fi - \ \@unitstring{\@strctr}% + \ifnum\@strctr=1\relax + \let\@@fc@numstr#2\relax + \edef#2{\@@fc@numstr\ \@andname}% + \fi + \let\@@fc@numstr#2\relax + \edef#2{\@@fc@numstr\ \@unitstring{\@strctr}}% \fi \else \@strctr=#1\relax \divide\@strctr by 1000\relax \@modulo{\@strctr}{10}% - \@teenstring{\@strctr}% + \let\@@fc@numstr#2\relax + \edef#2{\@@fc@numstr\@teenstring{\@strctr}}% \fi - \ \@thousand% + \let\@@fc@numstr#2\relax + \edef#2{\@@fc@numstr\ \@thousand}% \else - \ifnum\@strctr>0 - \ifnum\@strctr>1\@unitstring{\@strctr}\ \fi - \@thousand + \ifnum\@strctr>0\relax + \ifnum\@strctr>1\relax + \let\@@fc@numstr#2\relax + \edef#2{\@@fc@numstr\@unitstring{\@strctr}\ }% + \fi + \let\@@fc@numstr#2\relax + \edef#2{\@@fc@numstr\@thousand}% \fi \fi \@strctr=#1\relax \@modulo{\@strctr}{1000}% -\divide\@strctr by 100 -\ifnum\@strctr>0 -\ifnum#1>1000 \ \fi -\@tmpstrctr=#1\relax -\@modulo{\@tmpstrctr}{1000}% -\ifnum\@tmpstrctr=100\@tenstring{10}\else\@hundredstring{\@strctr}\fi% +\divide\@strctr by 100\relax +\ifnum\@strctr>0\relax + \ifnum#1>1000 \relax + \let\@@fc@numstr#2\relax + \edef#2{\@@fc@numstr\ }% + \fi + \@tmpstrctr=#1\relax + \@modulo{\@tmpstrctr}{1000}% + \let\@@fc@numstr#2\relax + \ifnum\@tmpstrctr=100\relax + \edef#2{\@@fc@numstr\@tenstring{10}}% + \else + \edef#2{\@@fc@numstr\@hundredstring{\@strctr}}% + \fi% \fi \@strctr=#1\relax \@modulo{\@strctr}{100}% -\ifnum#1>100 \ifnum\@strctr>0\ \@andname\ \fi\fi -\ifnum\@strctr>19 -\divide\@strctr by 10 -\@tenstring{\@strctr}% -\@strctr=#1\relax \@modulo{\@strctr}{10}% -\ifnum\@strctr>0 -\ifnum\@strctr=1\ \@andname\else\ifnum#1>100\ \@andname\fi\fi -\ \@unitstring{\@strctr}% +\ifnum#1>100\relax + \ifnum\@strctr>0\relax + \let\@@fc@numstr#2\relax + \edef#2{\@@fc@numstr\ \@andname\ }% + \fi \fi +\ifnum\@strctr>19\relax + \divide\@strctr by 10\relax + \let\@@fc@numstr#2\relax + \edef#2{\@@fc@numstr\@tenstring{\@strctr}}% + \@strctr=#1\relax \@modulo{\@strctr}{10}% + \ifnum\@strctr>0 + \ifnum\@strctr=1\relax + \let\@@fc@numstr#2\relax + \edef#2{\@@fc@numstr\ \@andname}% + \else + \ifnum#1>100\relax + \let\@@fc@numstr#2\relax + \edef#2{\@@fc@numstr\ \@andname}% + \fi + \fi + \let\@@fc@numstr#2\relax + \edef#2{\@@fc@numstr\ \@unitstring{\@strctr}}% + \fi \else -\ifnum\@strctr<10 -\ifnum\@strctr=0 -\ifnum#1<100 \@unitstring{\@strctr}\fi -\else%(>0,<10) -\@unitstring{\@strctr}% -\fi -\else%>10 -\@modulo{\@strctr}{10}% -\@teenstring{\@strctr}% -\fi + \ifnum\@strctr<10\relax + \ifnum\@strctr=0\relax + \ifnum#1<100\relax + \let\@@fc@numstr#2\relax + \edef#2{\@@fc@numstr\@unitstring{\@strctr}}% + \fi + \else%(>0,<10) + \let\@@fc@numstr#2\relax + \edef#2{\@@fc@numstr\@unitstring{\@strctr}}% + \fi + \else%>10 + \@modulo{\@strctr}{10}% + \let\@@fc@numstr#2\relax + \edef#2{\@@fc@numstr\@teenstring{\@strctr}}% + \fi \fi } - % \end{macrocode} +% As above, but for ordinals. % \begin{macrocode} -\newcommand{\@@ordinalstringportuges}[1]{% +\newcommand*{\@@ordinalstringportuges}[2]{% \@strctr=#1\relax \ifnum#1>99999 \PackageError{fmtcount}{Out of range}% @@ -2256,6 +2845,7 @@ this number}% you can try typing "minus" first, and then pass the modulus of this number}% \else +\def#2{}% \ifnum\@strctr>999\relax \divide\@strctr by 1000\relax \ifnum\@strctr>1\relax @@ -2263,43 +2853,67 @@ this number}% \@tmpstrctr=\@strctr \ifnum\@strctr<20 \@modulo{\@tmpstrctr}{10}% - \@teenthstring{\@tmpstrctr} + \let\@@fc@ordstr#2\relax + \edef#2{\@@fc@ordstr\@teenthstring{\@tmpstrctr}}% \else \divide\@tmpstrctr by 10\relax - \@tenthstring{\@tmpstrctr} + \let\@@fc@ordstr#2\relax + \edef#2{\@@fc@ordstr\@tenthstring{\@tmpstrctr}}% \@tmpstrctr=\@strctr \@modulo{\@tmpstrctr}{10}% - \ifnum\@tmpstrctr>0\@unitthstring{\@tmpstrctr} \fi + \ifnum\@tmpstrctr>0\relax + \let\@@fc@ordstr#2\relax + \edef#2{\@@fc@ordstr\@unitthstring{\@tmpstrctr}}% + \fi \fi \else - \@unitstring{\@strctr} + \let\@@fc@ordstr#2\relax + \edef#2{\@@fc@ordstr\@unitstring{\@strctr}}% \fi \fi - \@thousandth + \let\@@fc@ordstr#2\relax + \edef#2{\@@fc@ordstr\@thousandth}% \fi \@strctr=#1\relax \@modulo{\@strctr}{1000}% \ifnum\@strctr>99\relax -\@tmpstrctr=\@strctr -\divide\@tmpstrctr by 100\relax -\ifnum#1>1000-\fi -\@hundredthstring{\@tmpstrctr}% + \@tmpstrctr=\@strctr + \divide\@tmpstrctr by 100\relax + \ifnum#1>1000\relax + \let\@@fc@ordstr#2\relax + \edef#2{\@@fc@ordstr-}% + \fi + \let\@@fc@ordstr#2\relax + \edef#2{\@@fc@ordstr\@hundredthstring{\@tmpstrctr}}% \fi \@modulo{\@strctr}{100}% -\ifnum#1>99\ifnum\@strctr>0-\fi\fi +\ifnum#1>99\relax + \ifnum\@strctr>0\relax + \let\@@fc@ordstr#2\relax + \edef#2{\@@fc@ordstr-}% + \fi +\fi \ifnum\@strctr>9\relax -\@tmpstrctr=\@strctr -\divide\@tmpstrctr by 10\relax -\@tenthstring{\@tmpstrctr}% -\@tmpstrctr=\@strctr -\@modulo{\@tmpstrctr}{10}% -\ifnum\@tmpstrctr>0-\@unitthstring{\@tmpstrctr}\fi -\else -\ifnum\@strctr=0\relax -\ifnum#1=0\@unitstring{0}\fi + \@tmpstrctr=\@strctr + \divide\@tmpstrctr by 10\relax + \let\@@fc@ordstr#2\relax + \edef#2{\@@fc@ordstr\@tenthstring{\@tmpstrctr}}% + \@tmpstrctr=\@strctr + \@modulo{\@tmpstrctr}{10}% + \ifnum\@tmpstrctr>0\relax + \let\@@fc@ordstr#2\relax + \edef#2{\@@fc@ordstr-\@unitthstring{\@tmpstrctr}}% + \fi \else -\@unitthstring{\@strctr}% -\fi + \ifnum\@strctr=0\relax + \ifnum#1=0\relax + \let\@@fc@ordstr#2\relax + \edef#2{\@@fc@ordstr\@unitstring{0}}% + \fi + \else + \let\@@fc@ordstr#2\relax + \edef#2{\@@fc@ordstr\@unitthstring{\@strctr}}% + \fi \fi \fi \fi @@ -2315,10 +2929,27 @@ this number}% %<*fc-spanish.def> % \end{macrocode} %\fi -% Spanish +% \subsection{fc-spanish.def} +% Spanish definitions % \begin{macrocode} -\ProvidesFile{fc-spanish.def}[2005/04/29] +\ProvidesFile{fc-spanish.def}[2007/04/20] % \end{macrocode} +% Define macro that converts a number or count register (first +% argument) to an ordinal, and stores the result in the +% second argument, which must be a control sequence. +% Masculine: +% \begin{macrocode} +\newcommand{\@ordinalMspanish}[2]{% +\edef#2{\number#1\relax\noexpand\fmtord{o}}} +% \end{macrocode} +% Feminine: +% \begin{macrocode} +\newcommand{\@ordinalFspanish}[2]{% +\edef#2{\number#1\relax\noexpand\fmtord{a}}} +% \end{macrocode} +% Convert a number to text. The easiest way to do this is to +% break it up into units, tens, teens, twenties and hundreds. +% Units (argument must be a number from 0 to 9): % \begin{macrocode} \newcommand{\@@unitstringspanish}[1]{% \ifcase#1\relax @@ -2334,7 +2965,9 @@ cero% \or nueve% \fi } - +% \end{macrocode} +% Feminine: +% \begin{macrocode} \newcommand{\@@unitstringFspanish}[1]{% \ifcase#1\relax cera% @@ -2349,7 +2982,9 @@ cera% \or nueve% \fi } - +% \end{macrocode} +% Tens (argument must go from 1 to 10): +% \begin{macrocode} \newcommand{\@@tenstringspanish}[1]{% \ifcase#1\relax \or diez% @@ -2364,7 +2999,9 @@ cera% \or cien% \fi } - +% \end{macrocode} +% Teens: +% \begin{macrocode} \newcommand{\@@teenstringspanish}[1]{% \ifcase#1\relax diez% @@ -2379,7 +3016,9 @@ diez% \or diecinueve% \fi } - +% \end{macrocode} +% Twenties: +% \begin{macrocode} \newcommand{\@@twentystringspanish}[1]{% \ifcase#1\relax veinte% @@ -2393,7 +3032,9 @@ veinte% \or veintiocho% \or veintinueve% \fi} - +% \end{macrocode} +% Feminine form: +% \begin{macrocode} \newcommand{\@@twentystringFspanish}[1]{% \ifcase#1\relax veinte% @@ -2407,7 +3048,9 @@ veinte% \or veintiocho% \or veintinueve% \fi} - +% \end{macrocode} +% Hundreds: +% \begin{macrocode} \newcommand{\@@hundredstringspanish}[1]{% \ifcase#1\relax \or ciento% @@ -2420,7 +3063,9 @@ veinte% \or ochocientos% \or novecientos% \fi} - +% \end{macrocode} +% Feminine form: +% \begin{macrocode} \newcommand{\@@hundredstringFspanish}[1]{% \ifcase#1\relax \or cienta% @@ -2433,7 +3078,9 @@ veinte% \or ochocientas% \or novecientas% \fi} - +% \end{macrocode} +% As above, but with initial letter uppercase: +% \begin{macrocode} \newcommand{\@@Unitstringspanish}[1]{% \ifcase#1\relax Cero% @@ -2448,7 +3095,9 @@ Cero% \or Nueve% \fi } - +% \end{macrocode} +% Feminine form: +% \begin{macrocode} \newcommand{\@@UnitstringFspanish}[1]{% \ifcase#1\relax Cera% @@ -2463,7 +3112,9 @@ Cera% \or Nueve% \fi } - +% \end{macrocode} +% Tens: +% \begin{macrocode} \newcommand{\@@Tenstringspanish}[1]{% \ifcase#1\relax \or Diez% @@ -2478,7 +3129,9 @@ Cera% \or Cien% \fi } - +% \end{macrocode} +% Teens: +% \begin{macrocode} \newcommand{\@@Teenstringspanish}[1]{% \ifcase#1\relax Diez% @@ -2493,7 +3146,9 @@ Diez% \or Diecinueve% \fi } - +% \end{macrocode} +% Twenties: +% \begin{macrocode} \newcommand{\@@Twentystringspanish}[1]{% \ifcase#1\relax Veinte% @@ -2507,7 +3162,9 @@ Veinte% \or Veintiocho% \or Veintinueve% \fi} - +% \end{macrocode} +% Feminine form: +% \begin{macrocode} \newcommand{\@@TwentystringFspanish}[1]{% \ifcase#1\relax Veinte% @@ -2521,7 +3178,9 @@ Veinte% \or Veintiocho% \or Veintinueve% \fi} - +% \end{macrocode} +% Hundreds: +% \begin{macrocode} \newcommand{\@@Hundredstringspanish}[1]{% \ifcase#1\relax \or Ciento% @@ -2534,7 +3193,9 @@ Veinte% \or Ochocientos% \or Novecientos% \fi} - +% \end{macrocode} +% Feminine form: +% \begin{macrocode} \newcommand{\@@HundredstringFspanish}[1]{% \ifcase#1\relax \or Cienta% @@ -2547,8 +3208,14 @@ Veinte% \or Ochocientas% \or Novecientas% \fi} - -\newcommand{\@numberstringMspanish}[1]{% +% \end{macrocode} +% This has changed in version 1.09, so that it now stores the +% result in the second argument, but doesn't display anything. +% Since it only affects internal macros, it shouldn't affect +% documents created with older versions. (These internal macros +% are not meant for use in documents.) +% \begin{macrocode} +\DeclareRobustCommand{\@numberstringMspanish}[2]{% \let\@unitstring=\@@unitstringspanish \let\@teenstring=\@@teenstringspanish \let\@tenstring=\@@tenstringspanish @@ -2556,9 +3223,11 @@ Veinte% \let\@hundredstring=\@@hundredstringspanish \def\@hundred{cien}\def\@thousand{mil}% \def\@andname{y}% -\@@numberstringspanish{#1}} - -\newcommand{\@numberstringFspanish}[1]{% +\@@numberstringspanish{#1}{#2}} +% \end{macrocode} +% Feminine form: +% \begin{macrocode} +\DeclareRobustCommand{\@numberstringFspanish}[2]{% \let\@unitstring=\@@unitstringFspanish \let\@teenstring=\@@teenstringspanish \let\@tenstring=\@@tenstringspanish @@ -2566,9 +3235,11 @@ Veinte% \let\@hundredstring=\@@hundredstringFspanish \def\@hundred{cien}\def\@thousand{mil}% \def\@andname{y}% -\@@numberstringspanish{#1}} - -\newcommand{\@NumberstringMspanish}[1]{% +\@@numberstringspanish{#1}{#2}} +% \end{macrocode} +% As above, but initial letters in upper case: +% \begin{macrocode} +\DeclareRobustCommand{\@NumberstringMspanish}[2]{% \let\@unitstring=\@@Unitstringspanish \let\@teenstring=\@@Teenstringspanish \let\@tenstring=\@@Tenstringspanish @@ -2576,9 +3247,11 @@ Veinte% \let\@hundredstring=\@@Hundredstringspanish \def\@andname{y}% \def\@hundred{Cien}\def\@thousand{Mil}% -\@@numberstringspanish{#1}} - -\newcommand{\@NumberstringFspanish}[1]{% +\@@numberstringspanish{#1}{#2}} +% \end{macrocode} +% Feminine form: +% \begin{macrocode} +\DeclareRobustCommand{\@NumberstringFspanish}[2]{% \let\@unitstring=\@@UnitstringFspanish \let\@teenstring=\@@Teenstringspanish \let\@tenstring=\@@Tenstringspanish @@ -2586,47 +3259,56 @@ Veinte% \let\@hundredstring=\@@HundredstringFspanish \def\@andname{y}% \def\@hundred{Cien}\def\@thousand{Mil}% -\@@numberstringspanish{#1}} - -\newcommand{\@ordinalstringMspanish}[1]{% +\@@numberstringspanish{#1}{#2}} +% \end{macrocode} +% As above, but for ordinals. +% \begin{macrocode} +\DeclareRobustCommand{\@ordinalstringMspanish}[2]{% \let\@unitthstring=\@@unitthstringspanish \let\@unitstring=\@@unitstringspanish \let\@teenthstring=\@@teenthstringspanish \let\@tenthstring=\@@tenthstringspanish \let\@hundredthstring=\@@hundredthstringspanish \def\@thousandth{mil\'esimo}% -\@@ordinalstringspanish{#1}} - -\newcommand{\@ordinalstringFspanish}[1]{% +\@@ordinalstringspanish{#1}{#2}} +% \end{macrocode} +% Feminine form: +% \begin{macrocode} +\DeclareRobustCommand{\@ordinalstringFspanish}[2]{% \let\@unitthstring=\@@unitthstringFspanish \let\@unitstring=\@@unitstringFspanish \let\@teenthstring=\@@teenthstringFspanish \let\@tenthstring=\@@tenthstringFspanish \let\@hundredthstring=\@@hundredthstringFspanish \def\@thousandth{mil\'esima}% -\@@ordinalstringspanish{#1}} - -\newcommand{\@OrdinalstringMspanish}[1]{% +\@@ordinalstringspanish{#1}{#2}} +% \end{macrocode} +% As above, but with initial letters in upper case. +% \begin{macrocode} +\DeclareRobustCommand{\@OrdinalstringMspanish}[2]{% \let\@unitthstring=\@@Unitthstringspanish \let\@unitstring=\@@Unitstringspanish \let\@teenthstring=\@@Teenthstringspanish \let\@tenthstring=\@@Tenthstringspanish \let\@hundredthstring=\@@Hundredthstringspanish \def\@thousandth{Mil\'esimo}% -\@@ordinalstringspanish{#1}} - -\newcommand{\@OrdinalstringFspanish}[1]{% +\@@ordinalstringspanish{#1}{#2}} +% \end{macrocode} +% Feminine form: +% \begin{macrocode} +\DeclareRobustCommand{\@OrdinalstringFspanish}[2]{% \let\@unitthstring=\@@UnitthstringFspanish \let\@unitstring=\@@UnitstringFspanish \let\@teenthstring=\@@TeenthstringFspanish \let\@tenthstring=\@@TenthstringFspanish \let\@hundredthstring=\@@HundredthstringFspanish \def\@thousandth{Mil\'esima}% -\@@ordinalstringspanish{#1}} - -\newcommand{\@ordinalMspanish}[1]{#1\fmtord{o}} -\newcommand{\@ordinalFspanish}[1]{#1\fmtord{a}} - +\@@ordinalstringspanish{#1}{#2}} +% \end{macrocode} +% Code for convert numbers into textual ordinals. As before, +% it is easier to split it into units, tens, teens and hundreds. +% Units: +% \begin{macrocode} \newcommand{\@@unitthstringspanish}[1]{% \ifcase#1\relax cero% @@ -2641,7 +3323,9 @@ cero% \or noveno% \fi } - +% \end{macrocode} +% Tens: +% \begin{macrocode} \newcommand{\@@tenthstringspanish}[1]{% \ifcase#1\relax \or d\'ecimo% @@ -2655,7 +3339,9 @@ cero% \or nonag\'esimo% \fi } - +% \end{macrocode} +% Teens: +% \begin{macrocode} \newcommand{\@@teenthstringspanish}[1]{% \ifcase#1\relax d\'ecimo% @@ -2670,7 +3356,9 @@ d\'ecimo% \or decimonoveno% \fi } - +% \end{macrocode} +% Hundreds: +% \begin{macrocode} \newcommand{\@@hundredthstringspanish}[1]{% \ifcase#1\relax \or cent\'esimo% @@ -2683,7 +3371,9 @@ d\'ecimo% \or octingent\'esimo% \or noningent\'esimo% \fi} - +% \end{macrocode} +% Units (feminine): +% \begin{macrocode} \newcommand{\@@unitthstringFspanish}[1]{% \ifcase#1\relax cera% @@ -2698,7 +3388,9 @@ cera% \or novena% \fi } - +% \end{macrocode} +% Tens (feminine): +% \begin{macrocode} \newcommand{\@@tenthstringFspanish}[1]{% \ifcase#1\relax \or d\'ecima% @@ -2712,7 +3404,9 @@ cera% \or nonag\'esima% \fi } - +% \end{macrocode} +% Teens (feminine) +% \begin{macrocode} \newcommand{\@@teenthstringFspanish}[1]{% \ifcase#1\relax d\'ecima% @@ -2727,7 +3421,9 @@ d\'ecima% \or decimonovena% \fi } - +% \end{macrocode} +% Hundreds (feminine) +% \begin{macrocode} \newcommand{\@@hundredthstringFspanish}[1]{% \ifcase#1\relax \or cent\'esima% @@ -2740,7 +3436,9 @@ d\'ecima% \or octingent\'esima% \or noningent\'esima% \fi} - +% \end{macrocode} +% As above, but with initial letters in upper case +% \begin{macrocode} \newcommand{\@@Unitthstringspanish}[1]{% \ifcase#1\relax Cero% @@ -2755,7 +3453,9 @@ Cero% \or Noveno% \fi } - +% \end{macrocode} +% Tens: +% \begin{macrocode} \newcommand{\@@Tenthstringspanish}[1]{% \ifcase#1\relax \or D\'ecimo% @@ -2769,7 +3469,9 @@ Cero% \or Nonag\'esimo% \fi } - +% \end{macrocode} +% Teens: +% \begin{macrocode} \newcommand{\@@Teenthstringspanish}[1]{% \ifcase#1\relax D\'ecimo% @@ -2784,7 +3486,9 @@ D\'ecimo% \or Decimonoveno% \fi } - +% \end{macrocode} +% Hundreds +% \begin{macrocode} \newcommand{\@@Hundredthstringspanish}[1]{% \ifcase#1\relax \or Cent\'esimo% @@ -2797,7 +3501,9 @@ D\'ecimo% \or Octingent\'esimo% \or Noningent\'esimo% \fi} - +% \end{macrocode} +% As above, but feminine. +% \begin{macrocode} \newcommand{\@@UnitthstringFspanish}[1]{% \ifcase#1\relax Cera% @@ -2812,7 +3518,9 @@ Cera% \or Novena% \fi } - +% \end{macrocode} +% Tens (feminine) +% \begin{macrocode} \newcommand{\@@TenthstringFspanish}[1]{% \ifcase#1\relax \or D\'ecima% @@ -2826,7 +3534,9 @@ Cera% \or Nonag\'esima% \fi } - +% \end{macrocode} +% Teens (feminine): +% \begin{macrocode} \newcommand{\@@TeenthstringFspanish}[1]{% \ifcase#1\relax D\'ecima% @@ -2841,7 +3551,9 @@ D\'ecima% \or Decimonovena% \fi } - +% \end{macrocode} +% Hundreds (feminine): +% \begin{macrocode} \newcommand{\@@HundredthstringFspanish}[1]{% \ifcase#1\relax \or Cent\'esima% @@ -2856,8 +3568,14 @@ D\'ecima% \fi} % \end{macrocode} +% This has changed in version 1.09, so that it now stores the +% results in the second argument (which must be a control +% sequence), but it doesn't display anything. Since it only +% affects internal macros, it shouldn't affect documnets created +% with older versions. (These internal macros are not meant for +% use in documents.) % \begin{macrocode} -\newcommand{\@@numberstringspanish}[1]{% +\newcommand{\@@numberstringspanish}[2]{% \ifnum#1>99999 \PackageError{fmtcount}{Out of range}% {This macro only works for values less than 100000}% @@ -2869,67 +3587,100 @@ you can try typing "minus" first, and then pass the modulus of this number}% \fi \fi +\def#2{}% \@strctr=#1\relax \divide\@strctr by 1000\relax \ifnum\@strctr>9 % #1 is greater or equal to 10000 \divide\@strctr by 10 \ifnum\@strctr>1 - \@tenstring{\@strctr}% + \let\@@fc@numstr#2\relax + \edef#2{\@@fc@numstr\@tenstring{\@strctr}}% \@strctr=#1 \divide\@strctr by 1000\relax \@modulo{\@strctr}{10}% - \ifnum\@strctr>0\ \@andname\ \@unitstring{\@strctr}\fi + \ifnum\@strctr>0\relax + \let\@@fc@numstr#2\relax + \edef#2{\@@fc@numstr\ \@andname\ \@unitstring{\@strctr}}% + \fi \else \@strctr=#1\relax \divide\@strctr by 1000\relax \@modulo{\@strctr}{10}% - \@teenstring{\@strctr}% + \let\@@fc@numstr#2\relax + \edef#2{\@@fc@numstr\@teenstring{\@strctr}}% \fi - \ \@thousand% + \let\@@fc@numstr#2\relax + \edef#2{\@@fc@numstr\ \@thousand}% \else - \ifnum\@strctr>0 - \ifnum\@strctr>1\@unitstring{\@strctr}\ \fi - \@thousand + \ifnum\@strctr>0\relax + \ifnum\@strctr>1\relax + \let\@@fc@numstr#2\relax + \edef#2{\@@fc@numstr\@unitstring{\@strctr}\ }% + \fi + \let\@@fc@numstr#2\relax + \edef#2{\@@fc@numstr\@thousand}% \fi \fi \@strctr=#1\relax \@modulo{\@strctr}{1000}% -\divide\@strctr by 100 -\ifnum\@strctr>0 -\ifnum#1>1000\ \fi -\@tmpstrctr=#1\relax -\@modulo{\@tmpstrctr}{1000}% -\ifnum\@tmpstrctr=100\@tenstring{10}\else\@hundredstring{\@strctr}\fi% +\divide\@strctr by 100\relax +\ifnum\@strctr>0\relax + \ifnum#1>1000\relax + \let\@@fc@numstr#2\relax + \edef#2{\@@fc@numstr\ }% + \fi + \@tmpstrctr=#1\relax + \@modulo{\@tmpstrctr}{1000}% + \ifnum\@tmpstrctr=100\relax + \let\@@fc@numstr#2\relax + \edef#2{\@@fc@numstr\@tenstring{10}}% + \else + \let\@@fc@numstr#2\relax + \edef#2{\@@fc@numstr\@hundredstring{\@strctr}}% + \fi \fi \@strctr=#1\relax \@modulo{\@strctr}{100}% -\ifnum#1>100 \ifnum\@strctr>0\ \@andname\ \fi\fi -\ifnum\@strctr>29 -\divide\@strctr by 10 -\@tenstring{\@strctr}% -\@strctr=#1\relax \@modulo{\@strctr}{10}% -\ifnum\@strctr>0 -\ \@andname\ \@unitstring{\@strctr}% -\fi -\else -\ifnum\@strctr<10 -\ifnum\@strctr=0 -\ifnum#1<100 \@unitstring{\@strctr}\fi -\else -\@unitstring{\@strctr}% +\ifnum#1>100\relax + \ifnum\@strctr>0\relax + \let\@@fc@numstr#2\relax + \edef#2{\@@fc@numstr\ \@andname\ }% + \fi \fi +\ifnum\@strctr>29\relax + \divide\@strctr by 10\relax + \let\@@fc@numstr#2\relax + \edef#2{\@@fc@numstr\@tenstring{\@strctr}}% + \@strctr=#1\relax \@modulo{\@strctr}{10}% + \ifnum\@strctr>0\relax + \let\@@fc@numstr#2\relax + \edef#2{\@@fc@numstr\ \@andname\ \@unitstring{\@strctr}}% + \fi \else -\ifnum\@strctr>19 -\@modulo{\@strctr}{10}% -\@twentystring{\@strctr}% -\else -\@modulo{\@strctr}{10}% -\@teenstring{\@strctr}% -\fi -\fi + \ifnum\@strctr<10\relax + \ifnum\@strctr=0\relax + \ifnum#1<100\relax + \let\@@fc@numstr#2\relax + \edef#2{\@@fc@numstr\@unitstring{\@strctr}}% + \fi + \else + \let\@@fc@numstr#2\relax + \edef#2{\@@fc@numstr\@unitstring{\@strctr}}% + \fi + \else + \ifnum\@strctr>19\relax + \@modulo{\@strctr}{10}% + \let\@@fc@numstr#2\relax + \edef#2{\@@fc@numstr\@twentystring{\@strctr}}% + \else + \@modulo{\@strctr}{10}% + \let\@@fc@numstr#2\relax + \edef#2{\@@fc@numstr\@teenstring{\@strctr}}% + \fi + \fi \fi } - % \end{macrocode} +% As above, but for ordinals % \begin{macrocode} -\newcommand{\@@ordinalstringspanish}[1]{% +\newcommand{\@@ordinalstringspanish}[2]{% \@strctr=#1\relax \ifnum#1>99999 \PackageError{fmtcount}{Out of range}% @@ -2941,6 +3692,7 @@ this number}% you can try typing "minus" first, and then pass the modulus of this number}% \else +\def#2{}% \ifnum\@strctr>999\relax \divide\@strctr by 1000\relax \ifnum\@strctr>1\relax @@ -2948,48 +3700,73 @@ this number}% \@tmpstrctr=\@strctr \ifnum\@strctr<20 \@modulo{\@tmpstrctr}{10}% - \@teenthstring{\@tmpstrctr} + \let\@@fc@ordstr#2\relax + \edef#2{\@@fc@ordstr\@teenthstring{\@tmpstrctr}}% \else \divide\@tmpstrctr by 10\relax - \@tenthstring{\@tmpstrctr} + \let\@@fc@ordstr#2\relax + \edef#2{\@@fc@ordstr\@tenthstring{\@tmpstrctr}}% \@tmpstrctr=\@strctr \@modulo{\@tmpstrctr}{10}% - \ifnum\@tmpstrctr>0\@unitthstring{\@tmpstrctr} \fi + \ifnum\@tmpstrctr>0\relax + \let\@@fc@ordstr#2\relax + \edef#2{\@@fc@ordstr\@unitthstring{\@tmpstrctr}}% + \fi \fi \else - \@unitstring{\@strctr} + \let\@@fc@ordstr#2\relax + \edef#2{\@@fc@ordstr\@unitstring{\@strctr}}% \fi \fi - \@thousandth + \let\@@fc@ordstr#2\relax + \edef#2{\@@fc@ordstr\@thousandth}% \fi \@strctr=#1\relax \@modulo{\@strctr}{1000}% \ifnum\@strctr>99\relax -\@tmpstrctr=\@strctr -\divide\@tmpstrctr by 100\relax -\ifnum#1>1000\ \fi -\@hundredthstring{\@tmpstrctr}% + \@tmpstrctr=\@strctr + \divide\@tmpstrctr by 100\relax + \ifnum#1>1000\relax + \let\@@fc@ordstr#2\relax + \edef#2{\@@fc@ordstr\ }% + \fi + \let\@@fc@ordstr#2\relax + \edef#2{\@@fc@ordstr\@hundredthstring{\@tmpstrctr}}% \fi \@modulo{\@strctr}{100}% -\ifnum#1>99\ifnum\@strctr>0\ \fi\fi +\ifnum#1>99\relax + \ifnum\@strctr>0\relax + \let\@@fc@ordstr#2\relax + \edef#2{\@@fc@ordstr\ }% + \fi +\fi \ifnum\@strctr>19\relax -\@tmpstrctr=\@strctr -\divide\@tmpstrctr by 10\relax -\@tenthstring{\@tmpstrctr}% -\@tmpstrctr=\@strctr -\@modulo{\@tmpstrctr}{10}% -\ifnum\@tmpstrctr>0\ \@unitthstring{\@tmpstrctr}\fi -\else -\ifnum\@strctr>9 -\@modulo{\@strctr}{10}% -\@teenthstring{\@strctr}% -\else -\ifnum\@strctr=0\relax -\ifnum#1=0\@unitstring{0}\fi + \@tmpstrctr=\@strctr + \divide\@tmpstrctr by 10\relax + \let\@@fc@ordstr#2\relax + \edef#2{\@@fc@ordstr\@tenthstring{\@tmpstrctr}}% + \@tmpstrctr=\@strctr + \@modulo{\@tmpstrctr}{10}% + \ifnum\@tmpstrctr>0\relax + \let\@@fc@ordstr#2\relax + \edef#2{\@@fc@ordstr\ \@unitthstring{\@tmpstrctr}}% + \fi \else -\@unitthstring{\@strctr}% -\fi -\fi + \ifnum\@strctr>9\relax + \@modulo{\@strctr}{10}% + \let\@@fc@ordstr#2\relax + \edef#2{\@@fc@ordstr\@teenthstring{\@strctr}}% + \else + \ifnum\@strctr=0\relax + \ifnum#1=0\relax + \let\@@fc@ordstr#2\relax + \edef#2{\@@fc@ordstr\@unitstring{0}}% + \fi + \else + \let\@@fc@ordstr#2\relax + \edef#2{\@@fc@ordstr\@unitthstring{\@strctr}}% + \fi + \fi \fi \fi \fi @@ -3009,7 +3786,7 @@ this number}% % This section deals with the code for |fmtcount.sty| % \begin{macrocode} \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{fmtcount}[2007/01/06 v1.06] +\ProvidesPackage{fmtcount}[2007/04/20 v1.09] \RequirePackage{ifthen} \RequirePackage{keyval} % \end{macrocode} @@ -3230,9 +4007,9 @@ or `user'}}} \@@hexadecimal\@DT@X} \let\hexadecimalnum=\@hexadecimal -% \begin{macrocode} -% Uppercase hexadecimal % \end{macrocode} +% Uppercase hexadecimal +% \begin{macrocode} \newcommand{\@@Hexadecimal}[1]{\ifcase#10\or1\or2\or3\or4\or5\or6\or 7\or8\or9\or A\or B\or C\or D\or E\or F\fi} @@ -3397,7 +4174,7 @@ or `user'}}} \expandafter\protect\expandafter\ordinalnum{% \expandafter\the\csname c@#1\endcsname}} % \end{macrocode} -% If \verb"\ordinal" isn't defined make "\ordinal" a synonym +% If \verb"\ordinal" isn't defined make \verb"\ordinal" a synonym % for \verb"\FCordinal" to maintain compatibility with previous % versions. % \begin{macrocode} @@ -3405,87 +4182,397 @@ or `user'}}} \PackageWarning{fmtcount}{\string\ordinal \space already defined use \string\FCordinal \space instead.}} % \end{macrocode} +% Display ordinal where value is given as a number or +% count register instead of a counter: % \begin{macrocode} \newcommand{\ordinalnum}[1]{\@ifnextchar[{\@ordinalnum{#1}}{% \@ordinalnum{#1}[m]}} - -\def\@ordinalnum#1[#2]{% +% \end{macrocode} +% Display ordinal according to gender: +% \begin{macrocode} +\def\@ordinalnum#1[#2]{{% \ifthenelse{\equal{#2}{f}}{% -\protect\@ordinalF{#1}}{% +\protect\@ordinalF{#1}{\@fc@ordstr}}{% \ifthenelse{\equal{#2}{m}}{}{% \PackageError{fmtcount}{Invalid gender option `#2'}{% Available options are m or f}}% -\protect\@ordinalM{#1}}} - +\protect\@ordinalM{#1}{\@fc@ordstr}}\@fc@ordstr}} +% \end{macrocode} +% 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} +% 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} +% Store ordinal according to gender: +% \begin{macrocode} +\def\@storeordinalnum#1#2[#3]{% +\ifthenelse{\equal{#3}{f}}{% +\protect\@ordinalF{#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} +% Get stored information: +% \begin{macrocode} +\newcommand*{\FMCuse}[1]{\csname @fcs@#1\endcsname} +% \end{macrocode} +% 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} +% Display ordinal as a string (argument is a count register or +% number.) +% \begin{macrocode} \newcommand{\ordinalstringnum}[1]{% \@ifnextchar[{\@ordinal@string{#1}}{\@ordinal@string{#1}[m]}} - -\def\@ordinal@string#1[#2]{% +% \end{macrocode} +% Display ordinal as a string according to gender. +% \begin{macrocode} +\def\@ordinal@string#1[#2]{{% \ifthenelse{\equal{#2}{f}}{% -\protect\@ordinalstringF{#1}}{% +\protect\@ordinalstringF{#1}{\@fc@ordstr}}{% \ifthenelse{\equal{#2}{m}}{}{% \PackageError{fmtcount}{Invalid gender option `#2' to \string\ordinalstring}{Available options are m or f}}% -\protect\@ordinalstringM{#1}}} - +\protect\@ordinalstringM{#1}{\@fc@ordstr}}\@fc@ordstr}} +% \end{macrocode} +% 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} +% 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} +% Store textual representation of number according to gender. +% \begin{macrocode} +\def\@store@ordinal@string#1#2[#3]{% +\ifthenelse{\equal{#3}{f}}{% +\protect\@ordinalstringF{#2}{\@fc@ordstr}}{% +\ifthenelse{\equal{#3}{m}}{}{% +\PackageError{fmtcount}{Invalid gender option `#3' to +\string\ordinalstring}{Available options are m or f}}% +\protect\@ordinalstringM{#2}{\@fc@ordstr}}% +\expandafter\let\csname @fcs@#1\endcsname\@fc@ordstr} +% \end{macrocode} +% 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} +% Display ordinal as a string with initial letters in upper case +% (argument is a number or count register) +% \begin{macrocode} \newcommand{\Ordinalstringnum}[1]{% \@ifnextchar[{\@Ordinal@string{#1}}{\@Ordinal@string{#1}[m]}} - -\def\@Ordinal@string#1[#2]{% +% \end{macrocode} +% 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}}{% +\protect\@OrdinalstringF{#1}{\@fc@ordstr}}{% \ifthenelse{\equal{#2}{m}}{}{% -\PackageError{fmtcount}{Invalid gender option `#2' to -\string\Ordinalstring}{Available options are m or f}}% -\protect\@OrdinalstringM{#1}}} - +\PackageError{fmtcount}{Invalid gender option `#2'}{% +Available options are m or f}}% +\protect\@OrdinalstringM{#1}{\@fc@ordstr}}\@fc@ordstr}} +% \end{macrocode} +% 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} +% 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} +% 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}{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} +% 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} +% 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} +% 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}{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} +% 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} +% As above, but the argument is a count register or a number. +% \begin{macrocode} +\newcommand{\ORDINALstringnum}[1]{% +\@ifnextchar[{\@ORDINAL@string{#1}}{\@ORDINAL@string{#1}[m]}} +% \end{macrocode} +% 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}{m}}{}{% +\PackageError{fmtcount}{Invalid gender option `#2'}{% +Available options are m or f}}% +\protect\@ordinalstringM{#1}{\@fc@ordstr}}% +\MakeUppercase{\@fc@ordstr}}} +% \end{macrocode} +% 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} +% 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} +% 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}{m}}{}{% +\PackageError{fmtcount}{Invalid gender option `#3'}{% +Available options are m or f}}% +\protect\@numberstringM{#2}{\@fc@numstr}}% +\expandafter\let\csname @fcs@#1\endcsname\@fc@numstr} +% \end{macrocode} +% 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} +% As above, but the argument is a count register or a number. +% \begin{macrocode} \newcommand{\numberstringnum}[1]{% \@ifnextchar[{\@number@string{#1}}{\@number@string{#1}[m]}} - -\def\@number@string#1[#2]{% +% \end{macrocode} +% 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}}{% +\protect\@numberstringF{#1}{\@fc@numstr}}{% \ifthenelse{\equal{#2}{m}}{}{% -\PackageError{fmtcount}{Invalid gender option `#2' to -\string\numberstring}{Available options are m or f}}% -\protect\@numberstringM{#1}}} - +\PackageError{fmtcount}{Invalid gender option `#2'}{% +Available options are m or f}}% +\protect\@numberstringM{#1}{\@fc@numstr}}\@fc@numstr}} +% \end{macrocode} +% 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} +% 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} +% 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}{m}}{}{% +\PackageError{fmtcount}{Invalid gender option `#3'}{% +Available options are m or f}}% +\protect\@NumberstringM{#2}{\@fc@numstr}}% +\expandafter\let\csname @fcs@#1\endcsname\@fc@numstr} +% \end{macrocode} +% 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} +% As above, but the argument is a count register or number. +% \begin{macrocode} \newcommand{\Numberstringnum}[1]{% \@ifnextchar[{\@Number@string{#1}}{\@Number@string{#1}[m]}} - -\def\@Number@string#1[#2]{% +% \end{macrocode} +% Gender is specified as an optional argument at the end. +% \begin{macrocode} +\def\@Number@string#1[#2]{{% \ifthenelse{\equal{#2}{f}}{% -\protect\@NumberstringF{#1}}{% +\protect\@NumberstringF{#1}{\@fc@numstr}}{% \ifthenelse{\equal{#2}{m}}{}{% -\PackageError{fmtcount}{Invalid gender option `#2' to -\string\Numberstring}{Available options are m or f}}% -\protect\@NumberstringM{#1}}} - -\providecommand{\binary}[1]{\expandafter\protect\expandafter\@binary{\expandafter\the\csname c@#1\endcsname}} -\providecommand{\aaalph}[1]{\expandafter\protect\expandafter\@aaalph{\expandafter\the\csname c@#1\endcsname}} -\providecommand{\AAAlph}[1]{\expandafter\protect\expandafter\@AAAlph{\expandafter\the\csname c@#1\endcsname}} -\providecommand{\abalph}[1]{\expandafter\protect\expandafter\@abalph{\expandafter\the\csname c@#1\endcsname}} -\providecommand{\ABAlph}[1]{\expandafter\protect\expandafter\@ABAlph{\expandafter\the\csname c@#1\endcsname}} -\providecommand{\hexadecimal}[1]{\expandafter\protect\expandafter\@hexadecimal{\expandafter\the\csname c@#1\endcsname}} -\providecommand{\Hexadecimal}[1]{\expandafter\protect\expandafter\@Hexadecimal{\expandafter\the\csname c@#1\endcsname}} -\providecommand{\octal}[1]{\expandafter\protect\expandafter\@octal{\expandafter\the\csname c@#1\endcsname}} -\providecommand{\decimal}[1]{\expandafter\protect\expandafter\@decimal{\expandafter\the\csname c@#1\endcsname}} +\PackageError{fmtcount}{Invalid gender option `#2'}{% +Available options are m or f}}% +\protect\@NumberstringM{#1}{\@fc@numstr}}\@fc@numstr}} +% \end{macrocode} +% 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} +% 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} +% 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}{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} +% 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} +% As above, but the argument is a count register or a number. +% \begin{macrocode} +\newcommand{\NUMBERstringnum}[1]{% +\@ifnextchar[{\@NUMBER@string{#1}}{\@NUMBER@string{#1}[m]}} +% \end{macrocode} +% 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}{m}}{}{% +\PackageError{fmtcount}{Invalid gender option `#2'}{% +Available options are m or f}}% +\protect\@numberstringM{#1}{\@fc@numstr}}% +\MakeUppercase{\@fc@numstr}}} +% \end{macrocode} +% Number representations in other bases. Binary: +% \begin{macrocode} +\providecommand{\binary}[1]{% +\expandafter\protect\expandafter\@binary{% +\expandafter\the\csname c@#1\endcsname}} +% \end{macrocode} +% Like \verb"\alph", but goes beyond 26. (a \ldots\ z aa \ldots zz \ldots) +% \begin{macrocode} +\providecommand{\aaalph}[1]{% +\expandafter\protect\expandafter\@aaalph{% +\expandafter\the\csname c@#1\endcsname}} +% \end{macrocode} +% As before, but upper case. +% \begin{macrocode} +\providecommand{\AAAlph}[1]{% +\expandafter\protect\expandafter\@AAAlph{% +\expandafter\the\csname c@#1\endcsname}} +% \end{macrocode} +% Like \verb"\alph", but goes beyond 26. (a \ldots\ z ab \ldots az \ldots) +% \begin{macrocode} +\providecommand{\abalph}[1]{% +\expandafter\protect\expandafter\@abalph{% +\expandafter\the\csname c@#1\endcsname}} +% \end{macrocode} +% As above, but upper case. +% \begin{macrocode} +\providecommand{\ABAlph}[1]{% +\expandafter\protect\expandafter\@ABAlph{% +\expandafter\the\csname c@#1\endcsname}} +% \end{macrocode} +% Hexadecimal: +% \begin{macrocode} +\providecommand{\hexadecimal}[1]{% +\expandafter\protect\expandafter\@hexadecimal{% +\expandafter\the\csname c@#1\endcsname}} +% \end{macrocode} +% As above, but in upper case. +% \begin{macrocode} +\providecommand{\Hexadecimal}[1]{% +\expandafter\protect\expandafter\@Hexadecimal{% +\expandafter\the\csname c@#1\endcsname}} +% \end{macrocode} +% Octal: +% \begin{macrocode} +\providecommand{\octal}[1]{% +\expandafter\protect\expandafter\@octal{% +\expandafter\the\csname c@#1\endcsname}} +% \end{macrocode} +% Decimal: +% \begin{macrocode} +\providecommand{\decimal}[1]{% +\expandafter\protect\expandafter\@decimal{% +\expandafter\the\csname c@#1\endcsname}} % \end{macrocode} %\subsubsection{Multilinguage Definitions} % If multilingual support is provided, make \verb"\@numberstring" @@ -3493,7 +4580,7 @@ Available options are m or f}}% % Otherwise use English definitions. % \begin{macrocode} \def\@setdef@ultfmtcount{ -\@ifundefined{@ordinalenglish}{\input{fc-english.def}}{} +\@ifundefined{@ordinalMenglish}{\input{fc-english.def}}{} \def\@ordinalstringM{\@ordinalstringMenglish} \let\@ordinalstringF=\@ordinalstringMenglish \def\@OrdinalstringM{\@OrdinalstringMenglish} @@ -3590,8 +4677,8 @@ The fmtcount package currently does not support language % \begin{macrocode} # File : fmtcount.perl # Author : Nicola Talbot -# Date : 3 Mar 2005 -# Version : 1.02 +# Date : 21 April 2007 +# Version : 1.04 # Description : LaTeX2HTML implementation of fmtcount package package main; @@ -3761,6 +4848,58 @@ sub do_cmd_ordinal{ } } +sub do_cmd_storeordinal{ + local($_) = @_; + local($key); + + $key = &missing_braces + unless ((s/$next_pair_pr_rx//o)&&($key=$2)); + + local($ctr, $val, $id, $_) = &read_counter_value($_); + local($gender)='m'; + + $_ =~ s/${OP}$id${CP}$ctr${OP}$id${CP}//; + + if ($_ =~s/\s*\[(.)\]//) + { + $gender = $1; + } + + if ($ctr eq 'DAY' or $ctr eq 'MONTH' or $ctr eq 'YEAR') + { + # this is a cludge to make it work with newdateformat + $fmtcntvar{$key} = join('', '{ORDINAL{', $ctr, '}}'); + } + else + { + $fmtcntvar{$key} = &getordinal($val, $gender); + } + + $_; +} + +sub do_cmd_storeordinalnum{ + local($_) = @_; + local($key, $val); + + $key = &missing_braces + unless ((s/$next_pair_pr_rx//o)&&($key=$2)); + + $val = &missing_braces + unless ((s/$next_pair_pr_rx//o)&&($val=$2)); + + local($gender)='m'; + + if ($_ =~s/\s*\[(.)\]//) + { + $gender = $1; + } + + $fmtcntvar{$key} = &getordinal($val, $gender); + + $_; +} + @unitthstring = ('zeroth', 'first', 'second', @@ -4086,7 +5225,7 @@ $thousandthnamespanish = "mil\\'esimo"; @unitstringportuges = ('zero', 'um', 'dois', - 'tr\`es', + 'tr\^es', 'quatro', 'cinco', 'seis', @@ -4353,7 +5492,7 @@ sub get_numberstringportuges{ { $hundreds = $hundredstringportuges[$num/100]; - if ($gender eq 'f') + if ($gender eq 'f' and $num >= 200) { $hundreds =~s/o(s?)$/a\1/; } @@ -4451,6 +5590,58 @@ sub do_cmd_numberstring{ } } +sub do_cmd_storenumberstring{ + local($_) = @_; + local($key); + + $key = &missing_braces + unless ((s/$next_pair_pr_rx//o)&&($key=$2)); + + local($ctr, $val, $id, $_) = &read_counter_value($_); + local($gender)='m'; + + $_ =~ s/${OP}$id${CP}$ctr${OP}$id${CP}//; + + if ($_ =~s/\s*\[(.)\]//) + { + $gender = $1; + } + + if ($ctr eq 'DAY' or $ctr eq 'MONTH' or $ctr eq 'YEAR') + { + # this is a cludge to make it work with newdateformat + $fmtcntvar{$key} = join('', '{NUMBERSTRING{', $ctr, '}}'); + } + else + { + $fmtcntvar{$key} = join('', &get_numberstring($val, $gender)); + } + + $_; +} + +sub do_cmd_storenumberstringnum{ + local($_) = @_; + local($key, $val); + + $key = &missing_braces + unless ((s/$next_pair_pr_rx//o)&&($key=$2)); + + $val = &missing_braces + unless ((s/$next_pair_pr_rx//o)&&($val=$2)); + + local($gender)='m'; + + if ($_ =~s/\s*\[(.)\]//) + { + $gender = $1; + } + + $fmtcntvar{$key} = join('', &get_numberstring($val, $gender)); + + $_; +} + sub get_Numberstring{ local($val,$gender) = @_; local($string) = &get_numberstring($val,$gender); @@ -4516,6 +5707,150 @@ sub do_cmd_Numberstring{ } } +sub do_cmd_storeNumberstring{ + local($_) = @_; + local($key); + + $key = &missing_braces + unless ((s/$next_pair_pr_rx//o)&&($key=$2)); + + local($ctr, $val, $id, $_) = &read_counter_value($_); + local($gender)='m'; + + $_ =~ s/${OP}$id${CP}$ctr${OP}$id${CP}//; + + if ($_ =~s/\s*\[(.)\]//) + { + $gender = $1; + } + + if ($ctr eq 'DAY' or $ctr eq 'MONTH' or $ctr eq 'YEAR') + { + # this is a cludge to make it work with newdateformat + $fmtcntvar{$key} = join('', '{NNUMBERSTRING{', $ctr, '}}'); + } + else + { + $fmtcntvar{$key} = join('', &get_Numberstring($val, $gender)); + } + + $_; +} + +sub do_cmd_storeNumberstringnum{ + local($_) = @_; + local($key, $val); + + $key = &missing_braces + unless ((s/$next_pair_pr_rx//o)&&($key=$2)); + + $val = &missing_braces + unless ((s/$next_pair_pr_rx//o)&&($val=$2)); + + local($gender)='m'; + + if ($_ =~s/\s*\[(.)\]//) + { + $gender = $1; + } + + $fmtcntvar{$key} = join('', &get_Numberstring($val, $gender)); + + $_; +} + +sub do_cmd_NUMBERstringnum{ + local($_) = @_; + local($num,$gender); + $num = &missing_braces + unless (($_[0]=~s/$next_pair_pr_rx//o)&&($num=$2)); + + if ($_[0] =~ s/\[(m|f)\]//) + { + $gender = $1; + } + else + { + $gender = 'm'; + } + + join('', uc(&get_numberstring($num,$gender)), $_[0]); +} + +sub do_cmd_NUMBERstring{ + local($ctr, $val, $id, $_) = &read_counter_value($_[0]); + local($gender)='m'; + + $_[0] =~ s/${OP}$id${CP}$ctr${OP}$id${CP}//; + + if ($_[0]=~s/\[(.)\]//) + { + $gender = $1; + } + + if ($ctr eq 'DAY' or $ctr eq 'MONTH' or $ctr eq 'YEAR') + { + # this is a cludge to make it work with newdateformat + join('', '{CAPNUMBERSTRING{', $ctr, '}}', $_); + } + else + { + join('', uc(&get_numberstring($val, $gender)), $_); + } +} + +sub do_cmd_storeNUMBERstring{ + local($_) = @_; + local($key); + + $key = &missing_braces + unless ((s/$next_pair_pr_rx//o)&&($key=$2)); + + local($ctr, $val, $id, $_) = &read_counter_value($_); + local($gender)='m'; + + $_ =~ s/${OP}$id${CP}$ctr${OP}$id${CP}//; + + if ($_ =~s/\s*\[(.)\]//) + { + $gender = $1; + } + + if ($ctr eq 'DAY' or $ctr eq 'MONTH' or $ctr eq 'YEAR') + { + # this is a cludge to make it work with newdateformat + $fmtcntvar{$key} = join('', '{CAPNUMBERSTRING{', $ctr, '}}'); + } + else + { + $fmtcntvar{$key} = uc(&get_numberstring($val, $gender)); + } + + $_; +} + +sub do_cmd_storeNUMBERstringnum{ + local($_) = @_; + local($key, $val); + + $key = &missing_braces + unless ((s/$next_pair_pr_rx//o)&&($key=$2)); + + $val = &missing_braces + unless ((s/$next_pair_pr_rx//o)&&($val=$2)); + + local($gender)='m'; + + if ($_ =~s/\s*\[(.)\]//) + { + $gender = $1; + } + + $fmtcntvar{$key} = uc(&get_numberstring($val, $gender)); + + $_; +} + sub get_ordinalstringenglish{ local($num) = @_; local($name)=""; @@ -4952,18 +6287,82 @@ sub do_cmd_ordinalstring{ if ($ctr eq 'DAY' or $ctr eq 'MONTH' or $ctr eq 'YEAR') { # this is a cludge to make it work with newdateformat - join('', '{ORDINALSTRING{', $ctr, '}}', $_[0]); + join('', '{ORDINALSTRING{', $ctr, '}}', $_); } else { - join('', &get_ordinalstring($val, $gender), $_[0]); + join('', &get_ordinalstring($val, $gender), $_); } } + %fmtcntvar = (); + +sub do_cmd_FMCuse{ + local($_) = @_; + local($key); + + $key = &missing_braces + unless ((s/$next_pair_pr_rx//o)&&($key=$2)); + + $fmtcntvar{$key}.$_; +} + +sub do_cmd_storeordinalstring{ + local($_) = @_; + local($key); + + $key = &missing_braces + unless ((s/$next_pair_pr_rx//o)&&($key=$2)); + + local($ctr, $val, $id, $_) = &read_counter_value($_); + local($gender)='m'; + + $_ =~ s/${OP}$id${CP}$ctr${OP}$id${CP}//; + + if ($_ =~s/\s*\[(.)\]//) + { + $gender = $1; + } + + if ($ctr eq 'DAY' or $ctr eq 'MONTH' or $ctr eq 'YEAR') + { + # this is a cludge to make it work with newdateformat + $fmtcntvar{$key} = join('', '{ORDINALSTRING{', $ctr, '}}'); + } + else + { + $fmtcntvar{$key} = join('', &get_ordinalstring($val, $gender)); + } + + $_; +} + +sub do_cmd_storeordinalstringnum{ + local($_) = @_; + local($key, $val); + + $key = &missing_braces + unless ((s/$next_pair_pr_rx//o)&&($key=$2)); + + $val = &missing_braces + unless ((s/$next_pair_pr_rx//o)&&($val=$2)); + + local($gender)='m'; + + if ($_ =~s/\s*\[(.)\]//) + { + $gender = $1; + } + + $fmtcntvar{$key} = join('', &get_ordinalstring($val, $gender)); + + $_; +} + sub get_Ordinalstring{ local($val,$gender) = @_; local($string) = &get_ordinalstring($val,$gender); - $string =~ s/([a-z])([^\s\-]+)/\u\1\2/g; + $string =~ s/\b([a-z])([^\s\-]+)/\u\1\2/g; if ($default_language eq 'french') { @@ -5017,6 +6416,149 @@ sub do_cmd_Ordinalstring{ } } +sub do_cmd_storeOrdinalstring{ + local($_) = @_; + local($key); + + $key = &missing_braces + unless ((s/$next_pair_pr_rx//o)&&($key=$2)); + + local($ctr, $val, $id, $_) = &read_counter_value($_); + local($gender)='m'; + + $_ =~ s/${OP}$id${CP}$ctr${OP}$id${CP}//; + + if ($_ =~s/\s*\[(.)\]//) + { + $gender = $1; + } + + if ($ctr eq 'DAY' or $ctr eq 'MONTH' or $ctr eq 'YEAR') + { + # this is a cludge to make it work with newdateformat + $fmtcntvar{$key} = join('', '{OORDINALSTRING{', $ctr, '}}'); + } + else + { + $fmtcntvar{$key} = join('', &get_Ordinalstring($val, $gender)); + } + + $_; +} + +sub do_cmd_storeOrdinalstringnum{ + local($_) = @_; + local($key, $val); + + $key = &missing_braces + unless ((s/$next_pair_pr_rx//o)&&($key=$2)); + + $val = &missing_braces + unless ((s/$next_pair_pr_rx//o)&&($val=$2)); + + local($gender)='m'; + + if ($_ =~s/\s*\[(.)\]//) + { + $gender = $1; + } + + $fmtcntvar{$key} = join('', &get_Ordinalstring($val, $gender)); + + $_; +} + +sub do_cmd_ORDINALstringnum{ + local($_) = @_; + local($num,$gender); + $num = &missing_braces + unless (($_[0]=~s/$next_pair_pr_rx//o)&&($num=$2)); + + if ($_[0] =~ s/\[(m|f)\]//) + { + $gender = $1; + } + else + { + $gender = 'm'; + } + + join('', uc(&get_ordinalstring($num,$gender)), $_[0]); +} + +sub do_cmd_ORDINALstring{ + local($ctr, $val, $id, $_) = &read_counter_value($_[0]); + local($gender)='m'; + + $_[0] =~ s/${OP}$id${CP}$ctr${OP}$id${CP}//; + + if ($_[0]=~s/\[(.)\]//) + { + $gender = $1; + } + + if ($ctr eq 'DAY' or $ctr eq 'MONTH' or $ctr eq 'YEAR') + { + # this is a cludge to make it work with newdateformat + join('', '{CAPORDINALSTRING{', $ctr, '}}', $_); + } + else + { + join('', uc(&get_ordinalstring($val, $gender)), $_); + } +} + +sub do_cmd_storeORDINALstring{ + local($_) = @_; + local($key); + + $key = &missing_braces + unless ((s/$next_pair_pr_rx//o)&&($key=$2)); + + local($ctr, $val, $id, $_) = &read_counter_value($_); + local($gender)='m'; + + $_ =~ s/${OP}$id${CP}$ctr${OP}$id${CP}//; + + if ($_ =~s/\s*\[(.)\]//) + { + $gender = $1; + } + + if ($ctr eq 'DAY' or $ctr eq 'MONTH' or $ctr eq 'YEAR') + { + # this is a cludge to make it work with newdateformat + $fmtcntvar{$key} = join('', '{CAPORDINALSTRING{', $ctr, '}}'); + } + else + { + $fmtcntvar{$key} = uc(&get_ordinalstring($val, $gender)); + } + + $_; +} + +sub do_cmd_storeORDINALstringnum{ + local($_) = @_; + local($key, $val); + + $key = &missing_braces + unless ((s/$next_pair_pr_rx//o)&&($key=$2)); + + $val = &missing_braces + unless ((s/$next_pair_pr_rx//o)&&($val=$2)); + + local($gender)='m'; + + if ($_ =~s/\s*\[(.)\]//) + { + $gender = $1; + } + + $fmtcntvar{$key} = uc(&get_ordinalstring($val, $gender)); + + $_; +} sub do_cmd_fmtcountsetoptions{ local($_) = @_; @@ -5393,9 +6935,9 @@ sub load_fmtcount_cfg{ %<*fc-samp.tex> % \end{macrocode} %\fi +% \begin{macrocode} \documentclass[a4paper]{article} -%\usepackage[french]{babel} \usepackage{fmtcount} \newcounter{N} @@ -5488,9 +7030,11 @@ numberstring Referencing a label: \ref{ex}. Passing numbers explicitly: \ordinalnum{10}, -\Numberstringnum{10}, \Ordinalstringnum{10}. +\Numberstringnum{10}, \NUMBERstringnum{10}, \Ordinalstringnum{10}, +\ORDINALstringnum{10}. \end{document} +% \end{macrocode} %\iffalse % \begin{macrocode} %</fc-samp.tex> @@ -5501,6 +7045,7 @@ Passing numbers explicitly: \ordinalnum{10}, %<*fc-lang.tex> % \end{macrocode} %\fi +% \begin{macrocode} % This is an interactive script. Run it through \LaTeX % and enter appropriate responses. @@ -5613,8 +7158,10 @@ Current language: French (Belgium). \typeout{Which format?^^J} \typeout{[1] ordinalstring} \typeout{[2] Ordinalstring} -\typeout{[3] numberstring} -\typeout{[4] Numberstring} +\typeout{[3] ORDINALstring} +\typeout{[4] numberstring} +\typeout{[5] Numberstring} +\typeout{[6] NUMBERstring} \typein[\response]{Default: 1} @@ -5622,16 +7169,20 @@ Current language: French (Belgium). \ifthenelse{\equal{\response}{1}}{\myctr=1}{ \ifthenelse{\equal{\response}{2}}{\myctr=2}{ \ifthenelse{\equal{\response}{3}}{\myctr=3}{ -\ifthenelse{\equal{\response}{4}}{\myctr=4}{\myctr=-1 -\typeout{Invalid response '\response', please select a number from 1 to 4}}}}} +\ifthenelse{\equal{\response}{4}}{\myctr=4}{ +\ifthenelse{\equal{\response}{5}}{\myctr=5}{ +\ifthenelse{\equal{\response}{6}}{\myctr=6}{\myctr=-1 +\typeout{Invalid response '\response', please select a number from 1 to 4}}}}}}} \ifnum\myctr=-1 \repeat \ifcase\myctr \or\def\stringtype{ordinalstring} \or\def\stringtype{Ordinalstring} +\or\def\stringtype{ORDINALstring} \or\def\stringtype{numberstring} \or\def\stringtype{Numberstring} +\or\def\stringtype{NUMBERstring} \fi \ifnum\langid>3 @@ -5708,6 +7259,7 @@ Current language: French (Belgium). \end{ttfamily} \end{document} +% \end{macrocode} %\iffalse % \begin{macrocode} %</fc-lang.tex> diff --git a/Master/texmf-dist/source/latex/fmtcount/fmtcount.ins b/Master/texmf-dist/source/latex/fmtcount/fmtcount.ins index 736dd9f169f..6138342bbe6 100644 --- a/Master/texmf-dist/source/latex/fmtcount/fmtcount.ins +++ b/Master/texmf-dist/source/latex/fmtcount/fmtcount.ins @@ -1,4 +1,4 @@ -% fmtcount.ins generated using makedtx version 0.91b 2007/1/6 16:52 +% fmtcount.ins generated using makedtx version 0.91b 2007/4/21 19:25 \input docstrip \preamble diff --git a/Master/texmf-dist/tex/latex/fmtcount/fc-english.def b/Master/texmf-dist/tex/latex/fmtcount/fc-english.def index 4ee468d0dc5..2acb6582348 100644 --- a/Master/texmf-dist/tex/latex/fmtcount/fc-english.def +++ b/Master/texmf-dist/tex/latex/fmtcount/fc-english.def @@ -26,37 +26,37 @@ %% Right bracket \] Circumflex \^ Underscore \_ %% Grave accent \` Left brace \{ Vertical bar \| %% Right brace \} Tilde \~} -\ProvidesFile{fc-english}[2005/04/29] -\newcommand{\@ordinalMenglish}[1]{% +\ProvidesFile{fc-english}[2007/04/20] +\newcommand*{\@ordinalMenglish}[2]{% +\def\@fc@ord{}% \@orgargctr=#1\relax \@ordinalctr=#1% \@modulo{\@ordinalctr}{100}% -\ifnum\@ordinalctr=11 -\the\@orgargctr\fmtord{th}% +\ifnum\@ordinalctr=11\relax + \def\@fc@ord{th}% \else -\ifnum\@ordinalctr=12 -\the\@orgargctr\fmtord{th}% -\else -\ifnum\@ordinalctr=13 -\the\@orgargctr\fmtord{th}% -\else -\@modulo{\@ordinalctr}{10}% -\ifcase\@ordinalctr -\the\@orgargctr\fmtord{th}% case 0 -\or \the\@orgargctr\fmtord{st}% case 1 -\or \the\@orgargctr\fmtord{nd}% case 2 -\or \the\@orgargctr\fmtord{rd}% case 3 -\else -\the\@orgargctr\fmtord{th}% default case -\fi -\fi -\fi -\fi + \ifnum\@ordinalctr=12\relax + \def\@fc@ord{th}% + \else + \ifnum\@ordinalctr=13\relax + \def\@fc@ord{th}% + \else + \@modulo{\@ordinalctr}{10}% + \ifcase\@ordinalctr + \def\@fc@ord{th}% case 0 + \or \def\@fc@ord{st}% case 1 + \or \def\@fc@ord{nd}% case 2 + \or \def\@fc@ord{rd}% case 3 + \else + \def\@fc@ord{th}% default case + \fi + \fi + \fi +\fi +\edef#2{\number#1\relax\noexpand\fmtord{\@fc@ord}}% } \let\@ordinalFenglish=\@ordinalMenglish -\providecommand{\andname}{and} - -\newcommand{\@@unitstringenglish}[1]{% +\newcommand*{\@@unitstringenglish}[1]{% \ifcase#1\relax zero% \or one% @@ -70,8 +70,7 @@ zero% \or nine% \fi } - -\newcommand{\@@tenstringenglish}[1]{% +\newcommand*{\@@tenstringenglish}[1]{% \ifcase#1\relax \or ten% \or twenty% @@ -84,8 +83,7 @@ zero% \or ninety% \fi } - -\newcommand{\@@teenstringenglish}[1]{% +\newcommand*{\@@teenstringenglish}[1]{% \ifcase#1\relax ten% \or eleven% @@ -99,8 +97,7 @@ ten% \or nineteen% \fi } - -\newcommand{\@@Unitstringenglish}[1]{% +\newcommand*{\@@Unitstringenglish}[1]{% \ifcase#1\relax Zero% \or One% @@ -114,8 +111,7 @@ Zero% \or Nine% \fi } - -\newcommand{\@@Tenstringenglish}[1]{% +\newcommand*{\@@Tenstringenglish}[1]{% \ifcase#1\relax \or Ten% \or Twenty% @@ -128,8 +124,7 @@ Zero% \or Ninety% \fi } - -\newcommand{\@@Teenstringenglish}[1]{% +\newcommand*{\@@Teenstringenglish}[1]{% \ifcase#1\relax Ten% \or Eleven% @@ -143,8 +138,7 @@ Ten% \or Nineteen% \fi } - -\newcommand{\@@numberstringenglish}[1]{% +\newcommand*{\@@numberstringenglish}[2]{% \ifnum#1>99999 \PackageError{fmtcount}{Out of range}% {This macro only works for values less than 100000}% @@ -156,70 +150,96 @@ you can try typing "minus" first, and then pass the modulus of this number}% \fi \fi +\def#2{}% \@strctr=#1\relax \divide\@strctr by 1000\relax \ifnum\@strctr>9 -\divide\@strctr by 10 -\ifnum\@strctr>1 -\@tenstring{\@strctr}% -\@strctr=#1 \divide\@strctr by 1000\relax -\@modulo{\@strctr}{10}% -\ifnum\@strctr>0 -\@unitstring{\@strctr}\fi -\else -\@strctr=#1\relax -\divide\@strctr by 1000 -\@modulo{\@strctr}{10}% -\@teenstring{\@strctr}% -\fi -\ \@thousand% + \divide\@strctr by 10 + \ifnum\@strctr>1\relax + \let\@@fc@numstr#2\relax + \edef#2{\@@fc@numstr\@tenstring{\@strctr}}% + \@strctr=#1 \divide\@strctr by 1000\relax + \@modulo{\@strctr}{10}% + \ifnum\@strctr>0\relax + \let\@@fc@numstr#2\relax + \edef#2{\@@fc@numstr-\@unitstring{\@strctr}}% + \fi + \else + \@strctr=#1\relax + \divide\@strctr by 1000\relax + \@modulo{\@strctr}{10}% + \let\@@fc@numstr#2\relax + \edef#2{\@@fc@numstr\@teenstring{\@strctr}}% + \fi + \let\@@fc@numstr#2\relax + \edef#2{\@@fc@numstr\ \@thousand}% \else -\ifnum\@strctr>0 \@unitstring{\@strctr}\ \@thousand\fi + \ifnum\@strctr>0\relax + \let\@@fc@numstr#2\relax + \edef#2{\@@fc@numstr\@unitstring{\@strctr}\ \@thousand}% + \fi \fi \@strctr=#1\relax \@modulo{\@strctr}{1000}% \divide\@strctr by 100 -\ifnum\@strctr>0 -\ifnum#1>1000 \ \fi\@unitstring{\@strctr}\ \@hundred% +\ifnum\@strctr>0\relax + \ifnum#1>1000\relax + \let\@@fc@numstr#2\relax + \edef#2{\@@fc@numstr\ }% + \fi + \let\@@fc@numstr#2\relax + \edef#2{\@@fc@numstr\@unitstring{\@strctr}\ \@hundred}% \fi \@strctr=#1\relax \@modulo{\@strctr}{100}% -\ifnum#1>100 \ifnum\@strctr>0 \ \andname\ \fi\fi -\ifnum\@strctr>19 -\divide\@strctr by 10 -\@tenstring{\@strctr}% -\@strctr=#1\relax \@modulo{\@strctr}{10}% -\ifnum\@strctr>0 --\@unitstring{\@strctr}% -\fi +\ifnum#1>100\relax + \ifnum\@strctr>0\relax + \let\@@fc@numstr#2\relax + \edef#2{\@@fc@numstr\ \@andname\ }% + \fi +\fi +\ifnum\@strctr>19\relax + \divide\@strctr by 10\relax + \let\@@fc@numstr#2\relax + \edef#2{\@@fc@numstr\@tenstring{\@strctr}}% + \@strctr=#1\relax \@modulo{\@strctr}{10}% + \ifnum\@strctr>0\relax + \let\@@fc@numstr#2\relax + \edef#2{\@@fc@numstr-\@unitstring{\@strctr}}% + \fi \else -\ifnum\@strctr<10 -\ifnum\@strctr=0 -\ifnum#1<100 \@unitstring{\@strctr}\fi -\else -\@unitstring{\@strctr}% -\fi -\else -\@modulo{\@strctr}{10}% -\@teenstring{\@strctr}% -\fi + \ifnum\@strctr<10\relax + \ifnum\@strctr=0\relax + \ifnum#1<100\relax + \let\@@fc@numstr#2\relax + \edef#2{\@@fc@numstr\@unitstring{\@strctr}}% + \fi + \else + \let\@@fc@numstr#2\relax + \edef#2{\@@fc@numstr\@unitstring{\@strctr}}% + \fi + \else + \@modulo{\@strctr}{10}% + \let\@@fc@numstr#2\relax + \edef#2{\@@fc@numstr\@teenstring{\@strctr}}% + \fi \fi } - -\newcommand{\@numberstringMenglish}[1]{% +\DeclareRobustCommand{\@numberstringMenglish}[2]{% \let\@unitstring=\@@unitstringenglish \let\@teenstring=\@@teenstringenglish \let\@tenstring=\@@tenstringenglish \def\@hundred{hundred}\def\@thousand{thousand}% -\@@numberstringenglish{#1}} - +\def\@andname{and}% +\@@numberstringenglish{#1}{#2}% +} \let\@numberstringFenglish=\@numberstringMenglish - -\newcommand{\@NumberstringMenglish}[1]{% +\newcommand*{\@NumberstringMenglish}[2]{% \let\@unitstring=\@@Unitstringenglish \let\@teenstring=\@@Teenstringenglish \let\@tenstring=\@@Tenstringenglish \def\@hundred{Hundred}\def\@thousand{Thousand}% -\@@numberstringenglish{#1}} - +\def\@andname{and}% +\@@numberstringenglish{#1}{#2}} \let\@NumberstringFenglish=\@NumberstringMenglish -\newcommand{\@@unitthstringenglish}[1]{% +\newcommand*{\@@unitthstringenglish}[1]{% \ifcase#1\relax zeroth% \or first% @@ -233,8 +253,7 @@ zeroth% \or ninth% \fi } - -\newcommand{\@@tenthstringenglish}[1]{% +\newcommand*{\@@tenthstringenglish}[1]{% \ifcase#1\relax \or tenth% \or twentieth% @@ -247,8 +266,7 @@ zeroth% \or ninetieth% \fi } - -\newcommand{\@@teenthstringenglish}[1]{% +\newcommand*{\@@teenthstringenglish}[1]{% \ifcase#1\relax tenth% \or eleventh% @@ -262,8 +280,7 @@ tenth% \or nineteenth% \fi } - -\newcommand{\@@Unitthstringenglish}[1]{% +\newcommand*{\@@Unitthstringenglish}[1]{% \ifcase#1\relax Zeroth% \or First% @@ -277,8 +294,7 @@ Zeroth% \or Ninth% \fi } - -\newcommand{\@@Tenthstringenglish}[1]{% +\newcommand*{\@@Tenthstringenglish}[1]{% \ifcase#1\relax \or Tenth% \or Twentieth% @@ -291,8 +307,7 @@ Zeroth% \or Ninetieth% \fi } - -\newcommand{\@@Teenthstringenglish}[1]{% +\newcommand*{\@@Teenthstringenglish}[1]{% \ifcase#1\relax Tenth% \or Eleventh% @@ -306,8 +321,7 @@ Tenth% \or Nineteenth% \fi } - -\newcommand{\@@ordinalstringenglish}[1]{% +\newcommand*{\@@ordinalstringenglish}[2]{% \@strctr=#1\relax \ifnum#1>99999 \PackageError{fmtcount}{Out of range}% @@ -319,88 +333,129 @@ Tenth% you can try typing "minus" first, and then pass the modulus of this number}% \fi +\def#2{}% \fi \@strctr=#1\relax \divide\@strctr by 1000\relax -\ifnum\@strctr>9 -\divide\@strctr by 10 -\ifnum\@strctr>1\relax - \@tenstring{\@strctr}% - \@strctr=#1\relax - \divide\@strctr by 1000\relax - \@modulo{\@strctr}{10}% - \ifnum\@strctr>0 -\@unitstring{\@strctr}\fi -\else - \@strctr=#1\relax \divide\@strctr by 1000\relax - \@modulo{\@strctr}{10}% - \@teenstring{\@strctr}% -\fi -\@strctr=#1\relax \@modulo{\@strctr}{1000}% -\ifnum\@strctr=0\ \@thousandth\else\ \@thousand \fi +\ifnum\@strctr>9\relax + \divide\@strctr by 10 + \ifnum\@strctr>1\relax + \let\@@fc@ordstr#2\relax + \edef#2{\@@fc@ordstr\@tenstring{\@strctr}}% + \@strctr=#1\relax + \divide\@strctr by 1000\relax + \@modulo{\@strctr}{10}% + \ifnum\@strctr>0\relax + \let\@@fc@ordstr#2\relax + \edef#2{\@@fc@ordstr-\@unitstring{\@strctr}}% + \fi + \else + \@strctr=#1\relax \divide\@strctr by 1000\relax + \@modulo{\@strctr}{10}% + \let\@@fc@ordstr#2\relax + \edef#2{\@@fc@ordstr\@teenstring{\@strctr}}% + \fi + \@strctr=#1\relax \@modulo{\@strctr}{1000}% + \ifnum\@strctr=0\relax + \let\@@fc@ordstr#2\relax + \edef#2{\@@fc@ordstr\ \@thousandth}% + \else + \let\@@fc@ordstr#2\relax + \edef#2{\@@fc@ordstr\ \@thousand}% + \fi \else -\ifnum\@strctr>0\relax -\@unitstring{\@strctr}% -\@strctr=#1\relax \@modulo{\@strctr}{1000}% -\ifnum\@strctr=0\ \@thousandth\else\ \@thousand\fi -\fi + \ifnum\@strctr>0\relax + \let\@@fc@ordstr#2\relax + \edef#2{\@@fc@ordstr\@unitstring{\@strctr}}% + \@strctr=#1\relax \@modulo{\@strctr}{1000}% + \let\@@fc@ordstr#2\relax + \ifnum\@strctr=0\relax + \edef#2{\@@fc@ordstr\ \@thousandth}% + \else + \edef#2{\@@fc@ordstr\ \@thousand}% + \fi + \fi \fi \@strctr=#1\relax \@modulo{\@strctr}{1000}% \divide\@strctr by 100 -\ifnum\@strctr>0 -\ifnum#1>1000 \ \fi\@unitstring{\@strctr}% -\@strctr=#1\relax \@modulo{\@strctr}{100}% -\ifnum\@strctr=0\ \@hundredth\else\ \@hundred\fi +\ifnum\@strctr>0\relax + \ifnum#1>1000\relax + \let\@@fc@ordstr#2\relax + \edef#2{\@@fc@ordstr\ }% + \fi + \let\@@fc@ordstr#2\relax + \edef#2{\@@fc@ordstr\@unitstring{\@strctr}}% + \@strctr=#1\relax \@modulo{\@strctr}{100}% + \let\@@fc@ordstr#2\relax + \ifnum\@strctr=0\relax + \edef#2{\@@fc@ordstr\ \@hundredth}% + \else + \edef#2{\@@fc@ordstr\ \@hundred}% + \fi \fi \@strctr=#1\relax \@modulo{\@strctr}{100}% -\ifnum#1>100 \ifnum\@strctr>0\ and \fi\fi -\ifnum\@strctr>19 -\@tmpstrctr=\@strctr -\divide\@strctr by 10 -\@modulo{\@tmpstrctr}{10}% -\ifnum\@tmpstrctr=0 \@tenthstring{\@strctr}\else \@tenstring{\@strctr}\fi -\@strctr=#1\relax \@modulo{\@strctr}{10}% -\ifnum\@strctr>0 --\@unitthstring{\@strctr}% -\fi -\else -\ifnum\@strctr<10 -\ifnum\@strctr=0 -\ifnum#1<100 \@unitthstring{\@strctr}\fi +\ifnum#1>100\relax + \ifnum\@strctr>0\relax + \let\@@fc@ordstr#2\relax + \edef#2{\@@fc@ordstr\ \@andname\ }% + \fi +\fi +\ifnum\@strctr>19\relax + \@tmpstrctr=\@strctr + \divide\@strctr by 10\relax + \@modulo{\@tmpstrctr}{10}% + \let\@@fc@ordstr#2\relax + \ifnum\@tmpstrctr=0\relax + \edef#2{\@@fc@ordstr\@tenthstring{\@strctr}}% + \else + \edef#2{\@@fc@ordstr\@tenstring{\@strctr}}% + \fi + \@strctr=#1\relax \@modulo{\@strctr}{10}% + \ifnum\@strctr>0\relax + \let\@@fc@ordstr#2\relax + \edef#2{\@@fc@ordstr-\@unitthstring{\@strctr}}% + \fi \else -\@unitthstring{\@strctr}% -\fi -\else -\@modulo{\@strctr}{10}% -\@teenthstring{\@strctr}% -\fi + \ifnum\@strctr<10\relax + \ifnum\@strctr=0\relax + \ifnum#1<100\relax + \let\@@fc@ordstr#2\relax + \edef#2{\@@fc@ordstr\@unitthstring{\@strctr}}% + \fi + \else + \let\@@fc@ordstr#2\relax + \edef#2{\@@fc@ordstr\@unitthstring{\@strctr}}% + \fi + \else + \@modulo{\@strctr}{10}% + \let\@@fc@ordstr#2\relax + \edef#2{\@@fc@ordstr\@teenthstring{\@strctr}}% + \fi \fi } - -\newcommand{\@ordinalstringMenglish}[1]{% +\DeclareRobustCommand{\@ordinalstringMenglish}[2]{% \let\@unitthstring=\@@unitthstringenglish \let\@teenthstring=\@@teenthstringenglish \let\@tenthstring=\@@tenthstringenglish \let\@unitstring=\@@unitstringenglish \let\@teenstring=\@@teenstringenglish \let\@tenstring=\@@tenstringenglish +\def\@andname{and}% \def\@hundred{hundred}\def\@thousand{thousand}% \def\@hundredth{hundredth}\def\@thousandth{thousandth}% -\@@ordinalstringenglish{#1}} - +\@@ordinalstringenglish{#1}{#2}} \let\@ordinalstringFenglish=\@ordinalstringMenglish - -\newcommand{\@OrdinalstringMenglish}[1]{% +\DeclareRobustCommand{\@OrdinalstringMenglish}[2]{% \let\@unitthstring=\@@Unitthstringenglish \let\@teenthstring=\@@Teenthstringenglish \let\@tenthstring=\@@Tenthstringenglish \let\@unitstring=\@@Unitstringenglish \let\@teenstring=\@@Teenstringenglish \let\@tenstring=\@@Tenstringenglish +\def\@andname{and}% \def\@hundred{Hundred}\def\@thousand{Thousand}% \def\@hundredth{Hundredth}\def\@thousandth{Thousandth}% -\@@ordinalstringenglish{#1}} - +\@@ordinalstringenglish{#1}{#2}} \let\@OrdinalstringFenglish=\@OrdinalstringMenglish - \endinput %% %% End of file `fc-english.def'. diff --git a/Master/texmf-dist/tex/latex/fmtcount/fc-french.def b/Master/texmf-dist/tex/latex/fmtcount/fc-french.def index f3a10c8fd81..eed31b8a63a 100644 --- a/Master/texmf-dist/tex/latex/fmtcount/fc-french.def +++ b/Master/texmf-dist/tex/latex/fmtcount/fc-french.def @@ -26,8 +26,28 @@ %% Right bracket \] Circumflex \^ Underscore \_ %% Grave accent \` Left brace \{ Vertical bar \| %% Right brace \} Tilde \~} -\ProvidesFile{fc-french.def}[2005/04/29] -\newcommand{\@@unitstringfrench}[1]{% +\ProvidesFile{fc-french.def}[2007/04/20] +\newcommand*{\@ordinalMfrench}[2]{% +\iffmtord@abbrv + \edef#2{\number#1\relax\noexpand\fmtord{e}}% +\else + \ifnum#1=1\relax + \edef#2{\number#1\relax\noexpand\fmtord{er}}% + \else + \edef#2{\number#1\relax\noexpand\fmtord{eme}}% + \fi +\fi} +\newcommand*{\@ordinalFfrench}[2]{% +\iffmtord@abbrv + \edef#2{\number#1\relax\noexpand\fmtord{e}}% +\else + \ifnum#1=1\relax + \edef#2{\number#1\relax\noexpand\fmtord{ere}}% + \else + \edef#2{\number#1\relax\noexpand\fmtord{eme}}% + \fi +\fi} +\newcommand*{\@@unitstringfrench}[1]{% \ifcase#1\relax zero% \or un% @@ -41,15 +61,13 @@ zero% \or neuf% \fi } - -\newcommand{\@@unitstringFfrench}[1]{% +\newcommand*{\@@unitstringFfrench}[1]{% \ifnum#1=1\relax une% \else\@@unitstringfrench{#1}% \fi } - -\newcommand{\@@tenstringfrench}[1]{% +\newcommand*{\@@tenstringfrench}[1]{% \ifcase#1\relax \or dix% \or vingt% @@ -63,8 +81,7 @@ une% \or cent% \fi } - -\newcommand{\@@teenstringfrench}[1]{% +\newcommand*{\@@teenstringfrench}[1]{% \ifcase#1\relax dix% \or onze% @@ -78,8 +95,7 @@ dix% \or dix-neuf% \fi } - -\newcommand{\@@seventiesfrench}[1]{% +\newcommand*{\@@seventiesfrench}[1]{% \@tenstring{6}% \ifnum#1=1\relax \ \@andname\ @@ -88,8 +104,7 @@ dix% \fi \@teenstring{#1}% } - -\newcommand{\@@eightiesfrench}[1]{% +\newcommand*{\@@eightiesfrench}[1]{% \@unitstring{4}-\@tenstring{2}% \ifnum#1>0 -\@unitstring{#1}% @@ -97,33 +112,28 @@ dix% s% \fi } - -\newcommand{\@@ninetiesfrench}[1]{% +\newcommand*{\@@ninetiesfrench}[1]{% \@unitstring{4}-\@tenstring{2}-\@teenstring{#1}% } - -\newcommand{\@@seventiesfrenchswiss}[1]{% +\newcommand*{\@@seventiesfrenchswiss}[1]{% \@tenstring{7}% \ifnum#1=1\ \@andname\ \fi \ifnum#1>1-\fi \ifnum#1>0\@unitstring{#1}\fi } - -\newcommand{\@@eightiesfrenchswiss}[1]{% +\newcommand*{\@@eightiesfrenchswiss}[1]{% \@tenstring{8}% \ifnum#1=1\ \@andname\ \fi \ifnum#1>1-\fi \ifnum#1>0\@unitstring{#1}\fi } - -\newcommand{\@@ninetiesfrenchswiss}[1]{% +\newcommand*{\@@ninetiesfrenchswiss}[1]{% \@tenstring{9}% \ifnum#1=1\ \@andname\ \fi \ifnum#1>1-\fi \ifnum#1>0\@unitstring{#1}\fi } - -\newcommand{\@@Unitstringfrench}[1]{% +\newcommand*{\@@Unitstringfrench}[1]{% \ifcase#1\relax Zero% \or Un% @@ -137,15 +147,13 @@ Zero% \or Neuf% \fi } - -\newcommand{\@@UnitstringFfrench}[1]{% +\newcommand*{\@@UnitstringFfrench}[1]{% \ifnum#1=1\relax Une% \else \@@Unitstringfrench{#1}% \fi } - -\newcommand{\@@Tenstringfrench}[1]{% +\newcommand*{\@@Tenstringfrench}[1]{% \ifcase#1\relax \or Dix% \or Vingt% @@ -159,8 +167,7 @@ Une% \or Cent% \fi } - -\newcommand{\@@Teenstringfrench}[1]{% +\newcommand*{\@@Teenstringfrench}[1]{% \ifcase#1\relax Dix% \or Onze% @@ -174,8 +181,7 @@ Dix% \or Dix-Neuf% \fi } - -\newcommand{\@numberstringMfrenchswiss}[1]{% +\DeclareRobustCommand{\@numberstringMfrenchswiss}[2]{% \let\@unitstring=\@@unitstringfrench \let\@teenstring=\@@teenstringfrench \let\@tenstring=\@@tenstringfrench @@ -184,9 +190,8 @@ Dix% \let\@nineties=\@@ninetiesfrenchswiss \def\@hundred{cent}\def\@thousand{mille}% \def\@andname{et}% -\@@numberstringfrench{#1}} - -\newcommand{\@numberstringMfrenchfrance}[1]{% +\@@numberstringfrench{#1}{#2}} +\DeclareRobustCommand{\@numberstringMfrenchfrance}[2]{% \let\@unitstring=\@@unitstringfrench \let\@teenstring=\@@teenstringfrench \let\@tenstring=\@@tenstringfrench @@ -195,9 +200,8 @@ Dix% \let\@nineties=\@@ninetiesfrench \def\@hundred{cent}\def\@thousand{mille}% \def\@andname{et}% -\@@numberstringfrench{#1}} - -\newcommand{\@numberstringMfrenchbelgian}[1]{% +\@@numberstringfrench{#1}{#2}} +\DeclareRobustCommand{\@numberstringMfrenchbelgian}[2]{% \let\@unitstring=\@@unitstringfrench \let\@teenstring=\@@teenstringfrench \let\@tenstring=\@@tenstringfrench @@ -206,11 +210,9 @@ Dix% \let\@nineties=\@@ninetiesfrench \def\@hundred{cent}\def\@thousand{mille}% \def\@andname{et}% -\@@numberstringfrench{#1}} - +\@@numberstringfrench{#1}{#2}} \let\@numberstringMfrench=\@numberstringMfrenchfrance - -\newcommand{\@numberstringFfrenchswiss}[1]{% +\DeclareRobustCommand{\@numberstringFfrenchswiss}[2]{% \let\@unitstring=\@@unitstringFfrench \let\@teenstring=\@@teenstringfrench \let\@tenstring=\@@tenstringfrench @@ -219,9 +221,8 @@ Dix% \let\@nineties=\@@ninetiesfrenchswiss \def\@hundred{cent}\def\@thousand{mille}% \def\@andname{et}% -\@@numberstringfrench{#1}} - -\newcommand{\@numberstringFfrenchfrance}[1]{% +\@@numberstringfrench{#1}{#2}} +\DeclareRobustCommand{\@numberstringFfrenchfrance}[2]{% \let\@unitstring=\@@unitstringFfrench \let\@teenstring=\@@teenstringfrench \let\@tenstring=\@@tenstringfrench @@ -230,9 +231,8 @@ Dix% \let\@nineties=\@@ninetiesfrench \def\@hundred{cent}\def\@thousand{mille}% \def\@andname{et}% -\@@numberstringfrench{#1}} - -\newcommand{\@numberstringFfrenchbelgian}[1]{% +\@@numberstringfrench{#1}{#2}} +\DeclareRobustCommand{\@numberstringFfrenchbelgian}[2]{% \let\@unitstring=\@@unitstringFfrench \let\@teenstring=\@@teenstringfrench \let\@tenstring=\@@tenstringfrench @@ -241,11 +241,9 @@ Dix% \let\@nineties=\@@ninetiesfrench \def\@hundred{cent}\def\@thousand{mille}% \def\@andname{et}% -\@@numberstringfrench{#1}} - +\@@numberstringfrench{#1}{#2}} \let\@numberstringFfrench=\@numberstringFfrenchfrance - -\newcommand{\@NumberstringMfrenchswiss}[1]{% +\DeclareRobustCommand{\@NumberstringMfrenchswiss}[2]{% \let\@unitstring=\@@Unitstringfrench \let\@teenstring=\@@Teenstringfrench \let\@tenstring=\@@Tenstringfrench @@ -254,9 +252,8 @@ Dix% \let\@nineties=\@@ninetiesfrenchswiss \def\@hundred{Cent}\def\@thousand{Mille}% \def\@andname{et}% -\@@numberstringfrench{#1}} - -\newcommand{\@NumberstringMfrenchfrance}[1]{% +\@@numberstringfrench{#1}{#2}} +\DeclareRobustCommand{\@NumberstringMfrenchfrance}[2]{% \let\@unitstring=\@@Unitstringfrench \let\@teenstring=\@@Teenstringfrench \let\@tenstring=\@@Tenstringfrench @@ -265,9 +262,8 @@ Dix% \let\@nineties=\@@ninetiesfrench \def\@hundred{Cent}\def\@thousand{Mille}% \def\@andname{et}% -\@@numberstringfrench{#1}} - -\newcommand{\@NumberstringMfrenchbelgian}[1]{% +\@@numberstringfrench{#1}{#2}} +\DeclareRobustCommand{\@NumberstringMfrenchbelgian}[2]{% \let\@unitstring=\@@Unitstringfrench \let\@teenstring=\@@Teenstringfrench \let\@tenstring=\@@Tenstringfrench @@ -276,11 +272,9 @@ Dix% \let\@nineties=\@@ninetiesfrench \def\@hundred{Cent}\def\@thousand{Mille}% \def\@andname{et}% -\@@numberstringfrench{#1}} - +\@@numberstringfrench{#1}{#2}} \let\@NumberstringMfrench=\@NumberstringMfrenchfrance - -\newcommand{\@NumberstringFfrenchswiss}[1]{% +\DeclareRobustCommand{\@NumberstringFfrenchswiss}[2]{% \let\@unitstring=\@@UnitstringFfrench \let\@teenstring=\@@Teenstringfrench \let\@tenstring=\@@Tenstringfrench @@ -289,9 +283,8 @@ Dix% \let\@nineties=\@@ninetiesfrenchswiss \def\@hundred{Cent}\def\@thousand{Mille}% \def\@andname{et}% -\@@numberstringfrench{#1}} - -\newcommand{\@NumberstringFfrenchfrance}[1]{% +\@@numberstringfrench{#1}{#2}} +\DeclareRobustCommand{\@NumberstringFfrenchfrance}[2]{% \let\@unitstring=\@@UnitstringFfrench \let\@teenstring=\@@Teenstringfrench \let\@tenstring=\@@Tenstringfrench @@ -300,9 +293,8 @@ Dix% \let\@nineties=\@@ninetiesfrench \def\@hundred{Cent}\def\@thousand{Mille}% \def\@andname{et}% -\@@numberstringfrench{#1}} - -\newcommand{\@NumberstringFfrenchbelgian}[1]{% +\@@numberstringfrench{#1}{#2}} +\DeclareRobustCommand{\@NumberstringFfrenchbelgian}[2]{% \let\@unitstring=\@@UnitstringFfrench \let\@teenstring=\@@Teenstringfrench \let\@tenstring=\@@Tenstringfrench @@ -311,13 +303,11 @@ Dix% \let\@nineties=\@@ninetiesfrench \def\@hundred{Cent}\def\@thousand{Mille}% \def\@andname{et}% -\@@numberstringfrench{#1}} - +\@@numberstringfrench{#1}{#2}} \let\@NumberstringFfrench=\@NumberstringFfrenchfrance - -\newcommand{\@ordinalstringMfrenchswiss}[1]{% +\DeclareRobustCommand{\@ordinalstringMfrenchswiss}[2]{% \ifnum#1=1\relax -premier% +\def#2{premier}% \else \let\@unitthstring=\@@unitthstringfrench \let\@unitstring=\@@unitstringfrench @@ -334,12 +324,11 @@ premier% \def\@hundredth{centi\`eme}\def\@hundred{cent}% \def\@thousandth{mili\`eme}\def\@thousand{mille}% \def\@andname{et}% -\@@ordinalstringfrench{#1}% +\@@ordinalstringfrench{#1}{#2}% \fi} - -\newcommand{\@ordinalstringMfrenchfrance}[1]{% +\DeclareRobustCommand{\@ordinalstringMfrenchfrance}[2]{% \ifnum#1=1\relax -premier% +\def#2{premier}% \else \let\@unitthstring=\@@unitthstringfrench \let\@unitstring=\@@unitstringfrench @@ -357,12 +346,11 @@ premier% \def\@hundredth{centi\`eme}\def\@hundred{cent}% \def\@thousandth{mili\`eme}\def\@thousand{mille}% \def\@andname{et}% -\@@ordinalstringfrench{#1}% +\@@ordinalstringfrench{#1}{#2}% \fi} - -\newcommand{\@ordinalstringMfrenchbelgian}[1]{% +\DeclareRobustCommand{\@ordinalstringMfrenchbelgian}[2]{% \ifnum#1=1\relax -premier% +\def#2{premier}% \else \let\@unitthstring=\@@unitthstringfrench \let\@unitstring=\@@unitstringfrench @@ -380,14 +368,12 @@ premier% \def\@hundredth{centi\`eme}\def\@hundred{cent}% \def\@thousandth{mili\`eme}\def\@thousand{mille}% \def\@andname{et}% -\@@ordinalstringfrench{#1}% +\@@ordinalstringfrench{#1}{#2}% \fi} - \let\@ordinalstringMfrench=\@ordinalstringMfrenchfrance - -\newcommand{\@ordinalstringFfrenchswiss}[1]{% +\DeclareRobustCommand{\@ordinalstringFfrenchswiss}[2]{% \ifnum#1=1\relax -premi\`ere% +\def#2{premi\`ere}% \else \let\@unitthstring=\@@unitthstringfrench \let\@unitstring=\@@unitstringFfrench @@ -404,12 +390,11 @@ premi\`ere% \def\@hundredth{centi\`eme}\def\@hundred{cent}% \def\@thousandth{mili\`eme}\def\@thousand{mille}% \def\@andname{et}% -\@@ordinalstringfrench{#1}% +\@@ordinalstringfrench{#1}{#2}% \fi} - -\newcommand{\@ordinalstringFfrenchfrance}[1]{% +\DeclareRobustCommand{\@ordinalstringFfrenchfrance}[2]{% \ifnum#1=1\relax -premi\`ere% +\def#2{premi\`ere}% \else \let\@unitthstring=\@@unitthstringfrench \let\@unitstring=\@@unitstringFfrench @@ -427,12 +412,11 @@ premi\`ere% \def\@hundredth{centi\`eme}\def\@hundred{cent}% \def\@thousandth{mili\`eme}\def\@thousand{mille}% \def\@andname{et}% -\@@ordinalstringfrench{#1}% +\@@ordinalstringfrench{#1}{#2}% \fi} - -\newcommand{\@ordinalstringFfrenchbelgian}[1]{% +\DeclareRobustCommand{\@ordinalstringFfrenchbelgian}[2]{% \ifnum#1=1\relax -premi\`ere% +\def#2{premi\`ere}% \else \let\@unitthstring=\@@unitthstringfrench \let\@unitstring=\@@unitstringFfrench @@ -450,14 +434,12 @@ premi\`ere% \def\@hundredth{centi\`eme}\def\@hundred{cent}% \def\@thousandth{mili\`eme}\def\@thousand{mille}% \def\@andname{et}% -\@@ordinalstringfrench{#1}% +\@@ordinalstringfrench{#1}{#2}% \fi} - \let\@ordinalstringFfrench=\@ordinalstringFfrenchfrance - -\newcommand{\@OrdinalstringMfrenchswiss}[1]{% +\DeclareRobustCommand{\@OrdinalstringMfrenchswiss}[2]{% \ifnum#1=1\relax -Premi\`ere% +\def#2{Premi\`ere}% \else \let\@unitthstring=\@@Unitthstringfrench \let\@unitstring=\@@Unitstringfrench @@ -474,12 +456,11 @@ Premi\`ere% \def\@hundredth{Centi\`eme}\def\@hundred{Cent}% \def\@thousandth{Mili\`eme}\def\@thousand{Mille}% \def\@andname{et}% -\@@ordinalstringfrench{#1}% +\@@ordinalstringfrench{#1}{#2}% \fi} - -\newcommand{\@OrdinalstringMfrenchfrance}[1]{% +\DeclareRobustCommand{\@OrdinalstringMfrenchfrance}[2]{% \ifnum#1=1\relax -Premi\`ere% +\def#2{Premi\`ere}% \else \let\@unitthstring=\@@Unitthstringfrench \let\@unitstring=\@@Unitstringfrench @@ -497,12 +478,11 @@ Premi\`ere% \def\@hundredth{Centi\`eme}\def\@hundred{Cent}% \def\@thousandth{Mili\`eme}\def\@thousand{Mille}% \def\@andname{et}% -\@@ordinalstringfrench{#1}% +\@@ordinalstringfrench{#1}{#2}% \fi} - -\newcommand{\@OrdinalstringMfrenchbelgian}[1]{% +\DeclareRobustCommand{\@OrdinalstringMfrenchbelgian}[2]{% \ifnum#1=1\relax -Premi\`ere% +\def#2{Premi\`ere}% \else \let\@unitthstring=\@@Unitthstringfrench \let\@unitstring=\@@Unitstringfrench @@ -520,14 +500,12 @@ Premi\`ere% \def\@hundredth{Centi\`eme}\def\@hundred{Cent}% \def\@thousandth{Mili\`eme}\def\@thousand{Mille}% \def\@andname{et}% -\@@ordinalstringfrench{#1}% +\@@ordinalstringfrench{#1}{#2}% \fi} - \let\@OrdinalstringMfrench=\@OrdinalstringMfrenchfrance - -\newcommand{\@OrdinalstringFfrenchswiss}[1]{% +\DeclareRobustCommand{\@OrdinalstringFfrenchswiss}[2]{% \ifnum#1=1\relax -Premi\`ere% +\def#2{Premi\`ere}% \else \let\@unitthstring=\@@Unitthstringfrench \let\@unitstring=\@@UnitstringFfrench @@ -544,12 +522,11 @@ Premi\`ere% \def\@hundredth{Centi\`eme}\def\@hundred{Cent}% \def\@thousandth{Mili\`eme}\def\@thousand{Mille}% \def\@andname{et}% -\@@ordinalstringfrench{#1}% +\@@ordinalstringfrench{#1}{#2}% \fi} - -\newcommand{\@OrdinalstringFfrenchfrance}[1]{% +\DeclareRobustCommand{\@OrdinalstringFfrenchfrance}[2]{% \ifnum#1=1\relax -Premi\`ere% +\def#2{Premi\`ere}% \else \let\@unitthstring=\@@Unitthstringfrench \let\@unitstring=\@@UnitstringFfrench @@ -567,12 +544,11 @@ Premi\`ere% \def\@hundredth{Centi\`eme}\def\@hundred{Cent}% \def\@thousandth{Mili\`eme}\def\@thousand{Mille}% \def\@andname{et}% -\@@ordinalstringfrench{#1}% +\@@ordinalstringfrench{#1}{#2}% \fi} - -\newcommand{\@OrdinalstringFfrenchbelgian}[1]{% +\DeclareRobustCommand{\@OrdinalstringFfrenchbelgian}[2]{% \ifnum#1=1\relax -Premi\`ere% +\def#2{Premi\`ere}% \else \let\@unitthstring=\@@Unitthstringfrench \let\@unitstring=\@@UnitstringFfrench @@ -590,26 +566,10 @@ Premi\`ere% \def\@hundredth{Centi\`eme}\def\@hundred{Cent}% \def\@thousandth{Mili\`eme}\def\@thousand{Mille}% \def\@andname{et}% -\@@ordinalstringfrench{#1}% +\@@ordinalstringfrench{#1}{#2}% \fi} - \let\@OrdinalstringFfrench=\@OrdinalstringFfrenchfrance - -\newcommand{\@ordinalMfrench}[1]{% -\iffmtord@abbrv -#1\fmtord{e}% -\else -#1\ifnum#1=1\fmtord{er}\else\fmtord{eme}\fi -\fi} - -\newcommand{\@ordinalFfrench}[1]{% -\iffmtord@abbrv -#1\fmtord{e}% -\else -#1\ifnum#1=1\fmtord{ere}\else\fmtord{eme}\fi -\fi} - -\newcommand{\@@unitthstringfrench}[1]{% +\newcommand*{\@@unitthstringfrench}[1]{% \ifcase#1\relax zero% \or uni\`eme% @@ -623,8 +583,7 @@ zero% \or neuvi\`eme% \fi } - -\newcommand{\@@tenthstringfrench}[1]{% +\newcommand*{\@@tenthstringfrench}[1]{% \ifcase#1\relax \or dixi\`eme% \or vingti\`eme% @@ -637,8 +596,7 @@ zero% \or nonenti\`eme% \fi } - -\newcommand{\@@teenthstringfrench}[1]{% +\newcommand*{\@@teenthstringfrench}[1]{% \ifcase#1\relax dixi\`eme% \or onzi\`eme% @@ -652,8 +610,7 @@ dixi\`eme% \or dix-neuvi\`eme% \fi } - -\newcommand{\@@seventiethsfrenchswiss}[1]{% +\newcommand*{\@@seventiethsfrenchswiss}[1]{% \ifcase#1\relax \@tenthstring{7}% \or @@ -661,8 +618,7 @@ dixi\`eme% \else \@tenstring{7}-\@unitthstring{#1}% \fi} - -\newcommand{\@@eightiethsfrenchswiss}[1]{% +\newcommand*{\@@eightiethsfrenchswiss}[1]{% \ifcase#1\relax \@tenthstring{8}% \or @@ -670,8 +626,7 @@ dixi\`eme% \else \@tenstring{8}-\@unitthstring{#1}% \fi} - -\newcommand{\@@ninetiethsfrenchswiss}[1]{% +\newcommand*{\@@ninetiethsfrenchswiss}[1]{% \ifcase#1\relax \@tenthstring{9}% \or @@ -679,8 +634,7 @@ dixi\`eme% \else \@tenstring{9}-\@unitthstring{#1}% \fi} - -\newcommand{\@@seventiethsfrench}[1]{% +\newcommand*{\@@seventiethsfrench}[1]{% \ifnum#1=0\relax \@tenstring{6}% -% @@ -690,8 +644,7 @@ dixi\`eme% \fi \@teenthstring{#1}% } - -\newcommand{\@@eightiethsfrench}[1]{% +\newcommand*{\@@eightiethsfrench}[1]{% \ifnum#1>0\relax \@unitstring{4}-\@tenstring{2}% -\@unitthstring{#1}% @@ -699,12 +652,10 @@ dixi\`eme% \@unitstring{4}-\@tenthstring{2}% \fi } - -\newcommand{\@@ninetiethsfrench}[1]{% +\newcommand*{\@@ninetiethsfrench}[1]{% \@unitstring{4}-\@tenstring{2}-\@teenthstring{#1}% } - -\newcommand{\@@Unitthstringfrench}[1]{% +\newcommand*{\@@Unitthstringfrench}[1]{% \ifcase#1\relax Zero% \or Uni\`eme% @@ -718,8 +669,7 @@ Zero% \or Neuvi\`eme% \fi } - -\newcommand{\@@Tenthstringfrench}[1]{% +\newcommand*{\@@Tenthstringfrench}[1]{% \ifcase#1\relax \or Dixi\`eme% \or Vingti\`eme% @@ -732,8 +682,7 @@ Zero% \or Nonenti\`eme% \fi } - -\newcommand{\@@Teenthstringfrench}[1]{% +\newcommand*{\@@Teenthstringfrench}[1]{% \ifcase#1\relax Dixi\`eme% \or Onzi\`eme% @@ -747,8 +696,7 @@ Dixi\`eme% \or Dix-Neuvi\`eme% \fi } - -\newcommand{\@@numberstringfrench}[1]{% +\newcommand*{\@@numberstringfrench}[2]{% \ifnum#1>99999 \PackageError{fmtcount}{Out of range}% {This macro only works for values less than 100000}% @@ -760,101 +708,142 @@ you can try typing "minus" first, and then pass the modulus of this number}% \fi \fi +\def#2{}% \@strctr=#1\relax \divide\@strctr by 1000\relax -\ifnum\@strctr>9 +\ifnum\@strctr>9\relax \@tmpstrctr=\@strctr - \divide\@strctr by 10 - \ifnum\@strctr>1 + \divide\@strctr by 10\relax + \ifnum\@strctr>1\relax \ifthenelse{\(\@strctr>6\)\and\(\@strctr<10\)}{% \@modulo{\@tmpstrctr}{10}% \ifnum\@strctr<8\relax - \@seventies{\@tmpstrctr}% + \let\@@fc@numstr#2\relax + \edef#2{\@@fc@numstr\@seventies{\@tmpstrctr}}% \else \ifnum\@strctr<9\relax - \@eighties{\@tmpstrctr}% + \let\@@fc@numstr#2\relax + \edef#2{\@@fc@numstr\@eighties{\@tmpstrctr}}% \else - \ifnum\@strctr<10\@nineties{\@tmpstrctr}\fi + \ifnum\@strctr<10\relax + \let\@@fc@numstr#2\relax + \edef#2{\@@fc@numstr\@nineties{\@tmpstrctr}}% + \fi \fi \fi }{% - \@tenstring{\@strctr}% + \let\@@fc@numstr#2\relax + \edef#2{\@@fc@numstr\@tenstring{\@strctr}}% \@strctr=#1\relax \divide\@strctr by 1000\relax \@modulo{\@strctr}{10}% \ifnum\@strctr>0\relax - \ \@unitstring{\@strctr}% + \let\@@fc@numstr#2\relax + \edef#2{\@@fc@numstr\ \@unitstring{\@strctr}}% \fi }% \else \@strctr=#1\relax \divide\@strctr by 1000 \@modulo{\@strctr}{10}% - \@teenstring{\@strctr}% + \let\@@fc@numstr#2\relax + \edef#2{\@@fc@numstr\@teenstring{\@strctr}}% \fi - \ \@thousand% + \let\@@fc@numstr#2\relax + \edef#2{\@@fc@numstr\ \@thousand}% \else - \ifnum\@strctr>0 - \ifnum\@strctr>1\@unitstring{\@strctr}\ \fi - \@thousand + \ifnum\@strctr>0\relax + \ifnum\@strctr>1\relax + \let\@@fc@numstr#2\relax + \edef#2{\@@fc@numstr\@unitstring{\@strctr}\ }% + \fi + \let\@@fc@numstr#2\relax + \edef#2{\@@fc@numstr\@thousand}% \fi \fi \@strctr=#1\relax \@modulo{\@strctr}{1000}% \divide\@strctr by 100 \ifnum\@strctr>0\relax - \ifnum#1>1000 \ \fi + \ifnum#1>1000\relax + \let\@@fc@numstr#2\relax + \edef#2{\@@fc@numstr\ }% + \fi \@tmpstrctr=#1\relax \@modulo{\@tmpstrctr}{1000}\relax \ifnum\@tmpstrctr=100\relax - \@tenstring{10}\relax + \let\@@fc@numstr#2\relax + \edef#2{\@@fc@numstr\@tenstring{10}}% \else - \ifnum\@strctr>1\@unitstring{\@strctr}\ \fi - \@hundred + \ifnum\@strctr>1\relax + \let\@@fc@numstr#2\relax + \edef#2{\@@fc@numstr\@unitstring{\@strctr}\ }% + \fi + \let\@@fc@numstr#2\relax + \edef#2{\@@fc@numstr\@hundred}% \fi \fi \@strctr=#1\relax \@modulo{\@strctr}{100}% \ifnum#1>100\relax \ifnum\@strctr>0\relax -\ % \ \@andname\ + \let\@@fc@numstr#2\relax + \edef#2{\@@fc@numstr\ }% \else - \ifnum\@tmpstrctr>0s\fi% + \ifnum\@tmpstrctr>0\relax + \let\@@fc@numstr#2\relax + \edef#2{\@@fc@numstr s}% + \fi% \fi \fi -\ifnum\@strctr>19 -\@tmpstrctr=\@strctr -\divide\@strctr by 10 -\ifthenelse{\@strctr>6}{% -\@modulo{\@tmpstrctr}{10}% -\ifnum\@strctr<8 -\@seventies{\@tmpstrctr}% -\else -\ifnum\@strctr<9 -\@eighties{\@tmpstrctr}% -\else -\@nineties{\@tmpstrctr}% -\fi -\fi -}{% -\@tenstring{\@strctr}% -\@strctr=#1\relax \@modulo{\@strctr}{10}% -\ifnum\@strctr>0\relax - \ifnum\@strctr=1\ \@andname\ \else-\fi - \@unitstring{\@strctr}% -\fi -}% -\else -\ifnum\@strctr<10 -\ifnum\@strctr=0 -\ifnum#1<100 \@unitstring{\@strctr}\fi -\else%(>0,<10) -\@unitstring{\@strctr}% -\fi -\else%>10 -\@modulo{\@strctr}{10}% -\@teenstring{\@strctr}% -\fi +\ifnum\@strctr>19\relax + \@tmpstrctr=\@strctr + \divide\@strctr by 10\relax + \ifthenelse{\@strctr>6}{% + \@modulo{\@tmpstrctr}{10}% + \ifnum\@strctr<8\relax + \let\@@fc@numstr#2\relax + \edef#2{\@@fc@numstr\@seventies{\@tmpstrctr}}% + \else + \ifnum\@strctr<9\relax + \let\@@fc@numstr#2\relax + \edef#2{\@@fc@numstr\@eighties{\@tmpstrctr}}% + \else + \let\@@fc@numstr#2\relax + \edef#2{\@@fc@numstr\@nineties{\@tmpstrctr}}% + \fi + \fi + }{% + \let\@@fc@numstr#2\relax + \edef#2{\@@fc@numstr\@tenstring{\@strctr}}% + \@strctr=#1\relax \@modulo{\@strctr}{10}% + \ifnum\@strctr>0\relax + \let\@@fc@numstr#2\relax + \ifnum\@strctr=1\relax + \edef#2{\@@fc@numstr\ \@andname\ }% + \else + \edef#2{\@@fc@numstr-}% + \fi + \let\@@fc@numstr#2\relax + \edef#2{\@@fc@numstr\@unitstring{\@strctr}}% + \fi + }% +\else + \ifnum\@strctr<10\relax + \ifnum\@strctr=0\relax + \ifnum#1<100\relax + \let\@@fc@numstr#2\relax + \edef#2{\@@fc@numstr\@unitstring{\@strctr}}% + \fi + \else%(>0,<10) + \let\@@fc@numstr#2\relax + \edef#2{\@@fc@numstr\@unitstring{\@strctr}}% + \fi + \else%>10 + \@modulo{\@strctr}{10}% + \let\@@fc@numstr#2\relax + \edef#2{\@@fc@numstr\@teenstring{\@strctr}}% + \fi \fi } -\newcommand{\@@ordinalstringfrench}[1]{% +\newcommand*{\@@ordinalstringfrench}[2]{% \ifnum#1>99999 \PackageError{fmtcount}{Out of range}% {This macro only works for values less than 100000}% @@ -866,6 +855,7 @@ you can try typing "minus" first, and then pass the modulus of this number}% \fi \fi +\def#2{}% \@strctr=#1\relax \divide\@strctr by 1000\relax \ifnum\@strctr>9 \@tmpstrctr=\@strctr @@ -874,85 +864,137 @@ this number}% \ifthenelse{\@strctr>6}{% \@modulo{\@tmpstrctr}{10}% \ifnum\@strctr=7\relax - \@seventies{\@tmpstrctr}% + \let\@@fc@ordstr#2\relax + \edef#2{\@@fc@ordstr\@seventies{\@tmpstrctr}}% \else \ifnum\@strctr=8\relax - \@eighties{\@tmpstrctr}% + \let\@@fc@ordstr#2\relax + \edef#2{\@@fc@ordstr\@eighties{\@tmpstrctr}}% \else - \@nineties{\@tmpstrctr}% + \let\@@fc@ordstr#2\relax + \edef#2{\@@fc@ordstr\@nineties{\@tmpstrctr}}% \fi \fi }{% - \@tenstring{\@strctr}% + \let\@@fc@ordstr#2\relax + \edef#2{\@@fc@ordstr\@tenstring{\@strctr}}% \@strctr=#1\relax \divide\@strctr by 1000\relax \@modulo{\@strctr}{10}% - \ifnum\@strctr=1\ \@andname\fi - \ifnum\@strctr>0\ \@unitstring{\@strctr}\fi + \ifnum\@strctr=1\relax + \let\@@fc@ordstr#2\relax + \edef#2{\@@fc@ordstr\ \@andname}% + \fi + \ifnum\@strctr>0\relax + \let\@@fc@ordstr#2\relax + \edef#2{\@@fc@ordstr\ \@unitstring{\@strctr}}% + \fi }% \else \@strctr=#1\relax \divide\@strctr by 1000\relax \@modulo{\@strctr}{10}% - \@teenstring{\@strctr}% + \let\@@fc@ordstr#2\relax + \edef#2{\@@fc@ordstr\@teenstring{\@strctr}}% \fi \@strctr=#1\relax \@modulo{\@strctr}{1000}% - \ifnum\@strctr=0\ \@thousandth\else\ \@thousand \fi + \ifnum\@strctr=0\relax + \let\@@fc@ordstr#2\relax + \edef#2{\@@fc@ordstr\ \@thousandth}% + \else + \let\@@fc@ordstr#2\relax + \edef#2{\@@fc@ordstr\ \@thousand}% + \fi \else \ifnum\@strctr>0\relax - \@unitstring{\@strctr}% + \let\@@fc@ordstr#2\relax + \edef#2{\@@fc@ordstr\@unitstring{\@strctr}}% \@strctr=#1\relax \@modulo{\@strctr}{1000}% - \ifnum\@strctr=0\ \@thousandth\else\ \@thousand\fi + \ifnum\@strctr=0\relax + \let\@@fc@ordstr#2\relax + \edef#2{\@@fc@ordstr\ \@thousandth}% + \else + \let\@@fc@ordstr#2\relax + \edef#2{\@@fc@ordstr\ \@thousand}% + \fi \fi \fi \@strctr=#1\relax \@modulo{\@strctr}{1000}% -\divide\@strctr by 100 -\ifnum\@strctr>0 -\ifnum#1>1000 \ \fi\@unitstring{\@strctr}% -\@strctr=#1\relax \@modulo{\@strctr}{100}% -\ifnum\@strctr=0\ \@hundredth\else\ \@hundred\fi +\divide\@strctr by 100\relax +\ifnum\@strctr>0\relax + \ifnum#1>1000\relax + \let\@@fc@ordstr#2\relax + \edef#2{\@@fc@ordstr\ }% + \fi + \let\@@fc@ordstr#2\relax + \edef#2{\@@fc@ordstr\@unitstring{\@strctr}}% + \@strctr=#1\relax \@modulo{\@strctr}{100}% + \let\@@fc@ordstr#2\relax + \ifnum\@strctr=0\relax + \edef#2{\@@fc@ordstr\ \@hundredth}% + \else + \edef#2{\@@fc@ordstr\ \@hundred}% + \fi \fi \@tmpstrctr=\@strctr \@strctr=#1\relax \@modulo{\@strctr}{100}% \ifnum#1>100\relax -\ifnum\@strctr>0\ \@andname\ \fi\fi -\ifnum\@strctr>19 -\@tmpstrctr=\@strctr -\divide\@strctr by 10 -\@modulo{\@tmpstrctr}{10}% -\ifthenelse{\@strctr>6}{% -\ifnum\@strctr=7\relax -\@seventieths{\@tmpstrctr}% -\else -\ifnum\@strctr=8\relax -\@eightieths{\@tmpstrctr}% -\else -\@ninetieths{\@tmpstrctr}% -\fi -\fi -}{% -\ifnum\@tmpstrctr=0\relax - \@tenthstring{\@strctr}% -\else - \@tenstring{\@strctr}% -\fi -\@strctr=#1\relax \@modulo{\@strctr}{10}% -\ifnum\@strctr=1\ \@andname\fi -\ifnum\@strctr>0 -\ \@unitthstring{\@strctr}% -\fi -}% -\else -\ifnum\@strctr<10 -\ifnum\@strctr=0 -\ifnum#1<100 \@unitthstring{\@strctr}\fi -\else -\@unitthstring{\@strctr}% -\fi -\else -\@modulo{\@strctr}{10}% -\@teenthstring{\@strctr}% + \ifnum\@strctr>0\relax + \let\@@fc@ordstr#2\relax + \edef#2{\@@fc@ordstr\ \@andname\ }% + \fi \fi +\ifnum\@strctr>19\relax + \@tmpstrctr=\@strctr + \divide\@strctr by 10\relax + \@modulo{\@tmpstrctr}{10}% + \ifthenelse{\@strctr>6}{% + \ifnum\@strctr=7\relax + \let\@@fc@ordstr#2\relax + \edef#2{\@@fc@ordstr\@seventieths{\@tmpstrctr}}% + \else + \ifnum\@strctr=8\relax + \let\@@fc@ordstr#2\relax + \edef#2{\@@fc@ordstr\@eightieths{\@tmpstrctr}}% + \else + \let\@@fc@ordstr#2\relax + \edef#2{\@@fc@ordstr\@ninetieths{\@tmpstrctr}}% + \fi + \fi + }{% + \ifnum\@tmpstrctr=0\relax + \let\@@fc@ordstr#2\relax + \edef#2{\@@fc@ordstr\@tenthstring{\@strctr}}% + \else + \let\@@fc@ordstr#2\relax + \edef#2{\@@fc@ordstr\@tenstring{\@strctr}}% + \fi + \@strctr=#1\relax \@modulo{\@strctr}{10}% + \ifnum\@strctr=1\relax + \let\@@fc@ordstr#2\relax + \edef#2{\@@fc@ordstr\ \@andname}% + \fi + \ifnum\@strctr>0\relax + \let\@@fc@ordstr#2\relax + \edef#2{\@@fc@ordstr\ \@unitthstring{\@strctr}}% + \fi + }% +\else + \ifnum\@strctr<10\relax + \ifnum\@strctr=0\relax + \ifnum#1<100\relax + \let\@@fc@ordstr#2\relax + \edef#2{\@@fc@ordstr\@unitthstring{\@strctr}}% + \fi + \else + \let\@@fc@ordstr#2\relax + \edef#2{\@@fc@ordstr\@unitthstring{\@strctr}}% + \fi + \else + \@modulo{\@strctr}{10}% + \let\@@fc@ordstr#2\relax + \edef#2{\@@fc@ordstr\@teenthstring{\@strctr}}% + \fi \fi } \endinput diff --git a/Master/texmf-dist/tex/latex/fmtcount/fc-portuges.def b/Master/texmf-dist/tex/latex/fmtcount/fc-portuges.def index 8a18ff3a74d..7f77a013c15 100644 --- a/Master/texmf-dist/tex/latex/fmtcount/fc-portuges.def +++ b/Master/texmf-dist/tex/latex/fmtcount/fc-portuges.def @@ -26,13 +26,25 @@ %% Right bracket \] Circumflex \^ Underscore \_ %% Grave accent \` Left brace \{ Vertical bar \| %% Right brace \} Tilde \~} -\ProvidesFile{fc-portuges.def}[2005/04/29] -\newcommand{\@@unitstringportuges}[1]{% +\ProvidesFile{fc-portuges.def}[2007/04/20] +\newcommand*{\@ordinalMportuges}[2]{% +\ifnum#1=0\relax + \edef#2{\number#1}% +\else + \edef#2{\number#1\relax\noexpand\fmtord{o}}% +\fi} +\newcommand*{\@ordinalFportuges}[2]{% +\ifnum#1=0\relax + \edef#2{\number#1}% +\else + \edef#2{\number#1\relax\noexpand\fmtord{a}}% +\fi} +\newcommand*{\@@unitstringportuges}[1]{% \ifcase#1\relax zero% \or um% \or dois% -\or tr\`es% +\or tr\^es% \or quatro% \or cinco% \or seis% @@ -41,13 +53,12 @@ zero% \or nove% \fi } - -\newcommand{\@@unitstringFportuges}[1]{% +\newcommand*{\@@unitstringFportuges}[1]{% \ifcase#1\relax zero% \or uma% \or duas% -\or tr\`es% +\or tr\^es% \or quatro% \or cinco% \or seis% @@ -56,8 +67,7 @@ zero% \or nove% \fi } - -\newcommand{\@@tenstringportuges}[1]{% +\newcommand*{\@@tenstringportuges}[1]{% \ifcase#1\relax \or dez% \or vinte% @@ -71,8 +81,7 @@ zero% \or cem% \fi } - -\newcommand{\@@teenstringportuges}[1]{% +\newcommand*{\@@teenstringportuges}[1]{% \ifcase#1\relax dez% \or onze% @@ -86,8 +95,7 @@ dez% \or dezenove% \fi } - -\newcommand{\@@hundredstringportuges}[1]{% +\newcommand*{\@@hundredstringportuges}[1]{% \ifcase#1\relax \or cento% \or duzentos% @@ -99,10 +107,9 @@ dez% \or oitocentos% \or novecentos% \fi} - -\newcommand{\@@hundredstringFportuges}[1]{% +\newcommand*{\@@hundredstringFportuges}[1]{% \ifcase#1\relax -\or centa% +\or cento% \or duzentas% \or trezentas% \or quatrocentas% @@ -112,13 +119,12 @@ dez% \or oitocentas% \or novecentas% \fi} - -\newcommand{\@@Unitstringportuges}[1]{% +\newcommand*{\@@Unitstringportuges}[1]{% \ifcase#1\relax Zero% \or Um% \or Dois% -\or Tr\`es% +\or Tr\^es% \or Quatro% \or Cinco% \or Seis% @@ -127,13 +133,12 @@ Zero% \or Nove% \fi } - -\newcommand{\@@UnitstringFportuges}[1]{% +\newcommand*{\@@UnitstringFportuges}[1]{% \ifcase#1\relax Zera% \or Uma% \or Duas% -\or Tr\`es% +\or Tr\^es% \or Quatro% \or Cinco% \or Seis% @@ -142,8 +147,7 @@ Zera% \or Nove% \fi } - -\newcommand{\@@Tenstringportuges}[1]{% +\newcommand*{\@@Tenstringportuges}[1]{% \ifcase#1\relax \or Dez% \or Vinte% @@ -157,8 +161,7 @@ Zera% \or Cem% \fi } - -\newcommand{\@@Teenstringportuges}[1]{% +\newcommand*{\@@Teenstringportuges}[1]{% \ifcase#1\relax Dez% \or Onze% @@ -172,8 +175,7 @@ Dez% \or Dezenove% \fi } - -\newcommand{\@@Hundredstringportuges}[1]{% +\newcommand*{\@@Hundredstringportuges}[1]{% \ifcase#1\relax \or Cento% \or Duzentos% @@ -185,10 +187,9 @@ Dez% \or Oitocentos% \or Novecentos% \fi} - -\newcommand{\@@HundredstringFportuges}[1]{% +\newcommand*{\@@HundredstringFportuges}[1]{% \ifcase#1\relax -\or Centa% +\or Cento% \or Duzentas% \or Trezentas% \or Quatrocentas% @@ -198,85 +199,71 @@ Dez% \or Oitocentas% \or Novecentas% \fi} - -\newcommand{\@numberstringMportuges}[1]{% +\DeclareRobustCommand{\@numberstringMportuges}[2]{% \let\@unitstring=\@@unitstringportuges \let\@teenstring=\@@teenstringportuges \let\@tenstring=\@@tenstringportuges \let\@hundredstring=\@@hundredstringportuges \def\@hundred{cem}\def\@thousand{mil}% \def\@andname{e}% -\@@numberstringportuges{#1}} - -\newcommand{\@numberstringFportuges}[1]{% +\@@numberstringportuges{#1}{#2}} +\DeclareRobustCommand{\@numberstringFportuges}[2]{% \let\@unitstring=\@@unitstringFportuges \let\@teenstring=\@@teenstringportuges \let\@tenstring=\@@tenstringportuges \let\@hundredstring=\@@hundredstringFportuges \def\@hundred{cem}\def\@thousand{mil}% \def\@andname{e}% -\@@numberstringportuges{#1}} - -\newcommand{\@NumberstringMportuges}[1]{% +\@@numberstringportuges{#1}{#2}} +\DeclareRobustCommand{\@NumberstringMportuges}[2]{% \let\@unitstring=\@@Unitstringportuges \let\@teenstring=\@@Teenstringportuges \let\@tenstring=\@@Tenstringportuges \let\@hundredstring=\@@Hundredstringportuges \def\@hundred{Cem}\def\@thousand{Mil}% \def\@andname{e}% -\@@numberstringportuges{#1}} - -\newcommand{\@NumberstringFportuges}[1]{% +\@@numberstringportuges{#1}{#2}} +\DeclareRobustCommand{\@NumberstringFportuges}[2]{% \let\@unitstring=\@@UnitstringFportuges \let\@teenstring=\@@Teenstringportuges \let\@tenstring=\@@Tenstringportuges \let\@hundredstring=\@@HundredstringFportuges \def\@hundred{Cem}\def\@thousand{Mil}% \def\@andname{e}% -\@@numberstringportuges{#1}} - -\newcommand{\@ordinalstringMportuges}[1]{% +\@@numberstringportuges{#1}{#2}} +\DeclareRobustCommand{\@ordinalstringMportuges}[2]{% \let\@unitthstring=\@@unitthstringportuges \let\@unitstring=\@@unitstringportuges \let\@teenthstring=\@@teenthstringportuges \let\@tenthstring=\@@tenthstringportuges \let\@hundredthstring=\@@hundredthstringportuges \def\@thousandth{mil\'esimo}% -\@@ordinalstringportuges{#1}} - -\newcommand{\@ordinalstringFportuges}[1]{% +\@@ordinalstringportuges{#1}{#2}} +\DeclareRobustCommand{\@ordinalstringFportuges}[2]{% \let\@unitthstring=\@@unitthstringFportuges \let\@unitstring=\@@unitstringFportuges \let\@teenthstring=\@@teenthstringportuges \let\@tenthstring=\@@tenthstringFportuges \let\@hundredthstring=\@@hundredthstringFportuges \def\@thousandth{mil\'esima}% -\@@ordinalstringportuges{#1}} - -\newcommand{\@OrdinalstringMportuges}[1]{% +\@@ordinalstringportuges{#1}{#2}} +\DeclareRobustCommand{\@OrdinalstringMportuges}[2]{% \let\@unitthstring=\@@Unitthstringportuges \let\@unitstring=\@@Unitstringportuges \let\@teenthstring=\@@teenthstringportuges \let\@tenthstring=\@@Tenthstringportuges \let\@hundredthstring=\@@Hundredthstringportuges \def\@thousandth{Mil\'esimo}% -\@@ordinalstringportuges{#1}} - -\newcommand{\@OrdinalstringFportuges}[1]{% +\@@ordinalstringportuges{#1}{#2}} +\DeclareRobustCommand{\@OrdinalstringFportuges}[2]{% \let\@unitthstring=\@@UnitthstringFportuges \let\@unitstring=\@@UnitstringFportuges \let\@teenthstring=\@@teenthstringportuges \let\@tenthstring=\@@TenthstringFportuges \let\@hundredthstring=\@@HundredthstringFportuges \def\@thousandth{Mil\'esima}% -\@@ordinalstringportuges{#1}} - -\newcommand{\@ordinalMportuges}[1]{% -#1\ifnum#1=0\else\fmtord{o}\fi} -\newcommand{\@ordinalFportuges}[1]{% -#1\ifnum#1=0\else\fmtord{a}\fi} - -\newcommand{\@@unitthstringportuges}[1]{% +\@@ordinalstringportuges{#1}{#2}} +\newcommand*{\@@unitthstringportuges}[1]{% \ifcase#1\relax zero% \or primeiro% @@ -290,8 +277,7 @@ zero% \or nono% \fi } - -\newcommand{\@@tenthstringportuges}[1]{% +\newcommand*{\@@tenthstringportuges}[1]{% \ifcase#1\relax \or d\'ecimo% \or vig\'esimo% @@ -304,14 +290,12 @@ zero% \or nonag\'esimo% \fi } - -\newcommand{\@@teenthstringportuges}[1]{% +\newcommand*{\@@teenthstringportuges}[1]{% \@tenthstring{1}% \ifnum#1>0\relax -\@unitthstring{#1}% \fi} - -\newcommand{\@@hundredthstringportuges}[1]{% +\newcommand*{\@@hundredthstringportuges}[1]{% \ifcase#1\relax \or cent\'esimo% \or ducent\'esimo% @@ -323,8 +307,7 @@ zero% \or octingent\'esimo% \or nongent\'esimo% \fi} - -\newcommand{\@@unitthstringFportuges}[1]{% +\newcommand*{\@@unitthstringFportuges}[1]{% \ifcase#1\relax zero% \or primeira% @@ -338,8 +321,7 @@ zero% \or nona% \fi } - -\newcommand{\@@tenthstringFportuges}[1]{% +\newcommand*{\@@tenthstringFportuges}[1]{% \ifcase#1\relax \or d\'ecima% \or vig\'esima% @@ -352,8 +334,7 @@ zero% \or nonag\'esima% \fi } - -\newcommand{\@@hundredthstringFportuges}[1]{% +\newcommand*{\@@hundredthstringFportuges}[1]{% \ifcase#1\relax \or cent\'esima% \or ducent\'esima% @@ -365,8 +346,7 @@ zero% \or octingent\'esima% \or nongent\'esima% \fi} - -\newcommand{\@@Unitthstringportuges}[1]{% +\newcommand*{\@@Unitthstringportuges}[1]{% \ifcase#1\relax Zero% \or Primeiro% @@ -380,8 +360,7 @@ Zero% \or Nono% \fi } - -\newcommand{\@@Tenthstringportuges}[1]{% +\newcommand*{\@@Tenthstringportuges}[1]{% \ifcase#1\relax \or D\'ecimo% \or Vig\'esimo% @@ -394,8 +373,7 @@ Zero% \or Nonag\'esimo% \fi } - -\newcommand{\@@Hundredthstringportuges}[1]{% +\newcommand*{\@@Hundredthstringportuges}[1]{% \ifcase#1\relax \or Cent\'esimo% \or Ducent\'esimo% @@ -407,8 +385,7 @@ Zero% \or Octingent\'esimo% \or Nongent\'esimo% \fi} - -\newcommand{\@@UnitthstringFportuges}[1]{% +\newcommand*{\@@UnitthstringFportuges}[1]{% \ifcase#1\relax Zera% \or Primeira% @@ -422,8 +399,7 @@ Zera% \or Nona% \fi } - -\newcommand{\@@TenthstringFportuges}[1]{% +\newcommand*{\@@TenthstringFportuges}[1]{% \ifcase#1\relax \or D\'ecima% \or Vig\'esima% @@ -436,8 +412,7 @@ Zera% \or Nonag\'esima% \fi } - -\newcommand{\@@HundredthstringFportuges}[1]{% +\newcommand*{\@@HundredthstringFportuges}[1]{% \ifcase#1\relax \or Cent\'esima% \or Ducent\'esima% @@ -449,7 +424,7 @@ Zera% \or Octingent\'esima% \or Nongent\'esima% \fi} -\newcommand{\@@numberstringportuges}[1]{% +\newcommand*{\@@numberstringportuges}[2]{% \ifnum#1>99999 \PackageError{fmtcount}{Out of range}% {This macro only works for values less than 100000}% @@ -461,63 +436,102 @@ you can try typing "minus" first, and then pass the modulus of this number}% \fi \fi +\def#2{}% \@strctr=#1\relax \divide\@strctr by 1000\relax \ifnum\@strctr>9 \divide\@strctr by 10 - \ifnum\@strctr>1 - \@tenstring{\@strctr}% + \ifnum\@strctr>1\relax + \let\@@fc@numstr#2\relax + \edef#2{\@@fc@numstr\@tenstring{\@strctr}}% \@strctr=#1 \divide\@strctr by 1000\relax \@modulo{\@strctr}{10}% \ifnum\@strctr>0 - \ifnum\@strctr=1\ \@andname\fi - \ \@unitstring{\@strctr}% + \ifnum\@strctr=1\relax + \let\@@fc@numstr#2\relax + \edef#2{\@@fc@numstr\ \@andname}% + \fi + \let\@@fc@numstr#2\relax + \edef#2{\@@fc@numstr\ \@unitstring{\@strctr}}% \fi \else \@strctr=#1\relax \divide\@strctr by 1000\relax \@modulo{\@strctr}{10}% - \@teenstring{\@strctr}% + \let\@@fc@numstr#2\relax + \edef#2{\@@fc@numstr\@teenstring{\@strctr}}% \fi - \ \@thousand% + \let\@@fc@numstr#2\relax + \edef#2{\@@fc@numstr\ \@thousand}% \else - \ifnum\@strctr>0 - \ifnum\@strctr>1\@unitstring{\@strctr}\ \fi - \@thousand + \ifnum\@strctr>0\relax + \ifnum\@strctr>1\relax + \let\@@fc@numstr#2\relax + \edef#2{\@@fc@numstr\@unitstring{\@strctr}\ }% + \fi + \let\@@fc@numstr#2\relax + \edef#2{\@@fc@numstr\@thousand}% \fi \fi \@strctr=#1\relax \@modulo{\@strctr}{1000}% -\divide\@strctr by 100 -\ifnum\@strctr>0 -\ifnum#1>1000 \ \fi -\@tmpstrctr=#1\relax -\@modulo{\@tmpstrctr}{1000}% -\ifnum\@tmpstrctr=100\@tenstring{10}\else\@hundredstring{\@strctr}\fi% +\divide\@strctr by 100\relax +\ifnum\@strctr>0\relax + \ifnum#1>1000 \relax + \let\@@fc@numstr#2\relax + \edef#2{\@@fc@numstr\ }% + \fi + \@tmpstrctr=#1\relax + \@modulo{\@tmpstrctr}{1000}% + \let\@@fc@numstr#2\relax + \ifnum\@tmpstrctr=100\relax + \edef#2{\@@fc@numstr\@tenstring{10}}% + \else + \edef#2{\@@fc@numstr\@hundredstring{\@strctr}}% + \fi% \fi \@strctr=#1\relax \@modulo{\@strctr}{100}% -\ifnum#1>100 \ifnum\@strctr>0\ \@andname\ \fi\fi -\ifnum\@strctr>19 -\divide\@strctr by 10 -\@tenstring{\@strctr}% -\@strctr=#1\relax \@modulo{\@strctr}{10}% -\ifnum\@strctr>0 -\ifnum\@strctr=1\ \@andname\else\ifnum#1>100\ \@andname\fi\fi -\ \@unitstring{\@strctr}% +\ifnum#1>100\relax + \ifnum\@strctr>0\relax + \let\@@fc@numstr#2\relax + \edef#2{\@@fc@numstr\ \@andname\ }% + \fi \fi +\ifnum\@strctr>19\relax + \divide\@strctr by 10\relax + \let\@@fc@numstr#2\relax + \edef#2{\@@fc@numstr\@tenstring{\@strctr}}% + \@strctr=#1\relax \@modulo{\@strctr}{10}% + \ifnum\@strctr>0 + \ifnum\@strctr=1\relax + \let\@@fc@numstr#2\relax + \edef#2{\@@fc@numstr\ \@andname}% + \else + \ifnum#1>100\relax + \let\@@fc@numstr#2\relax + \edef#2{\@@fc@numstr\ \@andname}% + \fi + \fi + \let\@@fc@numstr#2\relax + \edef#2{\@@fc@numstr\ \@unitstring{\@strctr}}% + \fi \else -\ifnum\@strctr<10 -\ifnum\@strctr=0 -\ifnum#1<100 \@unitstring{\@strctr}\fi -\else%(>0,<10) -\@unitstring{\@strctr}% -\fi -\else%>10 -\@modulo{\@strctr}{10}% -\@teenstring{\@strctr}% -\fi + \ifnum\@strctr<10\relax + \ifnum\@strctr=0\relax + \ifnum#1<100\relax + \let\@@fc@numstr#2\relax + \edef#2{\@@fc@numstr\@unitstring{\@strctr}}% + \fi + \else%(>0,<10) + \let\@@fc@numstr#2\relax + \edef#2{\@@fc@numstr\@unitstring{\@strctr}}% + \fi + \else%>10 + \@modulo{\@strctr}{10}% + \let\@@fc@numstr#2\relax + \edef#2{\@@fc@numstr\@teenstring{\@strctr}}% + \fi \fi } - -\newcommand{\@@ordinalstringportuges}[1]{% +\newcommand*{\@@ordinalstringportuges}[2]{% \@strctr=#1\relax \ifnum#1>99999 \PackageError{fmtcount}{Out of range}% @@ -529,6 +543,7 @@ this number}% you can try typing "minus" first, and then pass the modulus of this number}% \else +\def#2{}% \ifnum\@strctr>999\relax \divide\@strctr by 1000\relax \ifnum\@strctr>1\relax @@ -536,43 +551,67 @@ this number}% \@tmpstrctr=\@strctr \ifnum\@strctr<20 \@modulo{\@tmpstrctr}{10}% - \@teenthstring{\@tmpstrctr} + \let\@@fc@ordstr#2\relax + \edef#2{\@@fc@ordstr\@teenthstring{\@tmpstrctr}}% \else \divide\@tmpstrctr by 10\relax - \@tenthstring{\@tmpstrctr} + \let\@@fc@ordstr#2\relax + \edef#2{\@@fc@ordstr\@tenthstring{\@tmpstrctr}}% \@tmpstrctr=\@strctr \@modulo{\@tmpstrctr}{10}% - \ifnum\@tmpstrctr>0\@unitthstring{\@tmpstrctr} \fi + \ifnum\@tmpstrctr>0\relax + \let\@@fc@ordstr#2\relax + \edef#2{\@@fc@ordstr\@unitthstring{\@tmpstrctr}}% + \fi \fi \else - \@unitstring{\@strctr} + \let\@@fc@ordstr#2\relax + \edef#2{\@@fc@ordstr\@unitstring{\@strctr}}% \fi \fi - \@thousandth + \let\@@fc@ordstr#2\relax + \edef#2{\@@fc@ordstr\@thousandth}% \fi \@strctr=#1\relax \@modulo{\@strctr}{1000}% \ifnum\@strctr>99\relax -\@tmpstrctr=\@strctr -\divide\@tmpstrctr by 100\relax -\ifnum#1>1000-\fi -\@hundredthstring{\@tmpstrctr}% + \@tmpstrctr=\@strctr + \divide\@tmpstrctr by 100\relax + \ifnum#1>1000\relax + \let\@@fc@ordstr#2\relax + \edef#2{\@@fc@ordstr-}% + \fi + \let\@@fc@ordstr#2\relax + \edef#2{\@@fc@ordstr\@hundredthstring{\@tmpstrctr}}% \fi \@modulo{\@strctr}{100}% -\ifnum#1>99\ifnum\@strctr>0-\fi\fi +\ifnum#1>99\relax + \ifnum\@strctr>0\relax + \let\@@fc@ordstr#2\relax + \edef#2{\@@fc@ordstr-}% + \fi +\fi \ifnum\@strctr>9\relax -\@tmpstrctr=\@strctr -\divide\@tmpstrctr by 10\relax -\@tenthstring{\@tmpstrctr}% -\@tmpstrctr=\@strctr -\@modulo{\@tmpstrctr}{10}% -\ifnum\@tmpstrctr>0-\@unitthstring{\@tmpstrctr}\fi -\else -\ifnum\@strctr=0\relax -\ifnum#1=0\@unitstring{0}\fi + \@tmpstrctr=\@strctr + \divide\@tmpstrctr by 10\relax + \let\@@fc@ordstr#2\relax + \edef#2{\@@fc@ordstr\@tenthstring{\@tmpstrctr}}% + \@tmpstrctr=\@strctr + \@modulo{\@tmpstrctr}{10}% + \ifnum\@tmpstrctr>0\relax + \let\@@fc@ordstr#2\relax + \edef#2{\@@fc@ordstr-\@unitthstring{\@tmpstrctr}}% + \fi \else -\@unitthstring{\@strctr}% -\fi + \ifnum\@strctr=0\relax + \ifnum#1=0\relax + \let\@@fc@ordstr#2\relax + \edef#2{\@@fc@ordstr\@unitstring{0}}% + \fi + \else + \let\@@fc@ordstr#2\relax + \edef#2{\@@fc@ordstr\@unitthstring{\@strctr}}% + \fi \fi \fi \fi diff --git a/Master/texmf-dist/tex/latex/fmtcount/fc-spanish.def b/Master/texmf-dist/tex/latex/fmtcount/fc-spanish.def index b0315393ae2..04ac0992327 100644 --- a/Master/texmf-dist/tex/latex/fmtcount/fc-spanish.def +++ b/Master/texmf-dist/tex/latex/fmtcount/fc-spanish.def @@ -26,7 +26,11 @@ %% Right bracket \] Circumflex \^ Underscore \_ %% Grave accent \` Left brace \{ Vertical bar \| %% Right brace \} Tilde \~} -\ProvidesFile{fc-spanish.def}[2005/04/29] +\ProvidesFile{fc-spanish.def}[2007/04/20] +\newcommand{\@ordinalMspanish}[2]{% +\edef#2{\number#1\relax\noexpand\fmtord{o}}} +\newcommand{\@ordinalFspanish}[2]{% +\edef#2{\number#1\relax\noexpand\fmtord{a}}} \newcommand{\@@unitstringspanish}[1]{% \ifcase#1\relax cero% @@ -41,7 +45,6 @@ cero% \or nueve% \fi } - \newcommand{\@@unitstringFspanish}[1]{% \ifcase#1\relax cera% @@ -56,7 +59,6 @@ cera% \or nueve% \fi } - \newcommand{\@@tenstringspanish}[1]{% \ifcase#1\relax \or diez% @@ -71,7 +73,6 @@ cera% \or cien% \fi } - \newcommand{\@@teenstringspanish}[1]{% \ifcase#1\relax diez% @@ -86,7 +87,6 @@ diez% \or diecinueve% \fi } - \newcommand{\@@twentystringspanish}[1]{% \ifcase#1\relax veinte% @@ -100,7 +100,6 @@ veinte% \or veintiocho% \or veintinueve% \fi} - \newcommand{\@@twentystringFspanish}[1]{% \ifcase#1\relax veinte% @@ -114,7 +113,6 @@ veinte% \or veintiocho% \or veintinueve% \fi} - \newcommand{\@@hundredstringspanish}[1]{% \ifcase#1\relax \or ciento% @@ -127,7 +125,6 @@ veinte% \or ochocientos% \or novecientos% \fi} - \newcommand{\@@hundredstringFspanish}[1]{% \ifcase#1\relax \or cienta% @@ -140,7 +137,6 @@ veinte% \or ochocientas% \or novecientas% \fi} - \newcommand{\@@Unitstringspanish}[1]{% \ifcase#1\relax Cero% @@ -155,7 +151,6 @@ Cero% \or Nueve% \fi } - \newcommand{\@@UnitstringFspanish}[1]{% \ifcase#1\relax Cera% @@ -170,7 +165,6 @@ Cera% \or Nueve% \fi } - \newcommand{\@@Tenstringspanish}[1]{% \ifcase#1\relax \or Diez% @@ -185,7 +179,6 @@ Cera% \or Cien% \fi } - \newcommand{\@@Teenstringspanish}[1]{% \ifcase#1\relax Diez% @@ -200,7 +193,6 @@ Diez% \or Diecinueve% \fi } - \newcommand{\@@Twentystringspanish}[1]{% \ifcase#1\relax Veinte% @@ -214,7 +206,6 @@ Veinte% \or Veintiocho% \or Veintinueve% \fi} - \newcommand{\@@TwentystringFspanish}[1]{% \ifcase#1\relax Veinte% @@ -228,7 +219,6 @@ Veinte% \or Veintiocho% \or Veintinueve% \fi} - \newcommand{\@@Hundredstringspanish}[1]{% \ifcase#1\relax \or Ciento% @@ -241,7 +231,6 @@ Veinte% \or Ochocientos% \or Novecientos% \fi} - \newcommand{\@@HundredstringFspanish}[1]{% \ifcase#1\relax \or Cienta% @@ -254,8 +243,7 @@ Veinte% \or Ochocientas% \or Novecientas% \fi} - -\newcommand{\@numberstringMspanish}[1]{% +\DeclareRobustCommand{\@numberstringMspanish}[2]{% \let\@unitstring=\@@unitstringspanish \let\@teenstring=\@@teenstringspanish \let\@tenstring=\@@tenstringspanish @@ -263,9 +251,8 @@ Veinte% \let\@hundredstring=\@@hundredstringspanish \def\@hundred{cien}\def\@thousand{mil}% \def\@andname{y}% -\@@numberstringspanish{#1}} - -\newcommand{\@numberstringFspanish}[1]{% +\@@numberstringspanish{#1}{#2}} +\DeclareRobustCommand{\@numberstringFspanish}[2]{% \let\@unitstring=\@@unitstringFspanish \let\@teenstring=\@@teenstringspanish \let\@tenstring=\@@tenstringspanish @@ -273,9 +260,8 @@ Veinte% \let\@hundredstring=\@@hundredstringFspanish \def\@hundred{cien}\def\@thousand{mil}% \def\@andname{y}% -\@@numberstringspanish{#1}} - -\newcommand{\@NumberstringMspanish}[1]{% +\@@numberstringspanish{#1}{#2}} +\DeclareRobustCommand{\@NumberstringMspanish}[2]{% \let\@unitstring=\@@Unitstringspanish \let\@teenstring=\@@Teenstringspanish \let\@tenstring=\@@Tenstringspanish @@ -283,9 +269,8 @@ Veinte% \let\@hundredstring=\@@Hundredstringspanish \def\@andname{y}% \def\@hundred{Cien}\def\@thousand{Mil}% -\@@numberstringspanish{#1}} - -\newcommand{\@NumberstringFspanish}[1]{% +\@@numberstringspanish{#1}{#2}} +\DeclareRobustCommand{\@NumberstringFspanish}[2]{% \let\@unitstring=\@@UnitstringFspanish \let\@teenstring=\@@Teenstringspanish \let\@tenstring=\@@Tenstringspanish @@ -293,47 +278,39 @@ Veinte% \let\@hundredstring=\@@HundredstringFspanish \def\@andname{y}% \def\@hundred{Cien}\def\@thousand{Mil}% -\@@numberstringspanish{#1}} - -\newcommand{\@ordinalstringMspanish}[1]{% +\@@numberstringspanish{#1}{#2}} +\DeclareRobustCommand{\@ordinalstringMspanish}[2]{% \let\@unitthstring=\@@unitthstringspanish \let\@unitstring=\@@unitstringspanish \let\@teenthstring=\@@teenthstringspanish \let\@tenthstring=\@@tenthstringspanish \let\@hundredthstring=\@@hundredthstringspanish \def\@thousandth{mil\'esimo}% -\@@ordinalstringspanish{#1}} - -\newcommand{\@ordinalstringFspanish}[1]{% +\@@ordinalstringspanish{#1}{#2}} +\DeclareRobustCommand{\@ordinalstringFspanish}[2]{% \let\@unitthstring=\@@unitthstringFspanish \let\@unitstring=\@@unitstringFspanish \let\@teenthstring=\@@teenthstringFspanish \let\@tenthstring=\@@tenthstringFspanish \let\@hundredthstring=\@@hundredthstringFspanish \def\@thousandth{mil\'esima}% -\@@ordinalstringspanish{#1}} - -\newcommand{\@OrdinalstringMspanish}[1]{% +\@@ordinalstringspanish{#1}{#2}} +\DeclareRobustCommand{\@OrdinalstringMspanish}[2]{% \let\@unitthstring=\@@Unitthstringspanish \let\@unitstring=\@@Unitstringspanish \let\@teenthstring=\@@Teenthstringspanish \let\@tenthstring=\@@Tenthstringspanish \let\@hundredthstring=\@@Hundredthstringspanish \def\@thousandth{Mil\'esimo}% -\@@ordinalstringspanish{#1}} - -\newcommand{\@OrdinalstringFspanish}[1]{% +\@@ordinalstringspanish{#1}{#2}} +\DeclareRobustCommand{\@OrdinalstringFspanish}[2]{% \let\@unitthstring=\@@UnitthstringFspanish \let\@unitstring=\@@UnitstringFspanish \let\@teenthstring=\@@TeenthstringFspanish \let\@tenthstring=\@@TenthstringFspanish \let\@hundredthstring=\@@HundredthstringFspanish \def\@thousandth{Mil\'esima}% -\@@ordinalstringspanish{#1}} - -\newcommand{\@ordinalMspanish}[1]{#1\fmtord{o}} -\newcommand{\@ordinalFspanish}[1]{#1\fmtord{a}} - +\@@ordinalstringspanish{#1}{#2}} \newcommand{\@@unitthstringspanish}[1]{% \ifcase#1\relax cero% @@ -348,7 +325,6 @@ cero% \or noveno% \fi } - \newcommand{\@@tenthstringspanish}[1]{% \ifcase#1\relax \or d\'ecimo% @@ -362,7 +338,6 @@ cero% \or nonag\'esimo% \fi } - \newcommand{\@@teenthstringspanish}[1]{% \ifcase#1\relax d\'ecimo% @@ -377,7 +352,6 @@ d\'ecimo% \or decimonoveno% \fi } - \newcommand{\@@hundredthstringspanish}[1]{% \ifcase#1\relax \or cent\'esimo% @@ -390,7 +364,6 @@ d\'ecimo% \or octingent\'esimo% \or noningent\'esimo% \fi} - \newcommand{\@@unitthstringFspanish}[1]{% \ifcase#1\relax cera% @@ -405,7 +378,6 @@ cera% \or novena% \fi } - \newcommand{\@@tenthstringFspanish}[1]{% \ifcase#1\relax \or d\'ecima% @@ -419,7 +391,6 @@ cera% \or nonag\'esima% \fi } - \newcommand{\@@teenthstringFspanish}[1]{% \ifcase#1\relax d\'ecima% @@ -434,7 +405,6 @@ d\'ecima% \or decimonovena% \fi } - \newcommand{\@@hundredthstringFspanish}[1]{% \ifcase#1\relax \or cent\'esima% @@ -447,7 +417,6 @@ d\'ecima% \or octingent\'esima% \or noningent\'esima% \fi} - \newcommand{\@@Unitthstringspanish}[1]{% \ifcase#1\relax Cero% @@ -462,7 +431,6 @@ Cero% \or Noveno% \fi } - \newcommand{\@@Tenthstringspanish}[1]{% \ifcase#1\relax \or D\'ecimo% @@ -476,7 +444,6 @@ Cero% \or Nonag\'esimo% \fi } - \newcommand{\@@Teenthstringspanish}[1]{% \ifcase#1\relax D\'ecimo% @@ -491,7 +458,6 @@ D\'ecimo% \or Decimonoveno% \fi } - \newcommand{\@@Hundredthstringspanish}[1]{% \ifcase#1\relax \or Cent\'esimo% @@ -504,7 +470,6 @@ D\'ecimo% \or Octingent\'esimo% \or Noningent\'esimo% \fi} - \newcommand{\@@UnitthstringFspanish}[1]{% \ifcase#1\relax Cera% @@ -519,7 +484,6 @@ Cera% \or Novena% \fi } - \newcommand{\@@TenthstringFspanish}[1]{% \ifcase#1\relax \or D\'ecima% @@ -533,7 +497,6 @@ Cera% \or Nonag\'esima% \fi } - \newcommand{\@@TeenthstringFspanish}[1]{% \ifcase#1\relax D\'ecima% @@ -548,7 +511,6 @@ D\'ecima% \or Decimonovena% \fi } - \newcommand{\@@HundredthstringFspanish}[1]{% \ifcase#1\relax \or Cent\'esima% @@ -562,7 +524,7 @@ D\'ecima% \or Noningent\'esima% \fi} -\newcommand{\@@numberstringspanish}[1]{% +\newcommand{\@@numberstringspanish}[2]{% \ifnum#1>99999 \PackageError{fmtcount}{Out of range}% {This macro only works for values less than 100000}% @@ -574,64 +536,96 @@ you can try typing "minus" first, and then pass the modulus of this number}% \fi \fi +\def#2{}% \@strctr=#1\relax \divide\@strctr by 1000\relax \ifnum\@strctr>9 \divide\@strctr by 10 \ifnum\@strctr>1 - \@tenstring{\@strctr}% + \let\@@fc@numstr#2\relax + \edef#2{\@@fc@numstr\@tenstring{\@strctr}}% \@strctr=#1 \divide\@strctr by 1000\relax \@modulo{\@strctr}{10}% - \ifnum\@strctr>0\ \@andname\ \@unitstring{\@strctr}\fi + \ifnum\@strctr>0\relax + \let\@@fc@numstr#2\relax + \edef#2{\@@fc@numstr\ \@andname\ \@unitstring{\@strctr}}% + \fi \else \@strctr=#1\relax \divide\@strctr by 1000\relax \@modulo{\@strctr}{10}% - \@teenstring{\@strctr}% + \let\@@fc@numstr#2\relax + \edef#2{\@@fc@numstr\@teenstring{\@strctr}}% \fi - \ \@thousand% + \let\@@fc@numstr#2\relax + \edef#2{\@@fc@numstr\ \@thousand}% \else - \ifnum\@strctr>0 - \ifnum\@strctr>1\@unitstring{\@strctr}\ \fi - \@thousand + \ifnum\@strctr>0\relax + \ifnum\@strctr>1\relax + \let\@@fc@numstr#2\relax + \edef#2{\@@fc@numstr\@unitstring{\@strctr}\ }% + \fi + \let\@@fc@numstr#2\relax + \edef#2{\@@fc@numstr\@thousand}% \fi \fi \@strctr=#1\relax \@modulo{\@strctr}{1000}% -\divide\@strctr by 100 -\ifnum\@strctr>0 -\ifnum#1>1000\ \fi -\@tmpstrctr=#1\relax -\@modulo{\@tmpstrctr}{1000}% -\ifnum\@tmpstrctr=100\@tenstring{10}\else\@hundredstring{\@strctr}\fi% +\divide\@strctr by 100\relax +\ifnum\@strctr>0\relax + \ifnum#1>1000\relax + \let\@@fc@numstr#2\relax + \edef#2{\@@fc@numstr\ }% + \fi + \@tmpstrctr=#1\relax + \@modulo{\@tmpstrctr}{1000}% + \ifnum\@tmpstrctr=100\relax + \let\@@fc@numstr#2\relax + \edef#2{\@@fc@numstr\@tenstring{10}}% + \else + \let\@@fc@numstr#2\relax + \edef#2{\@@fc@numstr\@hundredstring{\@strctr}}% + \fi \fi \@strctr=#1\relax \@modulo{\@strctr}{100}% -\ifnum#1>100 \ifnum\@strctr>0\ \@andname\ \fi\fi -\ifnum\@strctr>29 -\divide\@strctr by 10 -\@tenstring{\@strctr}% -\@strctr=#1\relax \@modulo{\@strctr}{10}% -\ifnum\@strctr>0 -\ \@andname\ \@unitstring{\@strctr}% -\fi -\else -\ifnum\@strctr<10 -\ifnum\@strctr=0 -\ifnum#1<100 \@unitstring{\@strctr}\fi -\else -\@unitstring{\@strctr}% +\ifnum#1>100\relax + \ifnum\@strctr>0\relax + \let\@@fc@numstr#2\relax + \edef#2{\@@fc@numstr\ \@andname\ }% + \fi \fi +\ifnum\@strctr>29\relax + \divide\@strctr by 10\relax + \let\@@fc@numstr#2\relax + \edef#2{\@@fc@numstr\@tenstring{\@strctr}}% + \@strctr=#1\relax \@modulo{\@strctr}{10}% + \ifnum\@strctr>0\relax + \let\@@fc@numstr#2\relax + \edef#2{\@@fc@numstr\ \@andname\ \@unitstring{\@strctr}}% + \fi \else -\ifnum\@strctr>19 -\@modulo{\@strctr}{10}% -\@twentystring{\@strctr}% -\else -\@modulo{\@strctr}{10}% -\@teenstring{\@strctr}% -\fi -\fi + \ifnum\@strctr<10\relax + \ifnum\@strctr=0\relax + \ifnum#1<100\relax + \let\@@fc@numstr#2\relax + \edef#2{\@@fc@numstr\@unitstring{\@strctr}}% + \fi + \else + \let\@@fc@numstr#2\relax + \edef#2{\@@fc@numstr\@unitstring{\@strctr}}% + \fi + \else + \ifnum\@strctr>19\relax + \@modulo{\@strctr}{10}% + \let\@@fc@numstr#2\relax + \edef#2{\@@fc@numstr\@twentystring{\@strctr}}% + \else + \@modulo{\@strctr}{10}% + \let\@@fc@numstr#2\relax + \edef#2{\@@fc@numstr\@teenstring{\@strctr}}% + \fi + \fi \fi } - -\newcommand{\@@ordinalstringspanish}[1]{% +\newcommand{\@@ordinalstringspanish}[2]{% \@strctr=#1\relax \ifnum#1>99999 \PackageError{fmtcount}{Out of range}% @@ -643,6 +637,7 @@ this number}% you can try typing "minus" first, and then pass the modulus of this number}% \else +\def#2{}% \ifnum\@strctr>999\relax \divide\@strctr by 1000\relax \ifnum\@strctr>1\relax @@ -650,48 +645,73 @@ this number}% \@tmpstrctr=\@strctr \ifnum\@strctr<20 \@modulo{\@tmpstrctr}{10}% - \@teenthstring{\@tmpstrctr} + \let\@@fc@ordstr#2\relax + \edef#2{\@@fc@ordstr\@teenthstring{\@tmpstrctr}}% \else \divide\@tmpstrctr by 10\relax - \@tenthstring{\@tmpstrctr} + \let\@@fc@ordstr#2\relax + \edef#2{\@@fc@ordstr\@tenthstring{\@tmpstrctr}}% \@tmpstrctr=\@strctr \@modulo{\@tmpstrctr}{10}% - \ifnum\@tmpstrctr>0\@unitthstring{\@tmpstrctr} \fi + \ifnum\@tmpstrctr>0\relax + \let\@@fc@ordstr#2\relax + \edef#2{\@@fc@ordstr\@unitthstring{\@tmpstrctr}}% + \fi \fi \else - \@unitstring{\@strctr} + \let\@@fc@ordstr#2\relax + \edef#2{\@@fc@ordstr\@unitstring{\@strctr}}% \fi \fi - \@thousandth + \let\@@fc@ordstr#2\relax + \edef#2{\@@fc@ordstr\@thousandth}% \fi \@strctr=#1\relax \@modulo{\@strctr}{1000}% \ifnum\@strctr>99\relax -\@tmpstrctr=\@strctr -\divide\@tmpstrctr by 100\relax -\ifnum#1>1000\ \fi -\@hundredthstring{\@tmpstrctr}% + \@tmpstrctr=\@strctr + \divide\@tmpstrctr by 100\relax + \ifnum#1>1000\relax + \let\@@fc@ordstr#2\relax + \edef#2{\@@fc@ordstr\ }% + \fi + \let\@@fc@ordstr#2\relax + \edef#2{\@@fc@ordstr\@hundredthstring{\@tmpstrctr}}% \fi \@modulo{\@strctr}{100}% -\ifnum#1>99\ifnum\@strctr>0\ \fi\fi +\ifnum#1>99\relax + \ifnum\@strctr>0\relax + \let\@@fc@ordstr#2\relax + \edef#2{\@@fc@ordstr\ }% + \fi +\fi \ifnum\@strctr>19\relax -\@tmpstrctr=\@strctr -\divide\@tmpstrctr by 10\relax -\@tenthstring{\@tmpstrctr}% -\@tmpstrctr=\@strctr -\@modulo{\@tmpstrctr}{10}% -\ifnum\@tmpstrctr>0\ \@unitthstring{\@tmpstrctr}\fi -\else -\ifnum\@strctr>9 -\@modulo{\@strctr}{10}% -\@teenthstring{\@strctr}% -\else -\ifnum\@strctr=0\relax -\ifnum#1=0\@unitstring{0}\fi + \@tmpstrctr=\@strctr + \divide\@tmpstrctr by 10\relax + \let\@@fc@ordstr#2\relax + \edef#2{\@@fc@ordstr\@tenthstring{\@tmpstrctr}}% + \@tmpstrctr=\@strctr + \@modulo{\@tmpstrctr}{10}% + \ifnum\@tmpstrctr>0\relax + \let\@@fc@ordstr#2\relax + \edef#2{\@@fc@ordstr\ \@unitthstring{\@tmpstrctr}}% + \fi \else -\@unitthstring{\@strctr}% -\fi -\fi + \ifnum\@strctr>9\relax + \@modulo{\@strctr}{10}% + \let\@@fc@ordstr#2\relax + \edef#2{\@@fc@ordstr\@teenthstring{\@strctr}}% + \else + \ifnum\@strctr=0\relax + \ifnum#1=0\relax + \let\@@fc@ordstr#2\relax + \edef#2{\@@fc@ordstr\@unitstring{0}}% + \fi + \else + \let\@@fc@ordstr#2\relax + \edef#2{\@@fc@ordstr\@unitthstring{\@strctr}}% + \fi + \fi \fi \fi \fi diff --git a/Master/texmf-dist/tex/latex/fmtcount/fmtcount.sty b/Master/texmf-dist/tex/latex/fmtcount/fmtcount.sty index 9ca97952fb5..61a1428756a 100644 --- a/Master/texmf-dist/tex/latex/fmtcount/fmtcount.sty +++ b/Master/texmf-dist/tex/latex/fmtcount/fmtcount.sty @@ -27,7 +27,7 @@ %% Grave accent \` Left brace \{ Vertical bar \| %% Right brace \} Tilde \~} \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{fmtcount}[2007/01/06 v1.06] +\ProvidesPackage{fmtcount}[2007/04/20 v1.09] \RequirePackage{ifthen} \RequirePackage{keyval} \providecommand{\fmtord}[1]{\textsuperscript{#1}} @@ -318,86 +318,217 @@ or `user'}}} \space already defined use \string\FCordinal \space instead.}} \newcommand{\ordinalnum}[1]{\@ifnextchar[{\@ordinalnum{#1}}{% \@ordinalnum{#1}[m]}} - -\def\@ordinalnum#1[#2]{% +\def\@ordinalnum#1[#2]{{% \ifthenelse{\equal{#2}{f}}{% -\protect\@ordinalF{#1}}{% +\protect\@ordinalF{#1}{\@fc@ordstr}}{% \ifthenelse{\equal{#2}{m}}{}{% \PackageError{fmtcount}{Invalid gender option `#2'}{% Available options are m or f}}% -\protect\@ordinalM{#1}}} - +\protect\@ordinalM{#1}{\@fc@ordstr}}\@fc@ordstr}} +\newcommand*{\storeordinal}[2]{% +\expandafter\protect\expandafter\storeordinalnum{#1}{% +\expandafter\the\csname c@#2\endcsname}} +\newcommand*{\storeordinalnum}[2]{% +\@ifnextchar[{\@storeordinalnum{#1}{#2}}{% +\@storeordinalnum{#1}{#2}[m]}} +\def\@storeordinalnum#1#2[#3]{% +\ifthenelse{\equal{#3}{f}}{% +\protect\@ordinalF{#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} +\newcommand*{\FMCuse}[1]{\csname @fcs@#1\endcsname} \newcommand{\ordinalstring}[1]{% \expandafter\protect\expandafter\ordinalstringnum{% \expandafter\the\csname c@#1\endcsname}} - \newcommand{\ordinalstringnum}[1]{% \@ifnextchar[{\@ordinal@string{#1}}{\@ordinal@string{#1}[m]}} - -\def\@ordinal@string#1[#2]{% +\def\@ordinal@string#1[#2]{{% \ifthenelse{\equal{#2}{f}}{% -\protect\@ordinalstringF{#1}}{% +\protect\@ordinalstringF{#1}{\@fc@ordstr}}{% \ifthenelse{\equal{#2}{m}}{}{% \PackageError{fmtcount}{Invalid gender option `#2' to \string\ordinalstring}{Available options are m or f}}% -\protect\@ordinalstringM{#1}}} - +\protect\@ordinalstringM{#1}{\@fc@ordstr}}\@fc@ordstr}} +\newcommand{\storeordinalstring}[2]{% +\expandafter\protect\expandafter\storeordinalstringnum{#1}{% +\expandafter\the\csname c@#2\endcsname}} +\newcommand{\storeordinalstringnum}[2]{% +\@ifnextchar[{\@store@ordinal@string{#1}{#2}}{% +\@store@ordinal@string{#1}{#2}[m]}} +\def\@store@ordinal@string#1#2[#3]{% +\ifthenelse{\equal{#3}{f}}{% +\protect\@ordinalstringF{#2}{\@fc@ordstr}}{% +\ifthenelse{\equal{#3}{m}}{}{% +\PackageError{fmtcount}{Invalid gender option `#3' to +\string\ordinalstring}{Available options are m or f}}% +\protect\@ordinalstringM{#2}{\@fc@ordstr}}% +\expandafter\let\csname @fcs@#1\endcsname\@fc@ordstr} \newcommand{\Ordinalstring}[1]{% \expandafter\protect\expandafter\Ordinalstringnum{% \expandafter\the\csname c@#1\endcsname}} - \newcommand{\Ordinalstringnum}[1]{% \@ifnextchar[{\@Ordinal@string{#1}}{\@Ordinal@string{#1}[m]}} - -\def\@Ordinal@string#1[#2]{% +\def\@Ordinal@string#1[#2]{{% \ifthenelse{\equal{#2}{f}}{% -\protect\@OrdinalstringF{#1}}{% +\protect\@OrdinalstringF{#1}{\@fc@ordstr}}{% \ifthenelse{\equal{#2}{m}}{}{% -\PackageError{fmtcount}{Invalid gender option `#2' to -\string\Ordinalstring}{Available options are m or f}}% -\protect\@OrdinalstringM{#1}}} - +\PackageError{fmtcount}{Invalid gender option `#2'}{% +Available options are m or f}}% +\protect\@OrdinalstringM{#1}{\@fc@ordstr}}\@fc@ordstr}} +\newcommand{\storeOrdinalstring}[2]{% +\expandafter\protect\expandafter\storeOrdinalstringnum{#1}{% +\expandafter\the\csname c@#2\endcsname}} +\newcommand{\storeOrdinalstringnum}[2]{% +\@ifnextchar[{\@store@Ordinal@string{#1}{#2}}{% +\@store@Ordinal@string{#1}{#2}[m]}} +\def\@store@Ordinal@string#1#2[#3]{% +\ifthenelse{\equal{#3}{f}}{% +\protect\@OrdinalstringF{#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} +\newcommand{\storeORDINALstring}[2]{% +\expandafter\protect\expandafter\storeORDINALstringnum{#1}{% +\expandafter\the\csname c@#2\endcsname}} +\newcommand{\storeORDINALstringnum}[2]{% +\@ifnextchar[{\@store@ORDINAL@string{#1}{#2}}{% +\@store@ORDINAL@string{#1}{#2}[m]}} +\def\@store@ORDINAL@string#1#2[#3]{% +\ifthenelse{\equal{#3}{f}}{% +\protect\@ordinalstringF{#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}}} +\newcommand{\ORDINALstring}[1]{% +\expandafter\protect\expandafter\ORDINALstringnum{% +\expandafter\the\csname c@#1\endcsname}} +\newcommand{\ORDINALstringnum}[1]{% +\@ifnextchar[{\@ORDINAL@string{#1}}{\@ORDINAL@string{#1}[m]}} +\def\@ORDINAL@string#1[#2]{{% +\ifthenelse{\equal{#2}{f}}{% +\protect\@ordinalstringF{#1}{\@fc@ordstr}}{% +\ifthenelse{\equal{#2}{m}}{}{% +\PackageError{fmtcount}{Invalid gender option `#2'}{% +Available options are m or f}}% +\protect\@ordinalstringM{#1}{\@fc@ordstr}}% +\MakeUppercase{\@fc@ordstr}}} +\newcommand{\storenumberstring}[2]{% +\expandafter\protect\expandafter\storenumberstringnum{#1}{% +\expandafter\the\csname c@#2\endcsname}} +\newcommand{\storenumberstringnum}[2]{% +\@ifnextchar[{\@store@number@string{#1}{#2}}{% +\@store@number@string{#1}{#2}[m]}} +\def\@store@number@string#1#2[#3]{% +\ifthenelse{\equal{#3}{f}}{% +\protect\@numberstringF{#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\let\csname @fcs@#1\endcsname\@fc@numstr} \newcommand{\numberstring}[1]{% \expandafter\protect\expandafter\numberstringnum{% \expandafter\the\csname c@#1\endcsname}} - \newcommand{\numberstringnum}[1]{% \@ifnextchar[{\@number@string{#1}}{\@number@string{#1}[m]}} - -\def\@number@string#1[#2]{% +\def\@number@string#1[#2]{{% \ifthenelse{\equal{#2}{f}}{% -\protect\@numberstringF{#1}}{% +\protect\@numberstringF{#1}{\@fc@numstr}}{% \ifthenelse{\equal{#2}{m}}{}{% -\PackageError{fmtcount}{Invalid gender option `#2' to -\string\numberstring}{Available options are m or f}}% -\protect\@numberstringM{#1}}} - +\PackageError{fmtcount}{Invalid gender option `#2'}{% +Available options are m or f}}% +\protect\@numberstringM{#1}{\@fc@numstr}}\@fc@numstr}} +\newcommand{\storeNumberstring}[2]{% +\expandafter\protect\expandafter\storeNumberstringnum{#1}{% +\expandafter\the\csname c@#2\endcsname}} +\newcommand{\storeNumberstringnum}[2]{% +\@ifnextchar[{\@store@Number@string{#1}{#2}}{% +\@store@Number@string{#1}{#2}[m]}} +\def\@store@Number@string#1#2[#3]{% +\ifthenelse{\equal{#3}{f}}{% +\protect\@NumberstringF{#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\let\csname @fcs@#1\endcsname\@fc@numstr} \newcommand{\Numberstring}[1]{% \expandafter\protect\expandafter\Numberstringnum{% \expandafter\the\csname c@#1\endcsname}} - \newcommand{\Numberstringnum}[1]{% \@ifnextchar[{\@Number@string{#1}}{\@Number@string{#1}[m]}} - -\def\@Number@string#1[#2]{% +\def\@Number@string#1[#2]{{% \ifthenelse{\equal{#2}{f}}{% -\protect\@NumberstringF{#1}}{% +\protect\@NumberstringF{#1}{\@fc@numstr}}{% \ifthenelse{\equal{#2}{m}}{}{% -\PackageError{fmtcount}{Invalid gender option `#2' to -\string\Numberstring}{Available options are m or f}}% -\protect\@NumberstringM{#1}}} - -\providecommand{\binary}[1]{\expandafter\protect\expandafter\@binary{\expandafter\the\csname c@#1\endcsname}} -\providecommand{\aaalph}[1]{\expandafter\protect\expandafter\@aaalph{\expandafter\the\csname c@#1\endcsname}} -\providecommand{\AAAlph}[1]{\expandafter\protect\expandafter\@AAAlph{\expandafter\the\csname c@#1\endcsname}} -\providecommand{\abalph}[1]{\expandafter\protect\expandafter\@abalph{\expandafter\the\csname c@#1\endcsname}} -\providecommand{\ABAlph}[1]{\expandafter\protect\expandafter\@ABAlph{\expandafter\the\csname c@#1\endcsname}} -\providecommand{\hexadecimal}[1]{\expandafter\protect\expandafter\@hexadecimal{\expandafter\the\csname c@#1\endcsname}} -\providecommand{\Hexadecimal}[1]{\expandafter\protect\expandafter\@Hexadecimal{\expandafter\the\csname c@#1\endcsname}} -\providecommand{\octal}[1]{\expandafter\protect\expandafter\@octal{\expandafter\the\csname c@#1\endcsname}} -\providecommand{\decimal}[1]{\expandafter\protect\expandafter\@decimal{\expandafter\the\csname c@#1\endcsname}} +\PackageError{fmtcount}{Invalid gender option `#2'}{% +Available options are m or f}}% +\protect\@NumberstringM{#1}{\@fc@numstr}}\@fc@numstr}} +\newcommand{\storeNUMBERstring}[2]{% +\expandafter\protect\expandafter\storeNUMBERstringnum{#1}{% +\expandafter\the\csname c@#2\endcsname}} +\newcommand{\storeNUMBERstringnum}[2]{% +\@ifnextchar[{\@store@NUMBER@string{#1}{#2}}{% +\@store@NUMBER@string{#1}{#2}[m]}} +\def\@store@NUMBER@string#1#2[#3]{% +\ifthenelse{\equal{#3}{f}}{% +\protect\@numberstringF{#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}}} +\newcommand{\NUMBERstring}[1]{% +\expandafter\protect\expandafter\NUMBERstringnum{% +\expandafter\the\csname c@#1\endcsname}} +\newcommand{\NUMBERstringnum}[1]{% +\@ifnextchar[{\@NUMBER@string{#1}}{\@NUMBER@string{#1}[m]}} +\def\@NUMBER@string#1[#2]{{% +\ifthenelse{\equal{#2}{f}}{% +\protect\@numberstringF{#1}{\@fc@numstr}}{% +\ifthenelse{\equal{#2}{m}}{}{% +\PackageError{fmtcount}{Invalid gender option `#2'}{% +Available options are m or f}}% +\protect\@numberstringM{#1}{\@fc@numstr}}% +\MakeUppercase{\@fc@numstr}}} +\providecommand{\binary}[1]{% +\expandafter\protect\expandafter\@binary{% +\expandafter\the\csname c@#1\endcsname}} +\providecommand{\aaalph}[1]{% +\expandafter\protect\expandafter\@aaalph{% +\expandafter\the\csname c@#1\endcsname}} +\providecommand{\AAAlph}[1]{% +\expandafter\protect\expandafter\@AAAlph{% +\expandafter\the\csname c@#1\endcsname}} +\providecommand{\abalph}[1]{% +\expandafter\protect\expandafter\@abalph{% +\expandafter\the\csname c@#1\endcsname}} +\providecommand{\ABAlph}[1]{% +\expandafter\protect\expandafter\@ABAlph{% +\expandafter\the\csname c@#1\endcsname}} +\providecommand{\hexadecimal}[1]{% +\expandafter\protect\expandafter\@hexadecimal{% +\expandafter\the\csname c@#1\endcsname}} +\providecommand{\Hexadecimal}[1]{% +\expandafter\protect\expandafter\@Hexadecimal{% +\expandafter\the\csname c@#1\endcsname}} +\providecommand{\octal}[1]{% +\expandafter\protect\expandafter\@octal{% +\expandafter\the\csname c@#1\endcsname}} +\providecommand{\decimal}[1]{% +\expandafter\protect\expandafter\@decimal{% +\expandafter\the\csname c@#1\endcsname}} \def\@setdef@ultfmtcount{ -\@ifundefined{@ordinalenglish}{\input{fc-english.def}}{} +\@ifundefined{@ordinalMenglish}{\input{fc-english.def}}{} \def\@ordinalstringM{\@ordinalstringMenglish} \let\@ordinalstringF=\@ordinalstringMenglish \def\@OrdinalstringM{\@OrdinalstringMenglish} diff --git a/Master/texmf-dist/tpm/fmtcount.tpm b/Master/texmf-dist/tpm/fmtcount.tpm index 06a63d3d40c..b9d9d93517a 100644 --- a/Master/texmf-dist/tpm/fmtcount.tpm +++ b/Master/texmf-dist/tpm/fmtcount.tpm @@ -3,7 +3,7 @@ <rdf:Description about="http://texlive.dante.de/texlive/Package/fmtcount.zip"> <TPM:Name>fmtcount</TPM:Name> <TPM:Type>Package</TPM:Type> - <TPM:Date>2007/04/24 23:54:29</TPM:Date> + <TPM:Date>2007/04/24 23:55:18</TPM:Date> <TPM:Version>1.03 2005/06/20</TPM:Version> <TPM:Creator>karl</TPM:Creator> <TPM:Title> @@ -20,7 +20,7 @@ support. [description copied from TeX Catalogue] </TPM:Description> <TPM:Author></TPM:Author> - <TPM:Size>399206</TPM:Size> + <TPM:Size>490211</TPM:Size> <TPM:License></TPM:License> <TPM:Build/> <TPM:RunFiles size="93920"> |