diff options
Diffstat (limited to 'Master/texmf-dist/doc/latex/fmtcount')
-rw-r--r-- | Master/texmf-dist/doc/latex/fmtcount/CHANGES | 11 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/fmtcount/README | 53 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/fmtcount/fc-lang.tex | 238 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/fmtcount/fc-samp.pdf | bin | 0 -> 34541 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/latex/fmtcount/fc-samp.tex | 127 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/fmtcount/fmtcount.pdf | bin | 0 -> 117682 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/latex/fmtcount/fmtcount.perl | 1788 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/fmtcount/manual.html | 439 |
8 files changed, 2656 insertions, 0 deletions
diff --git a/Master/texmf-dist/doc/latex/fmtcount/CHANGES b/Master/texmf-dist/doc/latex/fmtcount/CHANGES new file mode 100644 index 00000000000..0decf94d737 --- /dev/null +++ b/Master/texmf-dist/doc/latex/fmtcount/CHANGES @@ -0,0 +1,11 @@ +fmtcount package versions: + +Version 1.03: Minor bug fixes (concerning fmtcount.cfg and the effect of \padzeroes). + +Version 1.02: Added multilingual support + +Version 1.01: Added support for LaTeX2HTML + +Version 1.0: separated counter related code from +datetime. + diff --git a/Master/texmf-dist/doc/latex/fmtcount/README b/Master/texmf-dist/doc/latex/fmtcount/README new file mode 100644 index 00000000000..eede71472c8 --- /dev/null +++ b/Master/texmf-dist/doc/latex/fmtcount/README @@ -0,0 +1,53 @@ +LaTeX Package : fmtcount v 1.03 + +Last Modified : 20 June 2005 + +Author : Nicola Talbot + +Files : fmtcount.dtx - documented source file + fmtcount.ins - installation script + + +The package fmtcount.sty provides commands +that display the value of a LaTeX counter in a variety +of formats (ordinal, text, hexadecimal, decimal, +octal, binary etc). This package was originally provided +with the datetime package, but is now distributed separately. + +See the documentation for more details. + +To extract the code do: + +latex fmtcount.ins + +This will create the files: fmtcount.sty (the LaTeX package), +fmtcount.perl (the LaTeX2HTML package) +and fc-*.def (the language definition files used by +fmtcount.sty). It will also create two sample files: +fc-samp.tex and fc-lang.tex. The first will work with +LaTeX2HTML, the other won't. + +Move the .sty and .def files to somewhere LaTeX will find it +(e.g. texmf/tex/latex/fmtcount/) and remember to update the TeX +database. + +Copy the fmtcount.perl file to somewhere where LaTeX2HTML will +find it (e.g. latex2html/styles/). + +To extract the documentation do: + +latex fmtcount.dtx +makeindex -s gglo.ist -t fmtcount.glg -o fmtcount.gls fmtcount.glo +latex fmtcount.dtx +latex fmtcount.dtx + +Place the resulting file (fmtcount.dvi) into the documentation +directory (e.g. texmf/doc/latex/fmtcount/). + +Read the file CHANGES for version changes. + +This material is subject to the LaTeX Project Public License. +See http://www.ctan.org/tex-archive/help/Catalogue/licenses.lppl.html for +the details of that license. + +http://theoval.cmp.uea.ac.uk/~nlct/ diff --git a/Master/texmf-dist/doc/latex/fmtcount/fc-lang.tex b/Master/texmf-dist/doc/latex/fmtcount/fc-lang.tex new file mode 100644 index 00000000000..798fbfee3ac --- /dev/null +++ b/Master/texmf-dist/doc/latex/fmtcount/fc-lang.tex @@ -0,0 +1,238 @@ +%% +%% This is file `fc-lang.tex', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% fmtcount.dtx (with options: `fc-lang.tex,package') +%% Copyright (C) 2005 Nicola Talbot, all rights reserved. +%% If you modify this file, you must change its name first. +%% You are NOT ALLOWED to distribute this file alone. You are NOT +%% ALLOWED to take money for the distribution or use of either this +%% file or a changed version, except for a nominal charge for copying +%% etc. +%% \CharacterTable +%% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z +%% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z +%% Digits \0\1\2\3\4\5\6\7\8\9 +%% Exclamation \! Double quote \" Hash (number) \# +%% Dollar \$ Percent \% Ampersand \& +%% Acute accent \' Left paren \( Right paren \) +%% Asterisk \* Plus \+ Comma \, +%% Minus \- Point \. Solidus \/ +%% Colon \: Semicolon \; Less than \< +%% Equals \= Greater than \> Question mark \? +%% Commercial at \@ Left bracket \[ Backslash \\ +%% Right bracket \] Circumflex \^ Underscore \_ +%% Grave accent \` Left brace \{ Vertical bar \| +%% Right brace \} Tilde \~} + % This is an interactive script. Run it through \LaTeX + % and enter appropriate responses. + +\documentclass[a4paper]{article} + +\usepackage[french,english,spanish,portuges]{babel} +\usepackage{fmtcount} + +\newcounter{startval} +\newcounter{endval} +\newcounter{stepsize} +\newcounter{N} +\newcount\myctr +\newcount\langid + +\begin{document} + +\section{Displaying the value of a counter} + +\typeout{This is an interactive script, testing the fmtcount package.} + +\langid=-1 + +\loop +\typeout{Which language?^^J} +\typeout{[1] English} +\typeout{[2] Portuguese} +\typeout{[3] Spanish} +\typeout{[4] French} +\typeout{[5] French (Swiss)} +\typeout{[6] French (Belgium)} + +\typein[\response]{} + +\ifthenelse{\equal{\response}{1}}{\langid=1}{ +\ifthenelse{\equal{\response}{2}}{\langid=2}{ +\ifthenelse{\equal{\response}{3}}{\langid=3}{ +\ifthenelse{\equal{\response}{4}}{\langid=4\fmtcountsetoptions{french}}{ +\ifthenelse{\equal{\response}{5}}{\langid=5\fmtcountsetoptions{french=swiss}}{ +\ifthenelse{\equal{\response}{6}}{\langid=6\fmtcountsetoptions{french=belgian}} +{\langid=-1 +\typeout{Invalid response '\response', please select a number from 1 to 6}}}}}}} +\ifnum\langid=-1 +\repeat + +\ifcase\langid +\or \selectlanguage{english} +Current language: English. +\or \selectlanguage{portuges} +Current language: Portuguese. +\or \selectlanguage{spanish} +Current language: Spanish. +\or \selectlanguage{french} +Current language: French. +\or \selectlanguage{french} +Current language: French (Swiss). +\or \selectlanguage{french} +Current language: French (Belgium). +\fi + +\def\startval{-1} + +\loop +\typein[\startval]{Start value? (Integer from 0 to 99000) +[Default 1]} +\ifthenelse{\equal{\startval}{}}{\def\startval{1}}{} +\ifnum\startval<0\def\startval{-1}\fi +\ifnum\startval>99999\def\startval{-1}\fi +\ifnum\startval=-1 +\repeat + +\def\endval{-1} + +\loop +\typein[\endval]{End value? (Integer from 0 to 99999) +[Default 1000]} +\ifthenelse{\equal{\endval}{}}{\def\endval{1000}}{} +\ifnum\endval<0\def\endval{-1}\fi +\ifnum\endval>99000\def\endval{-1}\fi +\ifnum\endval=-1 +\repeat + +\def\stepsize{0} + +\loop +\typein[\stepsize]{Step size? (Non zero integer) +[Default 1]} +\ifthenelse{\equal{\stepsize}{}}{\def\stepsize{1}}{} +\ifnum\stepsize=0 +\repeat + +\typeout{From {\startval} to {\endval} step {\stepsize}} + +\ifnum\startval<\endval +\ifnum\stepsize<0 +\PackageError{fc-lang}{Infinite loop not permitted!}{} +\def\endval{\startval} +\fi +\fi + +\ifnum\startval>\endval +\ifnum\stepsize>0 +\PackageError{fc-lang}{Infinite loop not permitted!}{} +\def\endval{\startval} +\fi +\fi + +\myctr=-1 +\loop +\typeout{Which format?^^J} +\typeout{[1] ordinalstring} +\typeout{[2] Ordinalstring} +\typeout{[3] numberstring} +\typeout{[4] Numberstring} + +\typein[\response]{Default: 1} + +\ifthenelse{\equal{\response}{}}{\def\response{1}}{}%default val +\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}}}}} +\ifnum\myctr=-1 +\repeat + +\ifcase\myctr +\or\def\stringtype{ordinalstring} +\or\def\stringtype{Ordinalstring} +\or\def\stringtype{numberstring} +\or\def\stringtype{Numberstring} +\fi + +\ifnum\langid>3 +\myctr=-1 +\loop +\typeout{Ordinal type?^^J} +\typeout{[1] eme} +\typeout{[2] e} +\typein[\response]{Default: 1} +\ifthenelse{\equal{\response}{}}{\def\response{1}}{}%default +\ifthenelse{\equal{\response}{1}}{% +\fmtcountsetoptions{abbrv=false}\myctr=1}{% +\ifthenelse{\equal{\response}{2}}{% +\fmtcountsetoptions{abbrv}\myctr=2}{% +\myctr=-1}} +\ifnum\myctr=-1 +\repeat +\fi + +\myctr=-1 +\loop +\typeout{Ordinal format?^^J} +\typeout{[1] raised} +\typeout{[2] level} +\typein[\response]{Default: 1} +\ifthenelse{\equal{\response}{1}\or\equal{\response}{}}{% +\fmtcountsetoptions{fmtord=raise}\myctr=1}{% +\ifthenelse{\equal{\response}{2}}{% +\fmtcountsetoptions{fmtord=level}\myctr=2}{% +\myctr=-1}} +\ifnum\myctr=-1 +\repeat + +\ifnum\langid=1 +\myctr=1 +\else +\loop +\typein[\response]{Gender? (m or f) [Default: m]} +\ifthenelse{\equal{\response}{m}\or\equal{\response}{}}{\myctr=1}{ +\ifthenelse{\equal{\response}{f}}{\myctr=2}{\myctr=-1 +\typeout{Invalid response '\response'}}} +\ifnum\myctr=-1 +\repeat +\fi + +\ifcase\myctr +\or \def\gender{m} +\or \def\gender{f} +\fi + +\setcounter{startval}{\startval} +\setcounter{endval}{\endval} +\setcounter{stepsize}{\stepsize} + +\stepcounter{endval} +\begin{ttfamily} +\noindent +\makebox[0.25in][c]{N} +\makebox[0.5in][c]{ordinal}\quad +\stringtype +\par +\myctr=\value{startval} +\loop +\noindent +\setcounter{N}{\myctr} +\makebox[0.25in][r]{\arabic{N}} +\makebox[0.5in][r]{\ordinal{N}[\gender]}\quad +\csname\stringtype\endcsname{N}[\gender]. +\par +\advance\myctr by \value{stepsize}\relax +\ifnum\myctr<\value{endval} +\repeat + +\end{ttfamily} + +\end{document} +\endinput +%% +%% End of file `fc-lang.tex'. diff --git a/Master/texmf-dist/doc/latex/fmtcount/fc-samp.pdf b/Master/texmf-dist/doc/latex/fmtcount/fc-samp.pdf Binary files differnew file mode 100644 index 00000000000..4316679d0cc --- /dev/null +++ b/Master/texmf-dist/doc/latex/fmtcount/fc-samp.pdf diff --git a/Master/texmf-dist/doc/latex/fmtcount/fc-samp.tex b/Master/texmf-dist/doc/latex/fmtcount/fc-samp.tex new file mode 100644 index 00000000000..2fb8b23549c --- /dev/null +++ b/Master/texmf-dist/doc/latex/fmtcount/fc-samp.tex @@ -0,0 +1,127 @@ +%% +%% This is file `fc-samp.tex', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% fmtcount.dtx (with options: `fc-samp.tex,package') +%% Copyright (C) 2005 Nicola Talbot, all rights reserved. +%% If you modify this file, you must change its name first. +%% You are NOT ALLOWED to distribute this file alone. You are NOT +%% ALLOWED to take money for the distribution or use of either this +%% file or a changed version, except for a nominal charge for copying +%% etc. +%% \CharacterTable +%% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z +%% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z +%% Digits \0\1\2\3\4\5\6\7\8\9 +%% Exclamation \! Double quote \" Hash (number) \# +%% Dollar \$ Percent \% Ampersand \& +%% Acute accent \' Left paren \( Right paren \) +%% Asterisk \* Plus \+ Comma \, +%% Minus \- Point \. Solidus \/ +%% Colon \: Semicolon \; Less than \< +%% Equals \= Greater than \> Question mark \? +%% Commercial at \@ Left bracket \[ Backslash \\ +%% Right bracket \] Circumflex \^ Underscore \_ +%% Grave accent \` Left brace \{ Vertical bar \| +%% Right brace \} Tilde \~} +\documentclass[a4paper]{article} + +\usepackage[french]{babel} +\usepackage{fmtcount} +\newcounter{N} + +\newcommand{\printrow}[1]{% +\newline +\setcounter{N}{#1} +\makebox[0.25in][r]{\theN\quad} +\makebox[0.75in][r]{\hexadecimal{N}\quad} +\makebox[0.75in][r]{\ordinal{N}\quad} +\makebox[2in][l]{\numberstring{N}} +} + +\renewcommand{\thesection}{\ordinal{section}} + +\begin{document} + +\section{Displaying the value of a counter} +\label{ex} + +\begin{ttfamily} +\noindent +\makebox[0.25in][c]{N} +\makebox[0.75in][c]{hexadecimal} +\makebox[0.75in][c]{ordinal} +numberstring +\printrow{0} +\printrow{1} +\printrow{2} +\printrow{3} +\printrow{4} +\printrow{5} +\printrow{6} +\printrow{7} +\printrow{8} +\printrow{9} +\printrow{10} +\printrow{11} +\printrow{12} +\printrow{13} +\printrow{14} +\printrow{15} +\printrow{16} +\printrow{17} +\printrow{18} +\printrow{19} +\printrow{20} +\printrow{21} +\printrow{22} +\printrow{23} +\printrow{24} +\printrow{25} +\printrow{30} +\printrow{40} +\printrow{50} +\printrow{60} +\printrow{70} +\printrow{71} +\printrow{75} +\printrow{80} +\printrow{81} +\printrow{85} +\printrow{90} +\printrow{91} +\printrow{95} +\printrow{100} +\printrow{101} +\printrow{110} +\printrow{125} +\printrow{150} +\printrow{170} +\printrow{180} +\printrow{190} +\printrow{200} +\printrow{250} +\printrow{300} +\printrow{400} +\printrow{500} +\printrow{600} +\printrow{700} +\printrow{800} +\printrow{900} +\printrow{1000} +\printrow{99999} +\end{ttfamily} + +\section{Cross-Referencing} + +Referencing a label: \ref{ex}. + +Passing numbers explicitly: \ordinalnum{10}, +\Numberstringnum{10}, \Ordinalstringnum{10}. + +\end{document} +\endinput +%% +%% End of file `fc-samp.tex'. diff --git a/Master/texmf-dist/doc/latex/fmtcount/fmtcount.pdf b/Master/texmf-dist/doc/latex/fmtcount/fmtcount.pdf Binary files differnew file mode 100644 index 00000000000..cf5aaa39b24 --- /dev/null +++ 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 new file mode 100644 index 00000000000..941b48fa98c --- /dev/null +++ b/Master/texmf-dist/doc/latex/fmtcount/fmtcount.perl @@ -0,0 +1,1788 @@ +# File : fmtcount.perl +# Author : Nicola Talbot +# Date : 3 Mar 2005 +# Version : 1.02 +# Description : LaTeX2HTML implementation of fmtcount package + +package main; + +sub do_fmtcount_raise{ + local($tmp)=""; + + $tmp .= 'sub do_cmd_fmtord{'; + $tmp .= 'local($_) = @_;'; + $tmp .= 'local($num) = &missing_braces unless ((s/$next_pair_pr_rx//o)&&($num=$2));'; + $tmp .= 'join("", "<SUP>",$num,"</SUP>",$_);'; + $tmp .='}'; + + eval($tmp); +} + +sub do_fmtcount_level{ + local($tmp)=""; + + $tmp .= 'sub do_cmd_fmtord{'; + $tmp .= 'local($_) = @_;'; + $tmp .= 'local($num) = &missing_braces unless ((s/$next_pair_pr_rx//o)&&($num=$2));'; + $tmp .= 'join("", $num,$_);'; + $tmp .='}'; + + eval($tmp); +} + +if (not defined &do_cmd_fmtord) +{ + &do_fmtcount_raise(@_); +} + +$frenchdialect = 'france'; +$ordinalabbrv = 0; + +sub get_ordinal_suffix_english{ + local($num,$gender) = @_; + local($suffix); + + if ((($num % 10) == 1) && ($num%100 != 11)) + { + $suffix = 'st'; + } + elsif ((($num % 10) == 2) && ($num%100 != 12)) + { + $suffix = 'nd'; + } + elsif ((($num % 10) == 3) && ($num%100 != 13)) + { + $suffix = 'rd'; + } + else + { + $suffix = 'th'; + } + + $suffix; +} + +sub get_ordinal_suffix_french{ + local($num,$gender) = @_; + local($_); + + if ($ordinalabbrv > 0) + { + $_ = 'e'; + } + else + { + if ($num == 1) + { + $_ = ($gender eq 'f' ? 'ere' : 'er'); + } + else + { + $_ = 'eme'; + } + } +} + +sub get_ordinal_suffix_spanish{ + local($num,$gender) = @_; + + ($gender eq 'f' ? 'a' : 'o'); +} + +sub get_ordinal_suffix_portuges{ + local($num,$gender) = @_; + + ($gender eq 'f' ? 'a' : 'o'); +} + +sub get_ordinal_suffix{ + local($num,$gender) = @_; + local($suffix,$suffixsub); + + $suffixsub = "get_ordinal_suffix_$default_language"; + + if (defined ($suffixsub)) + { + $suffix = &$suffixsub($num,$gender); + } + else + { + $suffix = &get_ordinal_suffix_english($num,$gender); + } + + $suffix; +} + +sub getordinal{ + local($num,$gender) = @_; + local($suffix) = &get_ordinal_suffix($num,$gender); + + if ($suffix eq '') + { + $num; + } + else + { + local($br_id) = ++$global{'max_id'}; + $num . "\\fmtord${OP}$br_id${CP}$suffix${OP}$br_id${CP}"; + } +} + +sub do_cmd_ordinalnum{ + local($_) = @_; + local($num) = &missing_braces unless ($_[0]=~(s/$next_pair_pr_rx//o)&&($num=$2)); + local($gender)='m'; + local($suffix)=''; + + if ($_[0]=~s/\[([mf])\]//) + { + $gender = $1; + } + + $suffix = &get_ordinal_suffix($num,$gender); + + local($br_id) = ++$global{'max_id'}; + join('', $num, "\\fmtord${OP}$br_id${CP}$suffix${OP}$br_id${CP}", $_[0]); +} + +sub do_cmd_ordinal{ + 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 $str eq 'YEAR') + { + # this is a cludge to make it work with newdateformat + join('', '{ORDINAL{', $ctr, '}}', $_[0]); + } + else + { + join('', &getordinal($val, $gender), $_[0]); + } +} + +@unitthstring = ('zeroth', + 'first', + 'second', + 'third', + 'fourth', + 'fifth', + 'sixth', + 'seventh', + 'eighth', + 'ninth'); + +@tenthstring = ('', + 'tenth', + 'twentieth', + 'thirtieth', + 'fortieth', + 'fiftieth', + 'sixtieth', + 'seventieth', + 'eightieth', + 'ninetieth'); + +@teenthstring = ('tenth', + 'eleventh', + 'twelfth', + 'thirteenth', + 'fourteenth', + 'fifteenth', + 'sixteenth', + 'seventeenth', + 'eighteenth', + 'nineteenth'); + +@unitstring = ('zero', + 'one', + 'two', + 'three', + 'four', + 'five', + 'six', + 'seven', + 'eight', + 'nine'); + +@teenstring = ('ten', + 'eleven', + 'twelve', + 'thirteen', + 'fourteen', + 'fifteen', + 'sixteen', + 'seventeen', + 'eighteen', + 'nineteen'); +@tenstring = ('', + 'ten', + 'twenty', + 'thirty', + 'forty', + 'fifty', + 'sixty', + 'seventy', + 'eighty', + 'ninety'); + +$hundredname = "hundred"; +$hundredthname = "hundredth"; +$thousandname = "thousand"; +$thousandthname = "thousandth"; + +sub get_numberstringenglish{ + local($num) = @_; + local($name)=""; + + unless (($num >= 1000000) || ($num < 0)) + { + if ($num >= 1000) + { + local($thousands) = &get_numberstringenglish($num/1000); + $name .= $thousands . " $thousandname"; + $num = $num%1000; + } + + if ($num >= 100) + { + if ($_[0] >= 1000) { $name .= " "; } + + local($hundreds) = &get_numberstringenglish($num/100); + $name .= $hundreds . " $hundredname"; + $num = $num%100; + } + + if (($_[0] > 100) && ($_[0]%100 > 0)) { $name .= " and "; } + + if ($num >= 20) + { + $name .= $tenstring[$num/10]; + + if ($num%10 > 0) { $name .= '-'; } + } + + if (($num >= 10) && ($num < 20)) + { + $name .= $teenstring[$num%10]; + } + elsif (($num%10 > 0) || ($_[0] == 0)) + { + $name .= $unitstring[$num%10]; + } + } + + $name; +} + +@unitthstringfrench = ('zeroi\`eme', + 'uni\`eme', + 'deuxi\`eme', + 'troisi\`eme', + 'quatri\`eme', + 'cinqui\`eme', + 'sixi\`eme', + 'septi\`eme', + 'huiti\`eme', + 'neuvi\`eme'); + +@tenthstringfrench = ('', + 'dixi\`eme', + 'vingti\`eme', + 'trentri\`eme', + 'quaranti\`eme', + 'cinquanti\`eme', + 'soixanti\`eme', + 'septenti\`eme', + 'huitanti\`eme', + 'nonenti\`eme'); + +@teenthstringfrench = ('dixi\`eme', + 'onzi\`eme', + 'douzi\`eme', + 'treizi\`eme', + 'quatorzi\`eme', + 'quinzi\`eme', + 'seizi\`eme', + 'dix-septi\`eme', + 'dix-huiti\`eme', + 'dix-neuvi\`eme'); + +@unitstringfrench = ('zero', + 'un', + 'deux', + 'trois', + 'quatre', + 'cinq', + 'six', + 'sept', + 'huit', + 'neuf'); + +@teenstringfrench = ('dix', + 'onze', + 'douze', + 'treize', + 'quatorze', + 'quinze', + 'seize', + 'dix-sept', + 'dix-huit', + 'dix-neuf'); + +@tenstringfrench = ('', + 'dix', + 'vingt', + 'trente', + 'quarante', + 'cinquante', + 'soixante', + 'septente', + 'huitante', + 'nonente'); + +$hundrednamefrench = "cent"; +$hundredthnamefrench = "centi\\`eme"; +$thousandnamefrench = "mille"; +$thousandthnamefrench = "mili\\`eme"; + +@unitthstringspanish = ('cero', + 'primero', + 'segundo', + 'tercero', + 'cuarto', + 'quinto', + 'sexto', + 's\\\'eptimo', + 'octavo', + 'noveno'); + +@tenthstringspanish = ('', + 'd\\\'ecimo', + 'vig\\\'esimo', + 'trig\\\'esimo', + 'cuadrag\\\'esimo', + 'quincuag\\\'esimo', + 'sexag\\\'esimo', + 'septuag\\\'esimo', + 'octog\\\'esimo', + 'nonag\\\'esimo'); + +@teenthstringspanish = ('d\\\'ecimo', + 'und\\\'ecimo', + 'duod\\\'ecimo', + 'decimotercero', + 'decimocuarto', + 'decimoquinto', + 'decimosexto', + 'decimos\\\'eptimo', + 'decimoctavo', + 'decimonoveno'); + +@hundredthstringspanish = ('', + 'cent\\\'esimo', + 'ducent\\\'esimo', + 'tricent\\\'esimo', + 'cuadringent\\\'esimo', + 'quingent\\\'esimo', + 'sexcent\\\'esimo', + 'septing\\\'esimo', + 'octingent\\\'esimo', + 'noningent\\\'esimo'); + +@unitstringspanish = ('cero', + 'uno', + 'dos', + 'tres', + 'cuatro', + 'cinco', + 'seis', + 'siete', + 'ocho', + 'nueve'); + +@teenstringspanish = ('diez', + 'once', + 'doce', + 'trece', + 'catorce', + 'quince', + 'diecis\\\'eis', + 'diecisiete', + 'dieciocho', + 'diecinueve'); + +@twentystringspanish = ('viente', + 'vientiuno', + 'vientid\\\'os', + 'vientitr\\\'es', + 'vienticuatro', + 'vienticinco', + 'vientis\\\'eis', + 'vientisiete', + 'vientiocho', + 'vientinueve'); + +@tenstringspanish = ('', + 'diez', + 'viente', + 'treinta', + 'cuarenta', + 'cincuenta', + 'sesenta', + 'setenta', + 'ochenta', + 'noventa'); + +@hundredstringspanish = ('', + 'ciento', + 'doscientos', + 'trescientos', + 'cuatrocientos', + 'quinientos', + 'seiscientos', + 'setecientos', + 'ochocientos', + 'novecientos'); + +$hundrednamespanish = "cien"; +$hundredthnamespanish = "centi\\`eme"; +$thousandnamespanish = "mil"; +$thousandthnamespanish = "mil\\'esimo"; + +@unitthstringportuges = ('zero', + 'primeiro', + 'segundo', + 'terceiro', + 'quatro', + 'quinto', + 'sexto', + 's\\\'etimo', + 'oitavo', + 'nono'); + +@tenthstringportuges = ('', + 'd\\\'ecimo', + 'vig\\\'esimo', + 'trig\\\'esimo', + 'quadrag\\\'esimo', + 'q\"uinquag\\\'esimo', + 'sexag\\\'esimo', + 'setuag\\\'esimo', + 'octog\\\'esimo', + 'nonag\\\'esimo'); + +@hundredthstringportuges = ('', + 'cent\\\'esimo', + 'ducent\\\'esimo', + 'trecent\\\'esimo', + 'quadringent\\\'esimo', + 'q\"uingent\\\'esimo', + 'seiscent\\\'esimo', + 'setingent\\\'esimo', + 'octingent\\\'esimo', + 'nongent\\\'esimo'); + +@unitstringportuges = ('zero', + 'um', + 'dois', + 'tr\`es', + 'quatro', + 'cinco', + 'seis', + 'sete', + 'oito', + 'nove'); + +@teenstringportuges = ('dez', + 'onze', + 'doze', + 'treze', + 'quatorze', + 'quinze', + 'dezesseis', + 'dezessete', + 'dezoito', + 'dezenove'); + +@tenstringportuges = ('', + 'dez', + 'vinte', + 'trinta', + 'quaranta', + 'cinq\"uenta', + 'sessenta', + 'setenta', + 'oitenta', + 'noventa'); + +@hundredstringportuges = ('', + 'cento', + 'duzentos', + 'trezentos', + 'quatrocentos', + 'quinhentos', + 'seiscentos', + 'setecentos', + 'oitocentos', + 'novecentos'); + +$hundrednameportuges = "cem"; +$thousandnameportuges = "mil"; +$thousandthnameportuges = "mil\\'esimo"; + +sub get_numberstringfrench{ + local($num,$gender) = @_; + local($name)=""; + + if ($gender eq 'f') + { + $unitstringfrench[1] = 'une'; + } + else + { + $unitstringfrench[1] = 'un'; + } + + unless (($num >= 1000000) || ($num < 0)) + { + if ($num >= 1000) + { + local($thousands) = ''; + + if ($num >= 2000) + { + $thousands = &get_numberstringfrench($num/1000,$gender).' '; + } + + $name .= $thousands . $thousandnamefrench; + $num = $num%1000; + } + + if ($num >= 100) + { + if ($_[0] >= 1000) { $name .= " "; } + + local($hundreds) = ''; + + if ($num >= 200) + { + $hundreds = &get_numberstringfrench($num/100,$gender).' '; + } + + $name .= $hundreds . $hundrednamefrench; + $num = $num%100; + + if (($_[0]%100 == 0) && ($_[0]/100 > 1)) + { + $name .= 's'; + } + } + + if (($_[0] > 100) && ($_[0]%100 > 0)) { $name .= " "; } + + if ($num >= 20) + { + if ($frenchdialect eq 'france' and $num >= 70) + { + if ($num < 80) + { + $name .= $tenstringfrench[6]; + + if ($num%10 == 1) + { + $name .= ' et '; + } + else + { + $name .= '-'; + } + + $num = 10+($num%10); + } + else + { + $name .= 'quatre-vingt' . ($num==80?'s':'-'); + + if ($num >= 90) + { + $num = 10+($num%10); + } + } + } + elsif ($frenchdialect eq 'belgian' + && ($num >= 80) && ($num < 90)) + { + $name .= 'quatre-vingt' . ($num==80?'s':'-'); + } + else + { + $name .= $tenstringfrench[$num/10]; + + if ($num%10 == 1) { $name .= ' et ';} + elsif ($num%10 > 0) { $name .= '-'; } + } + } + + if (($num >= 10) && ($num < 20)) + { + $name .= $teenstringfrench[$num%10]; + } + elsif (($num%10 > 0) || ($_[0] == 0)) + { + $name .= $unitstringfrench[$num%10]; + } + } + + $name; +} + +sub get_numberstringspanish{ + local($num,$gender) = @_; + local($name)=""; + + if ($gender eq 'f') + { + $unitstringspanish[1] = 'una'; + } + else + { + $unitstringspanish[1] = 'uno'; + } + + unless (($num >= 1000000) || ($num < 0)) + { + if ($num >= 1000) + { + local($thousands) = ''; + + if ($num >= 2000) + { + $thousands = &get_numberstringspanish($num/1000,$gender).' '; + } + + $name .= $thousands . $thousandnamespanish; + $num = $num%1000; + } + + if ($num >= 100) + { + if ($_[0] >= 1000) { $name .= " "; } + + local($hundreds) = ''; + + if ($num > 100) + { + $hundreds = $hundredstringspanish[$num/100]; + } + else + { + $hundreds = 'cien'; + } + + $name .= $hundreds; + $num = $num%100; + } + + if (($_[0] > 100) && ($_[0]%100 > 0)) { $name .= " y "; } + + if ($num >= 30) + { + $name .= $tenstringspanish[$num/10]; + + if ($num%10 > 0) { $name .= ' y '; } + } + + if (($num >=20) && ($num < 30)) + { + $name .= $twentystringspanish[$num%10]; + } + elsif (($num >= 10) && ($num < 20)) + { + $name .= $teenstringspanish[$num%10]; + } + elsif (($num%10 > 0) || ($_[0] == 0)) + { + $name .= $unitstringspanish[$num%10]; + } + } + + $name; +} + +sub get_numberstringportuges{ + local($num,$gender) = @_; + local($name)=""; + + if ($gender eq 'f') + { + $unitstringportuges[0] = 'zera'; + $unitstringportuges[1] = 'uma'; + $unitstringportuges[2] = 'duas'; + } + else + { + $unitstringportuges[0] = 'zero'; + $unitstringportuges[1] = 'um'; + $unitstringportuges[2] = 'dois'; + } + + unless (($num >= 1000000) || ($num < 0)) + { + if ($num >= 1000) + { + local($thousands) = ''; + + if ($num >= 2000) + { + $thousands = &get_numberstringportuges($num/1000,$gender).' '; + } + + $name .= $thousands . $thousandnameportuges; + $num = $num%1000; + } + + if ($num >= 100) + { + if ($_[0] >= 1000) { $name .= " "; } + + local($hundreds) = ''; + + if ($num > 100) + { + $hundreds = $hundredstringportuges[$num/100]; + + if ($gender eq 'f') + { + $hundreds =~s/o(s?)$/a\1/; + } + } + else + { + $hundreds = $hundrednameportuges; + } + + $name .= $hundreds; + $num = $num%100; + } + + if (($_[0] > 100) && ($_[0]%100 > 0)) { $name .= " e "; } + + if ($num >= 20) + { + $name .= $tenstringportuges[$num/10]; + + if ($num%10 == 1) { $name .= ' e ';} + elsif ($num%10 > 0) { $name .= ' '; } + } + + if (($num >= 10) && ($num < 20)) + { + $name .= $teenstringportuges[$num%10]; + } + elsif (($num%10 > 0) || ($_[0] == 0)) + { + $name .= $unitstringportuges[$num%10]; + } + } + + $name; +} + +sub get_numberstring{ + local($val,$gender) = @_; + + if ($default_language eq 'french') + { + &get_numberstringfrench($val,$gender); + } + elsif ($default_language eq 'spanish') + { + &get_numberstringspanish($val,$gender); + } + elsif ($default_language eq 'portuges') + { + &get_numberstringportuges($val,$gender); + } + else + { + &get_numberstringenglish($val); + } +} + +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('', &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('', '{NUMBERSTRING{', $ctr, '}}', $_[0]); + } + else + { + join('', &get_numberstring($val, $gender), $_[0]); + } +} + +sub get_Numberstring{ + local($val,$gender) = @_; + local($string) = &get_numberstring($val,$gender); + $string =~ s/([a-z])([^\s\-]+)/\u\1\2/g; + + if ($default_language eq 'french') + { + $string =~ s/ Et / et /g; + } + elsif ($default_language eq 'spanish') + { + $string =~ s/ Y / y /g; + } + elsif ($default_language eq 'portuges') + { + $string =~ s/ E / e /g; + } + else + { + $string =~ s/ And / and /g; + } + + $string; +} + +sub do_cmd_Numberstringnum{ + local($_) = @_; + local($num,$gender); + $num = &missing_braces + unless (($_[0]=~s/$next_pair_pr_rx//o)&&($num=$2)); + + if ($_[0] =~ s/\[(m|f)\]//) + { + $gender = $1; + } + else + { + $gender = 'm'; + } + + join('', &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('', '{NNUMBERSTRING{', $ctr, '}}', $_[0]); + } + else + { + join('', &get_Numberstring($val, $gender), $_[0]); + } +} + +sub get_ordinalstringenglish{ + local($num) = @_; + local($name)=""; + + unless (($num >= 1000000) || ($num < 0)) + { + if ($num >= 1000) + { + local($thousands) = &get_numberstring($num/1000); + $name .= $thousands; + + if ($num%1000 > 0) + { + $name .= " $thousandname"; + } + else + { + $name .= " $thousandthname"; + } + + $num = $num%1000; + } + + if ($num >= 100) + { + if ($_[0] >= 1000) { $name .= " "; } + + local($hundreds) = &get_numberstring($num/100); + $name .= $hundreds; + + if ($num%100 > 0) + { + $name .= " $hundredname"; + } + else + { + $name .= " $hundredthname"; + } + + $num = $num%100; + } + + if (($_[0] > 100) && ($_[0]%100 > 0)) { $name .= " and "; } + + if ($num >= 20) + { + if ($num%10 > 0) + { + $name .= $tenstring[$num/10] . '-'; + } + else + { + $name .= $tenthstring[$num/10]; + } + } + + if (($num >= 10) && ($num < 20)) + { + $name .= $teenthstring[$num%10]; + } + elsif (($num%10 > 0) || ($_[0] == 0)) + { + $name .= $unitthstring[$num%10]; + } + } + + $name; +} + +sub get_ordinalstringfrench{ + local($num,$gender) = @_; + local($name)=""; + + unless (($num >= 1000000) || ($num < 0)) + { + if ($num >= 1000) + { + local($thousands) = ''; + + if ($num >= 2000) + { + $thousands = &get_numberstringfrench($num/1000,$gender).' '; + } + + $num = $num%1000; + + if ($num > 0) + { + $name .= $thousands . $thousandnamefrench; + } + else + { + $name .= $thousands . $thousandthnamefrench; + } + } + + if ($num >= 100) + { + if ($_[0] >= 1000) { $name .= " "; } + + local($hundreds) = ''; + + if ($num >= 200) + { + $hundreds = &get_numberstringfrench($num/100,$gender).' '; + } + + $num = $num%100; + + if ($num > 0) + { + $name .= $hundreds . $hundrednamefrench; + } + else + { + $name .= $hundreds . $hundredthnamefrench; + } + } + + if (($_[0] > 100) && ($_[0]%100 > 0)) { $name .= " "; } + + if ($num >= 20) + { + if ($frenchdialect eq 'france' and $num >= 70) + { + if ($num < 80) + { + if ($num%10 > 0) + { + $name .= $tenstringfrench[6]; + } + else + { + $name .= $tenthstringfrench[6]; + } + + if ($num%10 == 1) + { + $name .= ' et '; + } + else + { + $name .= '-'; + } + + $num = 10+($num%10); + } + else + { + $name .= 'quatre-vingt' . ($num==80?'i\`eme':'-'); + + if ($num >= 90) + { + $num = 10+($num%10); + } + } + } + elsif ($frenchdialect eq 'belgian' and $num >= 80) + { + $name .= 'quatre-vingt' . ($num==80?'i\`eme':'-'); + + if ($num >= 90) + { + $num = 10+($num%10); + } + } + else + { + if ($num%10 > 0) + { + $name .= $tenstringfrench[$num/10]; + } + else + { + $name .= $tenthstringfrench[$num/10]; + } + + if ($num%10 == 1) { $name .= ' et ';} + elsif ($num%10 > 0) { $name .= '-'; } + } + } + + if (($num >= 10) && ($num < 20)) + { + $name .= $teenthstringfrench[$num%10]; + } + elsif ($_[0] == 1) + { + $name = 'premi\`ere'; + } + elsif (($num%10 > 0) || ($_[0] == 0)) + { + $name .= $unitthstringfrench[$num%10]; + } + } + + $name; +} + +sub get_ordinalstringspanish{ + local($num,$gender) = @_; + local($name)=""; + local($str); + + unless (($num >= 1000000) || ($num < 0)) + { + if ($num >= 1000) + { + if ($num >= 2000) + { + local($thousands) = &get_ordinalstringspanish($num/1000); + + if ($gender eq 'f') + { + $thousands =~s/o(s?)$/a\1/; + } + + $name .= $thousands. " "; + } + else + { + $name = ""; + } + + $name .= "$thousandthnamespanish"; + + if ($gender eq 'f') + { + $name =~s/o$/a/; + } + + $num = $num%1000; + } + + if ($num >= 100) + { + if ($_[0] >= 1000) { $name .= " "; } + + local($hundreds) = $hundredthstringspanish[$num/100]; + + if ($gender eq 'f') + { + $hundreds =~s/o$/a/; + } + + $name .= $hundreds; + + $num = $num%100; + } + + if (($_[0] > 100) && ($_[0]%100 > 0)) { $name .= " "; } + + local($lastbit)=""; + + if ($num >= 20) + { + $lastbit = $tenthstringspanish[$num/10]; + + if ($num%10 > 0) + { + $lastbit .= ' '; + } + + if ($gender eq 'f') + { + $lastbit =~s/o([ s]*)$/a\1/; + } + + $name .= $lastbit; + + $lastbit = ""; + } + + if (($num >= 10) && ($num < 20)) + { + $lastbit = $teenthstringspanish[$num%10]; + } + elsif (($num%10 > 0) || ($_[0] == 0)) + { + $lastbit = $unitthstringspanish[$num%10]; + } + + if ($gender eq 'f') + { + $lastbit =~s/o([ s]*)$/a\1/; + } + + $name .= $lastbit; + } + + $name; +} + +sub get_ordinalstringportuges{ + local($num,$gender) = @_; + local($name)=""; + local($str); + + unless (($num >= 1000000) || ($num < 0)) + { + if ($num >= 1000) + { + if ($num >= 2000) + { + local($thousands) = &get_ordinalstringportuges($num/1000); + + if ($gender eq 'f') + { + $thousands =~s/o(s?)$/a\1/; + } + + $name .= $thousands. " "; + } + else + { + $name = ""; + } + + $name .= "$thousandthnameportuges"; + + if ($gender eq 'f') + { + $name =~s/o$/a/; + } + + $num = $num%1000; + } + + if ($num >= 100) + { + if ($_[0] >= 1000) { $name .= " "; } + + local($hundreds) = $hundredthstringportuges[$num/100]; + + if ($gender eq 'f') + { + $hundreds =~s/o$/a/; + } + + $name .= $hundreds; + + $num = $num%100; + } + + if (($_[0] > 100) && ($_[0]%100 > 0)) { $name .= "-"; } + + local($lastbit)=""; + + if ($num >= 10) + { + $lastbit = $tenthstringportuges[$num/10]; + + if ($num%10 > 0) + { + $lastbit .= '-'; + } + + if ($gender eq 'f') + { + $lastbit =~s/o([ s]*)$/a\1/; + } + + $name .= $lastbit; + + $lastbit = ""; + } + + if (($num%10 > 0) || ($_[0] == 0)) + { + $lastbit = $unitthstringportuges[$num%10]; + } + + if ($gender eq 'f') + { + $lastbit =~s/o([ s]*)$/a\1/; + } + + $name .= $lastbit; + } + + $name; +} + +sub get_ordinalstring{ + local($val,$gender) = @_; + + if ($default_language eq 'french') + { + &get_ordinalstringfrench($val,$gender); + } + elsif ($default_language eq 'spanish') + { + &get_ordinalstringspanish($val,$gender); + } + elsif ($default_language eq 'portuges') + { + &get_ordinalstringportuges($val,$gender); + } + else + { + &get_ordinalstringenglish($val); + } +} + +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('', &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('', '{ORDINALSTRING{', $ctr, '}}', $_[0]); + } + else + { + join('', &get_ordinalstring($val, $gender), $_[0]); + } +} + +sub get_Ordinalstring{ + local($val,$gender) = @_; + local($string) = &get_ordinalstring($val,$gender); + $string =~ s/([a-z])([^\s\-]+)/\u\1\2/g; + + if ($default_language eq 'french') + { + $string =~ s/ Et / et /g; + } + else + { + $string =~ s/ And / and /g; + } + + $string; +} + +sub do_cmd_Ordinalstringnum{ + local($_) = @_; + local($num,$gender); + $num = &missing_braces + unless (($_[0]=~s/$next_pair_pr_rx//o)&&($num=$2)); + + if ($_[0] =~ s/\[(m|f)\]//) + { + $gender = $1; + } + else + { + $gender = 'm'; + } + + join('', &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('', '{OORDINALSTRING{', $ctr, '}}', $_[0]); + } + else + { + join('', &get_Ordinalstring($val, $gender), $_[0]); + } +} + +sub do_cmd_fmtcountsetoptions{ + local($_) = @_; + local($options) = &missing_braces unless ($_[0]=~(s/$next_pair_pr_rx//o)&&($options=$2)); + + if ($options =~ m/french=?(\w*)(,|$)/) + { + if ($1 eq 'france' or $1 eq 'swiss' or $1 eq 'belgian') + { + $frenchdialect = $1; + + print "Using French dialect: $1" if ($VERBOSITY > 0) ; + } + elsif ($1 eq '') + { + $frenchdialect = 'france'; + + print "Using French dialect: france" if ($VERBOSITY > 0); + } + else + { + &write_warnings("unknown french dialect '$1'"); + } + } + + if ($options =~ m/abbrv=?(\w*)(,|$)/) + { + if ($1 eq 'true' or $1 eq '') + { + $ordinalabbrv = 1; + + print "Setting abbrv=true" if ($VERBOSITY > 0); + } + elsif ($1 eq 'false') + { + $ordinalabbrv = 0; + + print "Setting abbrv=false" if ($VERBOSITY > 0); + } + else + { + &write_warnings("fmtcountsetoptions key abbrv: unknown value '$1'."); + } + } + + if ($options =~ m/fmtord=(\w*)(,|$)/) + { + if ($1 eq 'raise') + { + &do_fmtcount_raise(); + + print "Using raised ordinals" if ($VERBOSITY > 0); + } + elsif ($1 eq 'level') + { + &do_fmtcount_level(); + + print "Using level ordinals" if ($VERBOSITY > 0); + } + elsif ($1 eq 'user') + { + # do nothing + + print "Using user defined fmtord" if ($VERBOSITY > 0); + } + else + { + &write_warnings("unknown fmtcount option fmtord=$1"); + } + } + + $_[0]; +} + +$padzeroes = 0; + +sub do_cmd_padzeroes{ + local($_) = @_; + local($val,$pat) = &get_next_optional_argument; + + if ($val eq '') + { + $padzeroes = 17; + } + else + { + $padzeroes = $val; + } + + $_; +} + +sub get_binary{ + local($num) = @_; + local($val) = ""; + + for (my $i=17; $i>=0; $i--) + { + if (($i < $padzeroes) || ($num & (1 << $i)) || !($val eq "")) + { + $val .= ($num & (1 << $i) ? 1 : 0); + } + } + + $val; +} + +sub do_cmd_binary{ + local($ctr, $val, $id, $_) = &read_counter_value($_[0]); + + join('', &get_binary($val), $_); +} + +sub do_cmd_binarynum{ + local($_) = @_; + local($num) = &missing_braces unless ($_[0]=~(s/$next_pair_pr_rx//o)&&($num=$2)); + + join('', &get_binary($num), $_); +} + +sub get_decimal{ + local($num) = @_; + + sprintf "%0${padzeroes}d", $num; +} + +sub do_cmd_decimal{ + local($ctr, $val, $id, $_) = &read_counter_value($_[0]); + + join('', &get_decimal($val), $_); +} + +sub do_cmd_decimalnum{ + local($_) = @_; + local($num) = &missing_braces unless ($_[0]=~(s/$next_pair_pr_rx//o)&&($num=$2)); + + join('', &get_decimal($num), $_); +} + +sub get_hexadecimal{ + local($num) = @_; + + sprintf "%0${padzeroes}lx", $num; +} + +sub do_cmd_hexadecimal{ + local($ctr, $val, $id, $_) = &read_counter_value($_[0]); + + join('', &get_hexadecimal($val), $_); +} + +sub do_cmd_hexadecimalnum{ + local($_) = @_; + local($num) = &missing_braces unless ($_[0]=~(s/$next_pair_pr_rx//o)&&($num=$2)); + + join('', &get_hexadecimal($num), $_); +} + +sub get_Hexadecimal{ + local($num) = @_; + + sprintf "%0${padzeroes}lX", $num; +} + +sub do_cmd_Hexadecimal{ + local($ctr, $val, $id, $_) = &read_counter_value($_[0]); + + join('', &get_Hexadecimal($val), $_); +} + +sub do_cmd_Hexadecimalnum{ + local($_) = @_; + local($num) = &missing_braces unless ($_[0]=~(s/$next_pair_pr_rx//o)&&($num=$2)); + + join('', &get_Hexadecimal($num), $_); +} + +sub get_octal{ + local($num) = @_; + + sprintf "%0${padzeroes}lo", $num; +} + +sub do_cmd_octal{ + local($ctr, $val, $id, $_) = &read_counter_value($_[0]); + + join('', &get_octal($val), $_); +} + +sub do_cmd_octalnum{ + local($_) = @_; + local($num) = &missing_braces unless ($_[0]=~(s/$next_pair_pr_rx//o)&&($num=$2)); + + join('', &get_octal($num), $_); +} + +sub get_aaalph{ + local($num) = @_; + local($rep) = int($num/26) + 1; + local($c) = chr(ord('a')-1+$num%26); + + local($_) = $c x $rep; +} + +sub do_cmd_aaalph{ + local($ctr, $val, $id, $_) = &read_counter_value($_[0]); + + join('', &get_aaalph($val), $_); +} + +sub get_AAAlph{ + local($num) = @_; + local($rep) = int($num/26) + 1; + local($c) = chr(ord('A')-1+$num%26); + + local($_) = $c x $rep; +} + +sub do_cmd_AAAlph{ + local($ctr, $val, $id, $_) = &read_counter_value($_[0]); + + join('', &get_AAAlph($val), $_); +} + +sub do_cmd_aaalphnum{ + local($_) = @_; + local($num) = &missing_braces unless ($_[0]=~(s/$next_pair_pr_rx//o)&&($num=$2)); + + join('', (sprintf "%${padzeroes}s", &get_aaalph($num)), $_); +} + +sub do_cmd_AAAlphnum{ + local($_) = @_; + local($num) = &missing_braces unless ($_[0]=~(s/$next_pair_pr_rx//o)&&($num=$2)); + + join('', uc(sprintf "%${padzeroes}s", &get_aaalph($num)), $_); +} + +sub get_abalph{ + local($num) = @_; + local($str); + + if ($num == 0) + { + $str = ''; + } + elsif ($num > 0 && $num <= 26) + { + $str = chr(ord('a')-1+$num); + } + else + { + $str = &get_abalph(int($num/26)) . chr(ord('a')-1+($num%26)); + } + + $str; +} + +sub do_cmd_abalph{ + local($ctr, $val, $id, $_) = &read_counter_value($_[0]); + + join('', (sprintf "%${padzeroes}s", &get_abalph($val)), $_); +} + +sub do_cmd_abalphnum{ + local($_) = @_; + local($num) = &missing_braces unless ($_[0]=~(s/$next_pair_pr_rx//o)&&($num=$2)); + + join('', (sprintf "%${padzeroes}s", &get_abalph($num)), $_); +} + +sub do_cmd_ABAlph{ + local($ctr, $val, $id, $_) = &read_counter_value($_[0]); + + join('', uc(sprintf "%${padzeroes}s", &get_abalph($val)), $_); +} + +sub do_cmd_ABAlphnum{ + local($_) = @_; + local($num) = &missing_braces unless ($_[0]=~(s/$next_pair_pr_rx//o)&&($num=$2)); + + join('', uc(sprintf "%${padzeroes}s", &get_abalph($num)), $_); +} + +sub get_twodigit{ + local($num) = @_; + + sprintf "%02d", $num; +} + +sub do_cmd_twodigit{ + local($_) = @_; + local($num) = &missing_braces unless ($_[0]=~(s/$next_pair_pr_rx//o)&&($num=$2)); + + # this is a cludge + if ($num eq "THEDAY" or $num eq "THEYEAR" or $num eq "THEMONTH") + { + join('', 'TWODIGIT{', $num, '}', $_[0]); + } + else + { + join('', get_twodigit($num), $_[0]); + } +} + +# this was put here to help with the definition of \datelatin + +sub do_cmd_romannumeral{ + local($_) = @_; + local($num) = &missing_braces unless ($_[0]=~(s/$next_pair_pr_rx//o)&&($num=$2)); + + # this is a cludge + if ($num eq "THEDAY" or $num eq "THEYEAR" or $num eq "THEMONTH") + { + join('', 'ROMANNUMERAL{', $num, '}', $_[0]); + } + else + { + join('', &froman($num), $_[0]); + } +} + +# load configuration file if it exists +# Note: The configuration file should be loaded before +# the package options are executed. + +# why doesn't this work? If I call this subroutine it +# causes an infinite loop. + +sub load_fmtcount_cfg{ + local($file,$found); + + $file = &fulltexpath('fmtcount.cfg'); + + $found = (-f $file); + + if (!$found) + { + foreach $texpath (split /$envkey/, $TEXINPUTS) + { + $file = "$texpath${dd}fmtcount.cfg"; + + last if ($found = (-f $file)); + } + } + + if ($found) + { + print "\nusing configuration file $file\n"; + + &slurp_input($file); + &pre_process; + &substitute_meta_cmds if (%new_command || %new_environment); + &wrap_shorthand_environments; + $_ = &translate_commands(&translate_environments($_)); + + print "\n processed size: ".length($_)."\n" if ($VERBOSITY>1) + } + else + { + print "\nNo configuation file fmtcount.cfg found\n" if ($VERBOSITY>1) + } +} + +1; diff --git a/Master/texmf-dist/doc/latex/fmtcount/manual.html b/Master/texmf-dist/doc/latex/fmtcount/manual.html new file mode 100644 index 00000000000..9fa76258784 --- /dev/null +++ b/Master/texmf-dist/doc/latex/fmtcount/manual.html @@ -0,0 +1,439 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> + +<!--Converted with jLaTeX2HTML 2002-2-1 (1.70) JA patch-2.0 +patched version by: Kenshi Muto, Debian Project. +* modified by: Shige TAKENO +LaTeX2HTML 2002-2-1 (1.70), +original version by: Nikos Drakos, CBLU, University of Leeds +* revised and updated by: Marcus Hennecke, Ross Moore, Herb Swan +* with significant contributions from: + Jens Lippmann, Marek Rouchal, Martin Wilck and others --> +<HTML> +<HEAD> +<TITLE>fmtcount.sty v1.03: Displaying the Values of LaTeX Counters</TITLE> +<META NAME="description" CONTENT="fmtcount.sty v1.03: Displaying the Values of LaTeX Counters"> +<META NAME="keywords" CONTENT="manual"> +<META NAME="resource-type" CONTENT="document"> +<META NAME="distribution" CONTENT="global"> + +<META NAME="Generator" CONTENT="jLaTeX2HTML v2002-2-1 JA patch-2.0"> +<META HTTP-EQUIV="Content-Style-Type" CONTENT="text/css"> + + +</HEAD> + +<BODY > +<A NAME="tex2html1" + HREF="http://theoval.cmp.uea.ac.uk/~nlct/">Dr Nicola Talbot</A> +| +<A NAME="tex2html2" + HREF="http://www.cmp.uea.ac.uk/">School of Computing Sciences</A> +| +<A NAME="tex2html3" + HREF="http://www.uea.ac.uk/">University of East Anglia</A> + +<P> + + <H1 ALIGN="CENTER">fmtcount.sty v1.03: Displaying the Values of +LaTeX Counters</H1> +<DIV> + +<P ALIGN="CENTER"><STRONG>N.L.C. Talbot</STRONG></P> +<P ALIGN="CENTER"><STRONG>1 July 2005</STRONG></P> +</DIV> + <BR> + +<H2><A NAME="SECTION00010000000000000000"> +Contents</A> +</H2> +<!--Table of Contents--> + +<UL> +<LI><A NAME="tex2html16" + HREF="manual.html#SECTION00020000000000000000">Introduction</A> +<LI><A NAME="tex2html17" + HREF="manual.html#SECTION00030000000000000000">Installation</A> +<LI><A NAME="tex2html18" + HREF="manual.html#SECTION00040000000000000000">Available Commands</A> +<LI><A NAME="tex2html19" + HREF="manual.html#SECTION00050000000000000000">Package Options</A> +<LI><A NAME="tex2html20" + HREF="manual.html#SECTION00060000000000000000">Multilingual Support</A> +<LI><A NAME="tex2html21" + HREF="manual.html#SECTION00070000000000000000">Configuration File fmtcount.cfg</A> +<LI><A NAME="tex2html22" + HREF="manual.html#SECTION00080000000000000000">LaTeX2HTML style</A> +<LI><A NAME="tex2html23" + HREF="manual.html#SECTION00090000000000000000">Acknowledgements</A> +<LI><A NAME="tex2html24" + HREF="manual.html#SECTION000100000000000000000">Contact Details</A> +</UL> +<!--End of Table of Contents--> +<H1><A NAME="SECTION00020000000000000000"> +Introduction</A> +</H1> +The <TT>fmtcount</TT> package provides commands to display +the values of LaTeX counters in a variety of formats. It also +provides equivalent commands for actual numbers rather than +counter names. Limited multilingual support is available. + +<P> + +<H1><A NAME="SECTION00030000000000000000"> +Installation</A> +</H1> + +<P> +This package is distributed with the files <TT>fmtcount.dtx</TT> +and <TT>fmtcount.ins</TT>. To extract the code do: +<PRE> +latex fmtcount.ins +</PRE> +This will create the files <TT>fmtcount.sty</TT> and +<TT>fmtcount.perl</TT>, along with several <TT>.def</TT> files. +Place <TT>fmtcount.sty</TT> and the <TT>.def</TT> files somewhere +where LaTeX will find them (e.g. <TT>texmf/tex/latex/fmtcount/</TT>) and place <TT>fmtcount.perl</TT> somewhere where LaTeX2HTML +will find it (e.g. latex2html/styles). Remember to refresh +the TeX database (using <TT>texhash</TT> under Linux, for +other operating systems check the manual.) + +<P> + +<H1><A NAME="SECTION00040000000000000000"> +Available Commands</A> +</H1> + +<P> +The commands can be divided into two categories: those that +take the name of a counter as the argument, and those +that take a number as the argument. + +<P> +The macro <code>\ordinal{</code><I>counter</I><code>}</code> will + print the value of a LaTeX counter <I>counter</I> as an ordinal, + + where the macro <code>\fmtord{</code><I>text</I><code>}</code> is used to format the st,nd,rd,th bit. + By default the ordinal is formatted as a superscript, if the package option <TT>level</TT> + is used, it is level with the text. + For example, if the current section is 3, then <code>\ordinal{section}</code> will produce + the output: 3<SUP>rd</SUP>. + +<P> +The macro <code>\ordinalnum</code> is like <code>\ordinal</code> +but takes an actual number rather than a counter as the +argument. For example: <code>\ordinalnum{3}</code> will +produce: 3<SUP>rd</SUP>. + +<P> +The macro <code>\numberstring{</code><I>counter</I><code>}</code> will print the value + of <I>counter</I> as text. E.g. <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 with initial letters in uppercase. For + example, <code>\Numberstring{section}</code> will produce: Three. + +<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 +rather than a counter as the argument. For example: +<code>\Numberstringnum{105}</code> will produce: One Hundred and Five. + +<P> +The macro <code>\ordinalstring{</code><I>counter</I><code>}</code> will print the + value of <I>counter</I> as a textual ordinal. E.g. <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 initial letters in uppercase. For example, + <code>\Ordinalstring{section}</code> will produce: Third. + +<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 +rather than a counter as the argument. For example, +<code>\ordinalstringnum{3}</code> will produce: third. + +<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 +<code>\padzeroes[</code><I>n</I><code>]</code> +will ensure numbers are written to <I>n</I> digits, padding with +zeroes if necessary. E.g. <code>\padzeroes[8]\binary{section}</code> +will produce: 00000011. + The default value for <I>n</I> is 17. + +<P> +The macro <code>\binarynum</code> is like <code>\binary</code> +but takes an actual number rather than a counter as the +argument. For example: <code>\binarynum{5}</code> will +produce: 101. + +<P> +The macro <code>\octal{</code><I>counter</I><code>}</code> will print the +value of <I>counter</I> as an octal number. For example, if you +have a counter called, say <TT>mycounter</TT>, and you set the +value to 125, then <code>\octal{mycounter}</code> will produce: 177. + Again, the number will be padded with zeroes if necessary, +depending on whether <code>\padzeroes</code> has been used. + +<P> +The macro <code>\octalnum</code> is like <code>\octal</code> +but takes an actual number rather than a counter as the +argument. For example: <code>\octalnum{125}</code> will +produce: 177. + +<P> +The macro <code>\hexadecimal{</code><I>counter</I><code>}</code> will print +the value of <I>counter</I> as a hexadecimal number. Going back +to the previous example, <code>\hexadecimal{mycounter}</code> will + produce: 7d. Again, the number will be padded with zeroes if +necessary, depending on whether <code>\padzeroes</code> has been used. + + <code>\Hexadecimal{</code><I>counter</I><code>}</code> does the same thing, +but uses uppercase characters, e.g. + <code>\Hexadecimal{mycounter}</code> will produce: 7D. + +<P> +The macros <code>\hexadecimalnum</code> and +<code>\Hexadecimalnum</code> are like +<code>\hexadecimal</code> and <code>\Hexadecimal</code> +but take an actual number rather than a counter as the +argument. For example: <code>\hexadecimalnum{125}</code> will +produce: 7d, and <code>\Hexadecimalnum{125}</code> will +produce: 7D. + +<P> +The macro <code>\decimal{</code><I>counter</I><code>}</code> is similar to +<code>\arabic</code> but the number can be padded with zeroes + depending on whether <code>\padzeroes</code> has been used. +For example: <code>\padzeroes[8]\decimal{section}</code> will + produce: 00000005. + +<P> +The macro <code>\decimalnum</code> is like <code>\decimal</code> +but takes an actual number rather than a counter as the +argument. For example: <code>\padzeroes[8]\decimalnum{5}</code> will +produce: 00000005. + +<P> +The macro <code>\aaalph{</code><I>counter</I><code>}</code> will print the +value of <I>counter</I> as: a b ... z aa bb ... zz etc. + For example, <code>\aaalpha{mycounter}</code> will produce: uuuuu if +<TT>mycounter</TT> is set to 125. + + <code>\AAAlph{</code><I>counter</I><code>}</code> does the same thing, but +uses uppercase characters, e.g. + <code>\AAAlph{mycounter}</code> will produce: UUUUU. + +<P> +The macros <code>\aaalphnum</code> and +<code>\AAAlphnum</code> are like +<code>\aaalph</code> and <code>\AAAlph</code> +but take an actual number rather than a counter as the +argument. For example: <code>\aaalphnum{125}</code> will +produce: uuuuu, and <code>\AAAlphnum{125}</code> will +produce: UUUUU. + +<P> +The macro <code>\abalph{</code><I>counter</I><code>}</code> will print the +value of <I>counter</I> as: a b ... z aa ab ... az etc. + For example, <code>\abalpha{mycounter}</code> will produce: du if +<TT>mycounter</TT> is set to 125. + + <code>\ABAlph{</code><I>counter</I><code>}</code> does the same thing, but +uses uppercase characters, e.g. + <code>\ABAlph{mycounter}</code> will produce: DU. + +<P> +The macros <code>\abalphnum</code> and +<code>\ABAlphnum</code> are like +<code>\abalph</code> and <code>\ABAlph</code> +but take an actual number rather than a counter as the +argument. For example: <code>\abalphnum{125}</code> will +produce: du, and <code>\ABAlphnum{125}</code> will +produce: DU. + +<P> + +<H1><A NAME="SECTION00050000000000000000"> +Package Options</A> +</H1> + +<P> +The following options can be passed to this package: + +<P> +<TABLE CELLPADDING=3> +<TR><TD ALIGN="LEFT">raise</TD> +<TD ALIGN="LEFT">make ordinal st,nd,rd,th appear as superscript</TD> +</TR> +<TR><TD ALIGN="LEFT">level</TD> +<TD ALIGN="LEFT">make ordinal st,nd,rd,th appear level with rest of +text</TD> +</TR> +</TABLE> + +<P> +These can also be set using the command: + +<P> + +<code>\fmtcountsetoptions{fmtord=</code><I>type</I><code>}</code> + +<P> +where <I>type</I> is either <TT>level</TT> or +<TT>raise</TT>. + +<P> + +<H1><A NAME="SECTION00060000000000000000"> +Multilingual Support</A> +</H1> + +<P> +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="#foot179"><SUP>1</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 +selected language. + +<P> +If the French language is selected, the French (France) version +will be used by default (e.g. soxiante-dix for 70). To +select the Swiss or Belgian variants (e.g. septente for 70) use: +<code>\fmtcountsetoptions{french=</code><I>dialect</I><code>}</code> +where <I>dialect</I> is either <TT>swiss</TT> or <TT>belgian</TT>. +You can also use this command to change the action of +<code>\ordinal</code>. +<code>\fmtcountsetoptions{abbrv=true}</code> to produce ordinals +of the form 2<SUP>e</SUP> or +<code>\fmtcountsetoptions{abbrv=false}</code> to produce ordinals +of the form 2<SUP>eme</SUP> (default). + +<P> +The <TT>french</TT> and <TT>abbrv</TT> settings only have an +effect if the French language has been defined. + +<P> +The male gender for all languages is used by default, however +the feminine form can be obtained by passing <TT>f</TT> as +an optional argument to <code>\ordinal</code>, <code>\ordinalnum</code> etc. +For example: <code>\numberstring{section}[f]</code>. Note that the +optional argument comes <I>after</I> the compulsory argument. + +<P> +Let me know if you find any spelling mistakes (has been known +to happen in English, let alone other languages I'm not so +familiar with.) + +<P> + +<H1><A NAME="SECTION00070000000000000000"> +Configuration File <TT>fmtcount.cfg</TT></A> +</H1> + +<P> +You can save your preferred default settings to a file called +<TT>fmtcount.cfg</TT>, and place it on the TeX path. These +settings will then be loaded by the <TT>fmtcount</TT> +package. + +<P> +Note that if you are using the <TT>datetime</TT> package, +the <TT>datetime.cfg</TT> configuration file will override +the <TT>fmtcount.cfg</TT> configuration file. +For example, if <TT>datetime.cfg</TT> has the line: +<PRE> +\renewcommand{\fmtord}[1]{\textsuperscript{\underline{#1}}} +</PRE> +and if <TT>fmtcount.cfg</TT> has the line: +<PRE> +\fmtcountsetoptions{fmtord=level} +</PRE> +then the former definition of <code>\fmtord</code> will take +precedence. + +<P> + +<H1><A NAME="SECTION00080000000000000000"> +LaTeX2HTML style</A> +</H1> + +<P> +The LaTeX2HTML style file <TT>fmtcount.perl</TT> is provided. +The following limitations apply: + +<P> + +<UL> +<LI><code>\padzeroes</code> only has an effect in the preamble. + +<P> +</LI> +<LI>The configuration file +<TT>fmtcount.cfg</TT> is currently ignored. (This is because +I can't work out the correct code to do this. If you +know how to do this, please let me know.) You can however +do: +<PRE> +\usepackage{fmtcount} +\html{\input{fmtcount.cfg}} +</PRE> +This, I agree, is an unpleasant cludge. + +<P> +</LI> +</UL> + +<P> + +<H1><A NAME="SECTION00090000000000000000"> +Acknowledgements</A> +</H1> + +<P> +I would like to thank my mother for the French and Portuguese +support and my Spanish dictionary for the Spanish support. + +<P> + +<H1><A NAME="SECTION000100000000000000000"> +Contact Details</A> +</H1> + Dr Nicola Talbot +<BR> +School of Computing Sciences +<BR> +University of East Anglia +<BR> +Norwich. NR4 7TJ. +<BR> +United Kingdom. +<BR> <TT><A NAME="tex2html5" + 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="foot179">... defined</A><A + HREF="manual.html#tex2html4"><SUP>1</SUP></A></DT> +<DD>this +will be true if you have loaded <TT>babel</TT> + +</DD> +</DL> +<BR><HR> +<ADDRESS> +Dr Nicola L C Talbot +2005-07-04 +</ADDRESS> +</BODY> +</HTML> |