From b5d732b5920ac3f1cf3a2d53344c03d540559b4a Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Sat, 3 Oct 2009 18:49:59 +0000 Subject: interim fmtcount update git-svn-id: svn://tug.org/texlive/trunk@15620 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/doc/latex/fmtcount/CHANGES | 51 + Master/texmf-dist/doc/latex/fmtcount/README | 4 +- Master/texmf-dist/doc/latex/fmtcount/doc/CHANGES | 42 - .../texmf-dist/doc/latex/fmtcount/doc/fc-lang.tex | 254 -- .../texmf-dist/doc/latex/fmtcount/doc/fc-samp.tex | 98 - .../doc/latex/fmtcount/doc/fmtcount-manual.html | 700 ----- .../texmf-dist/doc/latex/fmtcount/doc/fmtcount.pdf | Bin 147903 -> 0 bytes Master/texmf-dist/doc/latex/fmtcount/fc-lang.tex | 321 +++ Master/texmf-dist/doc/latex/fmtcount/fc-samp.tex | 141 ++ .../doc/latex/fmtcount/fmtcount-manual.html | 708 ++++++ Master/texmf-dist/doc/latex/fmtcount/fmtcount.pdf | Bin 0 -> 144823 bytes Master/texmf-dist/doc/latex/fmtcount/fmtcount.perl | 2670 -------------------- .../doc/latex/fmtcount/latex2html/fmtcount.perl | 2670 -------------------- 13 files changed, 1223 insertions(+), 6436 deletions(-) create mode 100644 Master/texmf-dist/doc/latex/fmtcount/CHANGES delete mode 100644 Master/texmf-dist/doc/latex/fmtcount/doc/CHANGES delete mode 100644 Master/texmf-dist/doc/latex/fmtcount/doc/fc-lang.tex delete mode 100644 Master/texmf-dist/doc/latex/fmtcount/doc/fc-samp.tex delete mode 100644 Master/texmf-dist/doc/latex/fmtcount/doc/fmtcount-manual.html delete mode 100644 Master/texmf-dist/doc/latex/fmtcount/doc/fmtcount.pdf create mode 100644 Master/texmf-dist/doc/latex/fmtcount/fc-lang.tex create mode 100644 Master/texmf-dist/doc/latex/fmtcount/fc-samp.tex create mode 100644 Master/texmf-dist/doc/latex/fmtcount/fmtcount-manual.html create mode 100644 Master/texmf-dist/doc/latex/fmtcount/fmtcount.pdf delete mode 100644 Master/texmf-dist/doc/latex/fmtcount/fmtcount.perl delete mode 100644 Master/texmf-dist/doc/latex/fmtcount/latex2html/fmtcount.perl (limited to 'Master/texmf-dist/doc/latex/fmtcount') diff --git a/Master/texmf-dist/doc/latex/fmtcount/CHANGES b/Master/texmf-dist/doc/latex/fmtcount/CHANGES new file mode 100644 index 00000000000..2bf2c037047 --- /dev/null +++ b/Master/texmf-dist/doc/latex/fmtcount/CHANGES @@ -0,0 +1,51 @@ +fmtcount package versions: + +Version 1.31: + + * fixed unwanted space in \decimalnum + + * fixed bug that ignores spaces after commands like + \ordinalnum. + + * added Italian support (translations provided by Edoardo Pasca) + +Version 1.3: + + * no longer loads xspace package (was causing extraneous + spaces when the optional argument to \ordinalstring etc + was omitted.) + * Made some long commands short. + * Changes licence text in fmtcount.ins to conform with LPPL. + +Version 1.2: fmtcount now loads xspace package, and uses \xspace +after \numberstring etc. + +Version 1.1: Added German support. Added check for USenglish +and UKenglish babel settings. + +Version 1.09: Added upper case variants \ORDINALstring etc +(\MakeUppercase{\ordinalstring{}} 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 + +Version 1.04: provided \FCordinal to avoid clashes with the memoir class. + +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 index 9efe57f814a..fa6dd14ad0c 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.3 +LaTeX Package : fmtcount v 1.31 -Last Modified : 20 Aug 2007 +Last Modified : 2 October 2009 Author : Nicola Talbot diff --git a/Master/texmf-dist/doc/latex/fmtcount/doc/CHANGES b/Master/texmf-dist/doc/latex/fmtcount/doc/CHANGES deleted file mode 100644 index ea92a56993a..00000000000 --- a/Master/texmf-dist/doc/latex/fmtcount/doc/CHANGES +++ /dev/null @@ -1,42 +0,0 @@ -fmtcount package versions: - -Version 1.3: - - * no longer loads xspace package (was causing extraneous - spaces when the optional argument to \ordinalstring etc - was omitted.) - * Made some long commands short. - * Changes licence text in fmtcount.ins to conform with LPPL. - -Version 1.2: fmtcount now loads xspace package, and uses \xspace -after \numberstring etc. - -Version 1.1: Added German support. Added check for USenglish -and UKenglish babel settings. - -Version 1.09: Added upper case variants \ORDINALstring etc -(\MakeUppercase{\ordinalstring{}} 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 - -Version 1.04: provided \FCordinal to avoid clashes with the memoir class. - -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/doc/fc-lang.tex b/Master/texmf-dist/doc/latex/fmtcount/doc/fc-lang.tex deleted file mode 100644 index a084c7290a9..00000000000 --- a/Master/texmf-dist/doc/latex/fmtcount/doc/fc-lang.tex +++ /dev/null @@ -1,254 +0,0 @@ - % This is an interactive script. Run it through \LaTeX - % and enter appropriate responses. (This won't work with - % LaTeX2HTML - -\documentclass[a4paper]{article} - -\usepackage[french,english,spanish,portuges,ngerman]{babel} -\usepackage{fmtcount} - -\newcounter{startval} -\newcounter{endval} -\newcounter{stepsize} -\newcounter{N} -\newcount\myctr -\newcount\langid - -\begin{document} - -\section{Displaying the value of a counter} - -\typeout{This is an interactive script, testing the fmtcount package.} - -\langid=-1 - -\loop -\typeout{Which language?^^J} -\typeout{[1] English} -\typeout{[2] Portuguese} -\typeout{[3] Spanish} -\typeout{[4] French} -\typeout{[5] French (Swiss)} -\typeout{[6] French (Belgium)} -\typeout{[7] German} - -\typein[\response]{} - -\ifthenelse{\equal{\response}{1}}{\langid=1}{ -\ifthenelse{\equal{\response}{2}}{\langid=2}{ -\ifthenelse{\equal{\response}{3}}{\langid=3}{ -\ifthenelse{\equal{\response}{4}}{\langid=4\fmtcountsetoptions{french}}{ -\ifthenelse{\equal{\response}{5}}{\langid=5\fmtcountsetoptions{french=swiss}}{ -\ifthenelse{\equal{\response}{6}}{\langid=6\fmtcountsetoptions{french=belgian}} -{\ifthenelse{\equal{\response}{7}}{\langid=7}{ -\langid=-1 -\typeout{Invalid response '\response', please select a number from 1 to 6}}}}}}}} -\ifnum\langid=-1 -\repeat - -\ifcase\langid -\or \selectlanguage{english} -Current language: English. -\or \selectlanguage{portuges} -Current language: Portuguese. -\or \selectlanguage{spanish} -Current language: Spanish. -\or \selectlanguage{french} -Current language: French. -\or \selectlanguage{french} -Current language: French (Swiss). -\or \selectlanguage{french} -Current language: French (Belgium). -\or \selectlanguage{ngerman} -Current language: German. -\fi - -\def\startval{-1} - -\loop -\typein[\startval]{Start value? (Integer from 0 to 99999) -[Default 1]} -\ifthenelse{\equal{\startval}{}}{\def\startval{1}}{} -\ifnum\startval<0\def\startval{-1}\fi -\ifnum\startval>99999\def\startval{-1}\fi -\ifnum\startval=-1 -\repeat - -\def\endval{-1} - -\loop -\typein[\endval]{End value? (Integer from 0 to 99999) -[Default 1000]} -\ifthenelse{\equal{\endval}{}}{\def\endval{1000}}{} -\ifnum\endval<0\def\endval{-1}\fi -\ifnum\endval>99999\def\endval{-1}\fi -\ifnum\endval=-1 -\repeat - -\def\stepsize{0} - -\loop -\typein[\stepsize]{Step size? (Non zero integer) -[Default 1]} -\ifthenelse{\equal{\stepsize}{}}{\def\stepsize{1}}{} -\ifnum\stepsize=0 -\repeat - -\typeout{From {\startval} to {\endval} step {\stepsize}} - -\ifnum\startval<\endval -\ifnum\stepsize<0 -\PackageError{fc-lang}{Infinite loop not permitted!}{} -\def\endval{\startval} -\fi -\fi - -\ifnum\startval>\endval -\ifnum\stepsize>0 -\PackageError{fc-lang}{Infinite loop not permitted!}{} -\def\endval{\startval} -\fi -\fi - -\newcount\numformat - -\numformat=-1 -\loop -\typeout{Which format?^^J} -\typeout{[1] ordinalstring} -\typeout{[2] Ordinalstring} -\typeout{[3] ORDINALstring} -\typeout{[4] numberstring} -\typeout{[5] Numberstring} -\typeout{[6] NUMBERstring} - -\typein[\response]{Default: 1} - -\ifthenelse{\equal{\response}{}}{\def\response{1}}{}%default val -\ifthenelse{\equal{\response}{1}}{\numformat=1}{ -\ifthenelse{\equal{\response}{2}}{\numformat=2}{ -\ifthenelse{\equal{\response}{3}}{\numformat=3}{ -\ifthenelse{\equal{\response}{4}}{\numformat=4}{ -\ifthenelse{\equal{\response}{5}}{\numformat=5}{ -\ifthenelse{\equal{\response}{6}}{\numformat=6}{\numformat=-1 -\typeout{Invalid response '\response', please select a number from 1 to 4}}}}}}} -\ifnum\numformat=-1 -\repeat - -\ifcase\numformat -\or\def\stringtype{ordinalstring} -\or\def\stringtype{Ordinalstring} -\or\def\stringtype{ORDINALstring} -\or\def\stringtype{numberstring} -\or\def\stringtype{Numberstring} -\or\def\stringtype{NUMBERstring} -\fi - -\ifthenelse{\langid>3 \and \langid < 7}{% -\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 -}{} - -\myctr=-1 -\loop -\typeout{Ordinal format?^^J} -\typeout{[1] raised} -\typeout{[2] level} -\typein[\response]{Default: 1} -\ifthenelse{\equal{\response}{1}\or\equal{\response}{}}{% -\fmtcountsetoptions{fmtord=raise}\myctr=1}{% -\ifthenelse{\equal{\response}{2}}{% -\fmtcountsetoptions{fmtord=level}\myctr=2}{% -\myctr=-1}} -\ifnum\myctr=-1 -\repeat - -\ifnum\langid=1 -\myctr=1 -\else -\ifthenelse{\langid=7 \and \numformat>3}{}{% -\loop -\ifnum\langid=7 - \typein[\response]{Gender? (m, f or n) [Default: m]} - \ifthenelse{\equal{\response}{m}\or\equal{\response}{}}{\myctr=1}{ - \ifthenelse{\equal{\response}{f}}{\myctr=2}{ - \ifthenelse{\equal{\response}{n}}{\myctr=3}{\myctr=-1 - \typeout{Invalid response '\response'}}}} -\else - \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'}}} -\fi -\ifnum\myctr=-1 -\repeat -} -\fi - -\ifcase\myctr -\or \def\gender{m} -\or \def\gender{f} -\or \def\gender{n} -\fi - -\ifnum\langid=7 -\ifnum\startval>99 -\myctr=-1 -\loop -\typeout{einhundert/eintausend or hundert/tausend?^^J} -\typeout{[1] einhundert/eintausend} -\typeout{[2] hundert/tausend} -\typein[\response]{Default: 1} -\ifthenelse{\equal{\response}{}}{\def\response{1}}{}%default -\ifthenelse{\equal{\response}{1}}{% -\renewcommand{\einhundert}{einhundert} -\renewcommand{\eintausend}{eintausend} -\myctr=1}{% -\ifthenelse{\equal{\response}{2}}{% -\renewcommand{\einhundert}{hundert} -\renewcommand{\eintausend}{tausend} -\myctr=2}{% -\myctr=-1}} -\ifnum\myctr=-1 -\repeat -\fi -\fi - -\setcounter{startval}{\startval} -\setcounter{endval}{\endval} -\setcounter{stepsize}{\stepsize} - -\stepcounter{endval} -\begin{ttfamily} -\noindent -\makebox[0.25in][c]{N} -\makebox[0.5in][c]{ordinal}\quad -\stringtype -\par -\myctr=\value{startval} -\loop -\noindent -\setcounter{N}{\myctr} -\makebox[0.25in][r]{\arabic{N}} -\makebox[0.5in][r]{\ordinal{N}[\gender]}\quad -\csname\stringtype\endcsname{N}[\gender]. -\par -\advance\myctr by \value{stepsize}\relax -\ifnum\myctr<\value{endval} -\repeat - -\end{ttfamily} - -\end{document} diff --git a/Master/texmf-dist/doc/latex/fmtcount/doc/fc-samp.tex b/Master/texmf-dist/doc/latex/fmtcount/doc/fc-samp.tex deleted file mode 100644 index 7ca4d1c57f5..00000000000 --- a/Master/texmf-dist/doc/latex/fmtcount/doc/fc-samp.tex +++ /dev/null @@ -1,98 +0,0 @@ -\documentclass[a4paper]{article} - -\usepackage{fmtcount} -\newcounter{N} - -\padzeroes[5] - -\newcommand{\printrow}[1]{% -\newline -\setcounter{N}{#1} -\makebox[0.75in][r]{\decimal{N}\quad} -\makebox[0.75in][r]{\hexadecimal{N}\quad} -\makebox[0.75in][r]{\ordinal{N}\quad} -\makebox[2in][l]{\numberstring{N}} -} - -\renewcommand{\thesection}{\ordinal{section}} - -\begin{document} - -\section{Displaying the value of a counter} -\label{ex} - -\begin{ttfamily} -\noindent -\makebox[0.75in][c]{decimal} -\makebox[0.75in][c]{hexadecimal} -\makebox[0.75in][c]{ordinal} -numberstring -\printrow{0} -\printrow{1} -\printrow{2} -\printrow{3} -\printrow{4} -\printrow{5} -\printrow{6} -\printrow{7} -\printrow{8} -\printrow{9} -\printrow{10} -\printrow{11} -\printrow{12} -\printrow{13} -\printrow{14} -\printrow{15} -\printrow{16} -\printrow{17} -\printrow{18} -\printrow{19} -\printrow{20} -\printrow{21} -\printrow{22} -\printrow{23} -\printrow{24} -\printrow{25} -\printrow{30} -\printrow{40} -\printrow{50} -\printrow{60} -\printrow{70} -\printrow{71} -\printrow{75} -\printrow{80} -\printrow{81} -\printrow{85} -\printrow{90} -\printrow{91} -\printrow{95} -\printrow{100} -\printrow{101} -\printrow{110} -\printrow{125} -\printrow{150} -\printrow{170} -\printrow{180} -\printrow{190} -\printrow{200} -\printrow{250} -\printrow{300} -\printrow{400} -\printrow{500} -\printrow{600} -\printrow{700} -\printrow{800} -\printrow{900} -\printrow{1000} -\printrow{99999} -\end{ttfamily} - -\section{Cross-Referencing} - -Referencing a label: \ref{ex}. - -Passing numbers explicitly: \ordinalnum{10}, -\Numberstringnum{10}, \NUMBERstringnum{10}, \Ordinalstringnum{10}, -\ORDINALstringnum{10}. - -\end{document} diff --git a/Master/texmf-dist/doc/latex/fmtcount/doc/fmtcount-manual.html b/Master/texmf-dist/doc/latex/fmtcount/doc/fmtcount-manual.html deleted file mode 100644 index 2d7fd1c0d6e..00000000000 --- a/Master/texmf-dist/doc/latex/fmtcount/doc/fmtcount-manual.html +++ /dev/null @@ -1,700 +0,0 @@ - - - - - -fmtcount.sty v1.3: Displaying the Values of LaTeX Counters - - - - - - - - - - - - - - -

- -

fmtcount.sty v1.3: Displaying the Values of -LaTeX Counters

-

Nicola L.C. Talbot -
-
-School of Computing Sciences -
-University of East Anglia -
-Norwich. NR4 7TJ. -
-United Kingdom. -
http://theoval.cmp.uea.ac.uk/~nlct/

-

20 Aug 2007

-
- -

-Contents -

- - - - -

-Introduction -

-The fmtcount package provides commands to display -the values of LaTeX counters in a variety of formats. It also -provides equivalent commands for actual numbers rather than -counter names. Limited multilingual support is available. -Currently, there is only support for English, French (including -Belgian and Swiss variations), Spanish, Portuguese and German. - -

- -

-Installation -

- -

-This package is distributed with the files fmtcount.dtx -and fmtcount.ins. To extract the code do: -

-latex fmtcount.ins
-
-This will create the files fmtcount.sty and -fmtcount.perl, along with several .def files. -Place fmtcount.sty and the .def files somewhere -where LaTeX will find them (e.g. -texmf/tex/latex/fmtcount/) and place fmtcount.perl -somewhere where LaTeX2HTML -will find it (e.g. latex2html/styles). Remember to refresh -the TeX database (using texhash or mktexlsr -under Linux, for -other operating systems check the manual.) - -

- -

-Available Commands -

- -

-The commands can be divided into two categories: those that -take the name of a counter as the argument, and those -that take a number as the argument. - -

- -

-\ordinal{counter}[gender] -

-This will print the value of a LaTeX counter counter as an -ordinal, where the macro - -

-\fmtord{text} -

-is used to format the st, nd, rd, th bit. By default the ordinal is -formatted as a superscript, if the package option level is -used, it is level with the text. For example, if the current section -is 3, then \ordinal{section} will produce the output: -3rd. Note that the optional argument gender -occurs at the end. This argument may only take one of -the following values: m (masculine), f -(feminine) or n (neuter.) If gender is omitted, -or if the given gender has no meaning in the current language, -m is assumed. - -

-Notes: - -

    -
  1. the memoir class also defines a command called -\ordinal which takes a number as an argument instead of a -counter. In order to overcome this incompatiblity, if you want -to use the fmtcount package with the memoir class -you should use \FCordinal to access -fmtcount's version of \ordinal, and use -\ordinal to use memoir's version of that command. - -

    -

  2. -
  3. As with all commands which have an optional argument as the -last argument, if the optional argument is omitted, any spaces -following the final argument will be ignored. Whereas, if the -optional argument is present, any spaces following the optional -argument won't be ignored. so \ordinal{section} ! -will produce: 3rd! whereas - \ordinal{section}[m] ! will produce: -3rd ! -
  4. -
- -

- -

-\ordinalnum{n}[gender] -

-This is like \ordinal but takes an actual number rather than a -counter as the argument. For example: \ordinalnum{3} will -produce: 3rd. - -

- -

-\numberstring{counter}[gender] -

-This will print the value of counter as text. E.g. \numberstring{section} will produce: three. The optional -argument is the same as that for \ordinal. - -

- -

-\Numberstring{counter}[gender] -

-This does the same as \numberstring, but with initial letters in -uppercase. For example, \Numberstring{section} will produce: -Three. - -

- -

-\NUMBERstring{counter}[gender] -

-This does the same as \numberstring, but converts the string to -upper case. Note that -\MakeUppercase{\NUMBERstring{counter}} doesn't -work, due to the way that \MakeUppercase expands its -argument1. - -

- -

-\numberstringnum{n}[gender] -

- -

-\Numberstringnum{n}[gender] -

- -

-\NUMBERstringnum{n}[gender] -

-Theses macros work like -\numberstring, \Numberstring and \NUMBERstring, -respectively, but take an actual number -rather than a counter as the argument. For example: -\Numberstringnum{105} will produce: One Hundred and Five. - -

- -

-\ordinalstring{counter}[gender] -

-This will print the value of counter as a textual ordinal. -E.g. \ordinalstring{section} will produce: third. The -optional argument is the same as that for \ordinal. - -

- -

-\Ordinalstring{counter}[gender] -

-This does the same as \ordinalstring, but with initial letters in -uppercase. For example, \Ordinalstring{section} will produce: -Third. - -

- -

-\ORDINALstring{counter}[gender] -

-This does the same as \ordinalstring, but with all words in upper -case (see previous note about \MakeUppercase). - -

- -

-\ordinalstringnum{n}[gender] -

- -

-\Ordinalstringnum{n}[gender] -

- -

-\ORDINALstringnum{n}[gender] -

-These macros work like \ordinalstring, \Ordinalstring and -\ORDINALstring, respectively, but take an actual number rather -than a counter as the argument. For example, -\ordinalstringnum{3} will produce: third. - -

-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 \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 - -

-\FMCuse{label} -

-Note: with \storeordinal and \storeordinalnum, the -only bit that doesn't get expanded is \fmtord. So, for -example, \storeordinalnum{mylabel}{3} will be stored as -3\relax \fmtord{rd}. - -

- -

-\storeordinal{label}{counter}[gender] -

- -

-\storeordinalstring{label}{counter}[gender] -

- -

-\storeOrdinalstring{label}{counter}[gender] -

- -

- -

-\storeORDINALstring{label}{counter}[gender] -

- -

-\storenumberstring{label}{counter}[gender] -

- -

-\storeNumberstring{label}{counter}[gender] -

- -

-\storeNUMBERstring{label}{counter}[gender] -

- -

-\storeordinalnum{label}{number}[gender] -

- -

-\storeordinalstring{label}{number}[gender] -

- -

-\storeOrdinalstringnum{label}{number}[gender] -

- -

-\storeORDINALstringnum{label}{number}[gender] -

- -

-\storenumberstring{label}{number}[gender] -

- -

-\storeNumberstring{label}{number}[gender] -

- -

-\storeNUMBERstring{label}{number}[gender] -

- -

- -

-\binary{counter} -

-This will print the -value of counter as a binary number. -E.g. \binary{section} will produce: 11. The declaration - -

-\padzeroes[n] -

-will ensure numbers are written to n digits, padding with -zeroes if necessary. E.g. \padzeroes[8]\binary{section} -will produce: 00000011. The default value for n is 17. - -

- -

-\binary{n} -

-This is like \binary but takes an actual number rather than a -counter as the argument. For example: \binarynum{5} will -produce: 101. - -

- -

-\octal{counter} -

-This will print the value of counter as an octal number. For -example, if you have a counter called, say mycounter, and -you set the value to 125, then \octal{mycounter} will produce: -177. Again, the number will be padded with zeroes if necessary, -depending on whether \padzeroes has been used. - -

- -

-\octalnum{n} -

-This is like \octal but takes an actual number rather than a -counter as the argument. For example: \octalnum{125} will -produce: 177. - -

- -

-\hexadecimal{counter} -

-This will print the value of counter as a hexadecimal number. -Going back to the counter used in the previous example, -\hexadecimal{mycounter} will produce: 7d. Again, the number -will be padded with zeroes if necessary, depending on whether -\padzeroes has been used. - -

- -

-\Hexadecimal{counter} -

-This does the same thing, but uses uppercase characters, e.g. \Hexadecimal{mycounter} will produce: 7D. - -

- -

-\hexadecimalnum{n} -

- -

-\Hexadecimalnum{n} -

-These are like \hexadecimal and \Hexadecimal -but take an actual number rather than a counter as the -argument. For example: \hexadecimalnum{125} will -produce: 7d, and \Hexadecimalnum{125} will -produce: 7D. - -

- -

-\decimal{counter} -

-This is similar to \arabic but the number can be padded with -zeroes depending on whether \padzeroes has been used. For -example: \padzeroes[8]\decimal{section} will produce: -00000005. - -

- -

-\decimalnum{n} -

-This is like \decimal but takes an actual number rather than a -counter as the argument. For example: -\padzeroes[8]\decimalnum{5} will produce: 00000005. - -

- -

-\aaalph{counter} -

-This will print the value of counter as: a b ... z aa bb -... zz etc. For example, \aaalpha{mycounter} will -produce: uuuuu if mycounter is set to 125. - -

- -

-\AAAlph{counter} -

-This does the same thing, but uses uppercase characters, e.g. \AAAlph{mycounter} will produce: UUUUU. - -

- -

-\aaalphnum{n} -

- -

-\AAAlphnum{n} -

-These macros are like \aaalph and \AAAlph -but take an actual number rather than a counter as the -argument. For example: \aaalphnum{125} will -produce: uuuuu, and \AAAlphnum{125} will -produce: UUUUU. - -

- -

-\abalph{counter} -

-This will print the value of counter as: a b ... z aa ab -... az etc. For example, \abalpha{mycounter} will -produce: du if mycounter is set to 125. - -

- -

-\ABAlph{counter} -

-This does the same thing, but uses uppercase characters, e.g. \ABAlph{mycounter} will produce: DU. - -

- -

-\abalphnum{n} -

- -

-\ABAlphnum{n} -

-These macros are like \abalph and \ABAlph -but take an actual number rather than a counter as the -argument. For example: \abalphnum{125} will -produce: du, and \ABAlphnum{125} will -produce: DU. - -

- -

-Package Options -

- -

-The following options can be passed to this package: - -

- - - - - - - -
raisemake ordinal st,nd,rd,th appear as superscript
levelmake ordinal st,nd,rd,th appear level with rest of -text
- -

-These can also be set using the command: - -

- -

-\fmtcountsetoptions{fmtord=type} -

-where type is either level or -raise. - -

- -

-Multilingual Support -

- -

-Version 1.02 of the fmtcount package now has -limited multilingual support. The following languages are -implemented: English, Spanish, Portuguese, French, French (Swiss) -and French (Belgian). German support was added in version -1.12. - -

-The package checks to see if the command \l@language is -defined3, -and will load the code for those languages. The commands -\ordinal, \ordinalstring and \numberstring (and their -variants) will then be formatted in the currently selected language. - -

-If the French language is selected, the French (France) version -will be used by default (e.g. soxiante-dix for 70). To -select the Swiss or Belgian variants (e.g. septente for 70) use: -\fmtcountsetoptions{french=dialect} -where dialect is either swiss or belgian. -You can also use this command to change the action of -\ordinal. -\fmtcountsetoptions{abbrv=true} to produce ordinals -of the form 2e or -\fmtcountsetoptions{abbrv=false} to produce ordinals -of the form 2eme (default). - -

-The french and abbrv settings only have an -effect if the French language has been defined. - -

-The male gender for all languages is used by default, however the -feminine or neuter forms can be obtained by passing f or -n as an optional argument to \ordinal, -\ordinalnum etc. For example: -\numberstring{section}[f]. Note that the optional argument -comes after the compulsory argument. If a gender is -not defined in a given language, the masculine version will -be used instead. - -

-Let me know if you find any spelling mistakes (has been known -to happen in English, let alone other languages with which I'm not so -familiar.) If you want to add support for another language, -you will need to let me know how to form the numbers and ordinals -from 0 to 99999 in that language for each gender. - -

- -

-Configuration File fmtcount.cfg -

- -

-You can save your preferred default settings to a file called -fmtcount.cfg, and place it on the TeX path. These -settings will then be loaded by the fmtcount -package. - -

-Note that if you are using the datetime package, -the datetime.cfg configuration file will override -the fmtcount.cfg configuration file. -For example, if datetime.cfg has the line: -

-\renewcommand{\fmtord}[1]{\textsuperscript{\underline{#1}}}
-
-and if fmtcount.cfg has the line: -
-\fmtcountsetoptions{fmtord=level}
-
-then the former definition of \fmtord will take -precedence. - -

- -

-LaTeX2HTML style -

- -

-The LaTeX2HTML style file fmtcount.perl is provided. -The following limitations apply: - -

- -

    -
  • \padzeroes only has an effect in the preamble. - -

    -

  • -
  • The configuration file -fmtcount.cfg 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: -
    -\usepackage{fmtcount}
    -\html{\input{fmtcount.cfg}}
    -
    -This, I agree, is an unpleasant cludge. - -

    -

  • -
- -

- -

-Acknowledgements -

- -

-I would like to thank my mother for the French and Portuguese -support and my Spanish dictionary for the Spanish support. -Thank you to K. H. Fricke for providing me with the German -translations. - -

- -

-Troubleshooting -

- -

-There is a FAQ available at: -http://theoval.cmp.uea.ac.uk/~nlct/latex/packages/faq/. - -

-


Footnotes

-
-
... -argument1
-
See all the various postings to -comp.text.tex about \MakeUppercase - -
-
... -1.12
-
Thanks to K. H. Fricke for supplying the information - -
-
... -defined3
-
this will be true if you have loaded babel - -
-
-

-
-Nicola L. C. Talbot. -School of Computing Sciences. -University of East Anglia. -Last Modified: 2007-08-20 -
- - diff --git a/Master/texmf-dist/doc/latex/fmtcount/doc/fmtcount.pdf b/Master/texmf-dist/doc/latex/fmtcount/doc/fmtcount.pdf deleted file mode 100644 index 84132f07fb4..00000000000 Binary files a/Master/texmf-dist/doc/latex/fmtcount/doc/fmtcount.pdf and /dev/null differ 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..68925e045b2 --- /dev/null +++ b/Master/texmf-dist/doc/latex/fmtcount/fc-lang.tex @@ -0,0 +1,321 @@ +%% +%% This is file `fc-lang.tex', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% fmtcount.dtx (with options: `fc-lang.tex,package') +%% +%% fmtcount.dtx +%% Copyright 2009 Nicola Talbot +%% +%% This work may be distributed and/or modified under the +%% conditions of the LaTeX Project Public License, either version 1.3 +%% of this license of (at your option) any later version. +%% The latest version of this license is in +%% http://www.latex-project.org/lppl.txt +%% and version 1.3 or later is part of all distributions of LaTeX +%% version 2005/12/01 or later. +%% +%% This work has the LPPL maintenance status `maintained'. +%% +%% The Current Maintainer of this work is Nicola Talbot. +%% +%% This work consists of the files fmtcount.dtx and fmtcount.ins and the derived files fmtcount.sty, fc-british.def, fc-english.def, fc-french.def, fc-german.def, fc-italian.def, fc-portuges.def, fc-spanish.def, fc-UKenglish.def, fc-USenglish.def, fmtcount.perl, fc-lang.tex, fc-samp.tex. +%% +%% \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. (This won't work with + % LaTeX2HTML + +\documentclass[a4paper]{article} + +\usepackage[french,english,spanish,portuges,ngerman,italian]{babel} +\usepackage{fmtcount} + +\newcounter{startval} +\newcounter{endval} +\newcounter{stepsize} +\newcounter{N} +\newcount\myctr +\newcount\langid + +\begin{document} + +\section{Displaying the value of a counter} + +\typeout{This is an interactive script, testing the fmtcount package.} + +\langid=-1 + +\loop +\typeout{Which language?^^J} +\typeout{[1] English} +\typeout{[2] Portuguese} +\typeout{[3] Spanish} +\typeout{[4] French} +\typeout{[5] French (Swiss)} +\typeout{[6] French (Belgium)} +\typeout{[7] German} +\typeout{[8] Italian} + +\typein[\response]{} + +\ifthenelse{\equal{\response}{1}}{\langid=1}{ +\ifthenelse{\equal{\response}{2}}{\langid=2}{ +\ifthenelse{\equal{\response}{3}}{\langid=3}{ +\ifthenelse{\equal{\response}{4}}{\langid=4\fmtcountsetoptions{french}}{ +\ifthenelse{\equal{\response}{5}}{\langid=5\fmtcountsetoptions{french=swiss}}{ +\ifthenelse{\equal{\response}{6}}{\langid=6\fmtcountsetoptions{french=belgian}} +{\ifthenelse{\equal{\response}{7}}{\langid=7}{% +\ifthenelse{\equal{\response}{8}}{\langid=8}{% +\langid=-1 +\typeout{Invalid response '\response', please select a number from 1 to 6}}}}}}}}} +\ifnum\langid=-1 +\repeat + +\ifcase\langid +\or \selectlanguage{english} +Current language: English. +\or \selectlanguage{portuges} +Current language: Portuguese. +\or \selectlanguage{spanish} +Current language: Spanish. +\or \selectlanguage{french} +Current language: French. +\or \selectlanguage{french} +Current language: French (Swiss). +\or \selectlanguage{french} +Current language: French (Belgium). +\or \selectlanguage{ngerman} +Current language: German. +\or \selectlanguage{italian} +Current language: Italian. +\fi + +\def\startval{-1} + +\loop +\typein[\startval]{Start value? (Integer from 0 to 99999) +[Default 1]} +\ifthenelse{\equal{\startval}{}}{\def\startval{1}}{} +\ifnum\startval<0\def\startval{-1}\fi +\ifnum\startval>99999\def\startval{-1}\fi +\ifnum\startval=-1 +\repeat + +\def\endval{-1} + +\loop +\typein[\endval]{End value? (Integer from 0 to 99999) +[Default 1000]} +\ifthenelse{\equal{\endval}{}}{\def\endval{1000}}{} +\ifnum\endval<0\def\endval{-1}\fi +\ifnum\endval>99999\def\endval{-1}\fi +\ifnum\endval=-1 +\repeat + +\def\stepsize{0} + +\loop +\typein[\stepsize]{Step size? (Non zero integer) +[Default 1]} +\ifthenelse{\equal{\stepsize}{}}{\def\stepsize{1}}{} +\ifnum\stepsize=0 +\repeat + +\typeout{From {\startval} to {\endval} step {\stepsize}} + +\ifnum\startval<\endval +\ifnum\stepsize<0 +\PackageError{fc-lang}{Infinite loop not permitted!}{} +\def\endval{\startval} +\fi +\fi + +\ifnum\startval>\endval +\ifnum\stepsize>0 +\PackageError{fc-lang}{Infinite loop not permitted!}{} +\def\endval{\startval} +\fi +\fi + +\newcount\numformat + +\numformat=-1 +\loop +\typeout{Which format?^^J} +\typeout{[1] ordinalstring} +\typeout{[2] Ordinalstring} +\typeout{[3] ORDINALstring} +\typeout{[4] numberstring} +\typeout{[5] Numberstring} +\typeout{[6] NUMBERstring} + +\typein[\response]{Default: 1} + +\ifthenelse{\equal{\response}{}}{\def\response{1}}{}%default val +\ifthenelse{\equal{\response}{1}}{\numformat=1}{ +\ifthenelse{\equal{\response}{2}}{\numformat=2}{ +\ifthenelse{\equal{\response}{3}}{\numformat=3}{ +\ifthenelse{\equal{\response}{4}}{\numformat=4}{ +\ifthenelse{\equal{\response}{5}}{\numformat=5}{ +\ifthenelse{\equal{\response}{6}}{\numformat=6}{\numformat=-1 +\typeout{Invalid response '\response', please select a number from 1 to 4}}}}}}} +\ifnum\numformat=-1 +\repeat + +\ifcase\numformat +\or\def\stringtype{ordinalstring} +\or\def\stringtype{Ordinalstring} +\or\def\stringtype{ORDINALstring} +\or\def\stringtype{numberstring} +\or\def\stringtype{Numberstring} +\or\def\stringtype{NUMBERstring} +\fi + +\ifnum\langid>3\relax + \ifnum\langid<7\relax + \myctr=-1\relax + \loop + \typeout{Ordinal type?^^J} + \typeout{[1] eme} + \typeout{[2] e} + \typein[\response]{Default: 1} + \ifthenelse{\equal{\response}{}}% + {% + \def\response{1}% default + \myctr=1\relax + }% + {% + \ifthenelse{\equal{\response}{1}}% + {% + \fmtcountsetoptions{abbrv=false}\myctr=1\relax + }% + {% + \ifthenelse{\equal{\response}{2}}% + {% + \fmtcountsetoptions{abbrv}\myctr=2\relax + }% + {% + \myctr=-1\relax + }% + }% + }% + \ifnum\myctr=-1 + \repeat + \fi +\fi + +\myctr=-1 +\loop +\typeout{Ordinal format?^^J} +\typeout{[1] raised} +\typeout{[2] level} +\typein[\response]{Default: 1} +\ifthenelse{\equal{\response}{1}\or\equal{\response}{}}{% +\fmtcountsetoptions{fmtord=raise}\myctr=1}{% +\ifthenelse{\equal{\response}{2}}{% +\fmtcountsetoptions{fmtord=level}\myctr=2}{% +\myctr=-1}} +\ifnum\myctr=-1 +\repeat + +\ifnum\langid=1 +\myctr=1 +\else +\ifthenelse{\langid=7 \and \numformat>3}{}{% +\loop +\ifnum\langid=7 + \typein[\response]{Gender? (m, f or n) [Default: m]} + \ifthenelse{\equal{\response}{m}}{\myctr=1}{ + \ifthenelse{\equal{\response}{f}}{\myctr=2}{ + \ifthenelse{\equal{\response}{n}}{\myctr=3}{ + \ifthenelse{\equal{\response}{}}{\myctr=1}{% + \myctr=-1 + \typeout{Invalid response '\response'}}}}} +\else + \typein[\response]{Gender? (m or f) [Default: m]} + \ifthenelse{\equal{\response}{m}}{\myctr=1}{ + \ifthenelse{\equal{\response}{f}}{\myctr=2}{% + \ifthenelse{\equal{\response}{}}{\myctr=1}{% + \myctr=-1 + \typeout{Invalid response '\response'}}}} +\fi +\ifnum\myctr=-1 +\repeat +} +\fi + +\ifcase\myctr +\or \def\gender{m} +\or \def\gender{f} +\or \def\gender{n} +\fi + +\ifnum\langid=7 +\ifnum\startval>99 +\myctr=-1 +\loop +\typeout{einhundert/eintausend or hundert/tausend?^^J} +\typeout{[1] einhundert/eintausend} +\typeout{[2] hundert/tausend} +\typein[\response]{Default: 1} +\ifthenelse{\equal{\response}{}}{\def\response{1}}{}%default +\ifthenelse{\equal{\response}{1}}{% +\renewcommand{\einhundert}{einhundert} +\renewcommand{\eintausend}{eintausend} +\myctr=1}{% +\ifthenelse{\equal{\response}{2}}{% +\renewcommand{\einhundert}{hundert} +\renewcommand{\eintausend}{tausend} +\myctr=2}{% +\myctr=-1}} +\ifnum\myctr=-1 +\repeat +\fi +\fi + +\setcounter{startval}{\startval} +\setcounter{endval}{\endval} +\setcounter{stepsize}{\stepsize} + +\stepcounter{endval} +\begin{ttfamily} +\noindent +\makebox[0.25in][c]{N} +\makebox[0.5in][c]{ordinal}\quad +\stringtype +\par +\myctr=\value{startval} +\loop +\noindent +\setcounter{N}{\myctr} +\makebox[0.25in][r]{\arabic{N}} +\makebox[0.5in][r]{\ordinal{N}[\gender]}\quad +\csname\stringtype\endcsname{N}[\gender]. +\par +\advance\myctr by \value{stepsize}\relax +\ifnum\myctr<\value{endval} +\repeat + +\end{ttfamily} + +\end{document} +\endinput +%% +%% End of file `fc-lang.tex'. 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..1faa491666d --- /dev/null +++ b/Master/texmf-dist/doc/latex/fmtcount/fc-samp.tex @@ -0,0 +1,141 @@ +%% +%% This is file `fc-samp.tex', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% fmtcount.dtx (with options: `fc-samp.tex,package') +%% +%% fmtcount.dtx +%% Copyright 2009 Nicola Talbot +%% +%% This work may be distributed and/or modified under the +%% conditions of the LaTeX Project Public License, either version 1.3 +%% of this license of (at your option) any later version. +%% The latest version of this license is in +%% http://www.latex-project.org/lppl.txt +%% and version 1.3 or later is part of all distributions of LaTeX +%% version 2005/12/01 or later. +%% +%% This work has the LPPL maintenance status `maintained'. +%% +%% The Current Maintainer of this work is Nicola Talbot. +%% +%% This work consists of the files fmtcount.dtx and fmtcount.ins and the derived files fmtcount.sty, fc-british.def, fc-english.def, fc-french.def, fc-german.def, fc-italian.def, fc-portuges.def, fc-spanish.def, fc-UKenglish.def, fc-USenglish.def, fmtcount.perl, fc-lang.tex, fc-samp.tex. +%% +%% \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{fmtcount} +\newcounter{N} + +\padzeroes[5] + +\newcommand{\printrow}[1]{% +\newline +\setcounter{N}{#1} +\makebox[0.75in][r]{\decimal{N}\quad} +\makebox[0.75in][r]{\hexadecimal{N}\quad} +\makebox[0.75in][r]{\ordinal{N}\quad} +\makebox[2in][l]{\numberstring{N}} +} + +\renewcommand{\thesection}{\ordinal{section}} + +\begin{document} + +\section{Displaying the value of a counter} +\label{ex} + +\begin{ttfamily} +\noindent +\makebox[0.75in][c]{decimal} +\makebox[0.75in][c]{hexadecimal} +\makebox[0.75in][c]{ordinal} +numberstring +\printrow{0} +\printrow{1} +\printrow{2} +\printrow{3} +\printrow{4} +\printrow{5} +\printrow{6} +\printrow{7} +\printrow{8} +\printrow{9} +\printrow{10} +\printrow{11} +\printrow{12} +\printrow{13} +\printrow{14} +\printrow{15} +\printrow{16} +\printrow{17} +\printrow{18} +\printrow{19} +\printrow{20} +\printrow{21} +\printrow{22} +\printrow{23} +\printrow{24} +\printrow{25} +\printrow{30} +\printrow{40} +\printrow{50} +\printrow{60} +\printrow{70} +\printrow{71} +\printrow{75} +\printrow{80} +\printrow{81} +\printrow{85} +\printrow{90} +\printrow{91} +\printrow{95} +\printrow{100} +\printrow{101} +\printrow{110} +\printrow{125} +\printrow{150} +\printrow{170} +\printrow{180} +\printrow{190} +\printrow{200} +\printrow{250} +\printrow{300} +\printrow{400} +\printrow{500} +\printrow{600} +\printrow{700} +\printrow{800} +\printrow{900} +\printrow{1000} +\printrow{99999} +\end{ttfamily} + +\section{Cross-Referencing} + +Referencing a label: \ref{ex}. + +Passing numbers explicitly: \ordinalnum{10}, +\Numberstringnum{10}, \NUMBERstringnum{10}, \Ordinalstringnum{10}, +\ORDINALstringnum{10}. + +\end{document} +\endinput +%% +%% End of file `fc-samp.tex'. diff --git a/Master/texmf-dist/doc/latex/fmtcount/fmtcount-manual.html b/Master/texmf-dist/doc/latex/fmtcount/fmtcount-manual.html new file mode 100644 index 00000000000..6b9887eafde --- /dev/null +++ b/Master/texmf-dist/doc/latex/fmtcount/fmtcount-manual.html @@ -0,0 +1,708 @@ + + + + + +fmtcount.sty v1.31: Displaying the Values of LaTeX Counters + + + + + + + + + + + + + + +

+ +

fmtcount.sty v1.31: Displaying the Values of +LaTeX Counters

+

Nicola L.C. Talbot +
+
+School of Computing Sciences +
+University of East Anglia +
+Norwich. NR4 7TJ. +
+United Kingdom. +
http://theoval.cmp.uea.ac.uk/~nlct/

+

2nd October 2009

+
+ +

+Contents +

+ + + + +

+Introduction +

+The fmtcount package provides commands to display +the values of LaTeX counters in a variety of formats. It also +provides equivalent commands for actual numbers rather than +counter names. Limited multilingual support is available. +Currently, there is only support for English, French (including +Belgian and Swiss variations), Spanish, Portuguese, German and +Italian. + +

+ +

+Installation +

+ +

+This package is distributed with the files fmtcount.dtx +and fmtcount.ins. To extract the code do: +

+latex fmtcount.ins
+
+This will create the files fmtcount.sty and +fmtcount.perl, along with several .def files. +Place fmtcount.sty and the .def files somewhere +where LaTeX will find them (e.g. +texmf/tex/latex/fmtcount/) and place fmtcount.perl +somewhere where LaTeX2HTML +will find it (e.g. latex2html/styles). Remember to refresh +the TeX database (using texhash or mktexlsr +under Linux, for +other operating systems check the manual.) + +

+ +

+Available Commands +

+ +

+The commands can be divided into two categories: those that +take the name of a counter as the argument, and those +that take a number as the argument. + +

+ +

+\ordinal{counter}[gender] +

+This will print the value of a LaTeX counter counter as an +ordinal, where the macro + +

+\fmtord{text} +

+is used to format the st, nd, rd, th bit. By default the ordinal is +formatted as a superscript, if the package option level is +used, it is level with the text. For example, if the current section +is 3, then \ordinal{section} will produce the output: +3rd. Note that the optional argument gender +occurs at the end. This argument may only take one of +the following values: m (masculine), f +(feminine) or n (neuter.) If gender is omitted, +or if the given gender has no meaning in the current language, +m is assumed. + +

+Notes: + +

    +
  1. the memoir class also defines a command called +\ordinal which takes a number as an argument instead of a +counter. In order to overcome this incompatiblity, if you want +to use the fmtcount package with the memoir class +you should use \FCordinal to access +fmtcount's version of \ordinal, and use +\ordinal to use memoir's version of that command. + +

    +

  2. +
  3. As with all commands which have an optional argument as the +last argument, if the optional argument is omitted, any spaces +following the final argument will be ignored. Whereas, if the +optional argument is present, any spaces following the optional +argument won't be ignored. so \ordinal{section} ! +will produce: 3rd! whereas + \ordinal{section}[m] ! will produce: +3rd ! +
  4. +
+ +

+ +

+\ordinalnum{n}[gender] +

+This is like \ordinal but takes an actual number rather than a +counter as the argument. For example: \ordinalnum{3} will +produce: 3rd. + +

+ +

+\numberstring{counter}[gender] +

+This will print the value of counter as text. E.g. \numberstring{section} will produce: three. The optional +argument is the same as that for \ordinal. + +

+ +

+\Numberstring{counter}[gender] +

+This does the same as \numberstring, but with initial letters in +uppercase. For example, \Numberstring{section} will produce: +Three. + +

+ +

+\NUMBERstring{counter}[gender] +

+This does the same as \numberstring, but converts the string to +upper case. Note that +\MakeUppercase{\NUMBERstring{counter}} doesn't +work, due to the way that \MakeUppercase expands its +argument1. + +

+ +

+\numberstringnum{n}[gender] +

+ +

+\Numberstringnum{n}[gender] +

+ +

+\NUMBERstringnum{n}[gender] +

+Theses macros work like +\numberstring, \Numberstring and \NUMBERstring, +respectively, but take an actual number +rather than a counter as the argument. For example: +\Numberstringnum{105} will produce: One Hundred and Five. + +

+ +

+\ordinalstring{counter}[gender] +

+This will print the value of counter as a textual ordinal. +E.g. \ordinalstring{section} will produce: third. The +optional argument is the same as that for \ordinal. + +

+ +

+\Ordinalstring{counter}[gender] +

+This does the same as \ordinalstring, but with initial letters in +uppercase. For example, \Ordinalstring{section} will produce: +Third. + +

+ +

+\ORDINALstring{counter}[gender] +

+This does the same as \ordinalstring, but with all words in upper +case (see previous note about \MakeUppercase). + +

+ +

+\ordinalstringnum{n}[gender] +

+ +

+\Ordinalstringnum{n}[gender] +

+ +

+\ORDINALstringnum{n}[gender] +

+These macros work like \ordinalstring, \Ordinalstring and +\ORDINALstring, respectively, but take an actual number rather +than a counter as the argument. For example, +\ordinalstringnum{3} will produce: third. + +

+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 \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 + +

+\FMCuse{label} +

+Note: with \storeordinal and \storeordinalnum, the +only bit that doesn't get expanded is \fmtord. So, for +example, \storeordinalnum{mylabel}{3} will be stored as +3\relax \fmtord{rd}. + +

+ +

+\storeordinal{label}{counter}[gender] +

+ +

+\storeordinalstring{label}{counter}[gender] +

+ +

+\storeOrdinalstring{label}{counter}[gender] +

+ +

+ +

+\storeORDINALstring{label}{counter}[gender] +

+ +

+\storenumberstring{label}{counter}[gender] +

+ +

+\storeNumberstring{label}{counter}[gender] +

+ +

+\storeNUMBERstring{label}{counter}[gender] +

+ +

+\storeordinalnum{label}{number}[gender] +

+ +

+\storeordinalstring{label}{number}[gender] +

+ +

+\storeOrdinalstringnum{label}{number}[gender] +

+ +

+\storeORDINALstringnum{label}{number}[gender] +

+ +

+\storenumberstring{label}{number}[gender] +

+ +

+\storeNumberstring{label}{number}[gender] +

+ +

+\storeNUMBERstring{label}{number}[gender] +

+ +

+ +

+\binary{counter} +

+This will print the +value of counter as a binary number. +E.g. \binary{section} will produce: 11. The declaration + +

+\padzeroes[n] +

+will ensure numbers are written to n digits, padding with +zeroes if necessary. E.g. \padzeroes[8]\binary{section} +will produce: 00000011. The default value for n is 17. + +

+ +

+\binary{n} +

+This is like \binary but takes an actual number rather than a +counter as the argument. For example: \binarynum{5} will +produce: 101. + +

+ +

+\octal{counter} +

+This will print the value of counter as an octal number. For +example, if you have a counter called, say mycounter, and +you set the value to 125, then \octal{mycounter} will produce: +177. Again, the number will be padded with zeroes if necessary, +depending on whether \padzeroes has been used. + +

+ +

+\octalnum{n} +

+This is like \octal but takes an actual number rather than a +counter as the argument. For example: \octalnum{125} will +produce: 177. + +

+ +

+\hexadecimal{counter} +

+This will print the value of counter as a hexadecimal number. +Going back to the counter used in the previous example, +\hexadecimal{mycounter} will produce: 7d. Again, the number +will be padded with zeroes if necessary, depending on whether +\padzeroes has been used. + +

+ +

+\Hexadecimal{counter} +

+This does the same thing, but uses uppercase characters, e.g. \Hexadecimal{mycounter} will produce: 7D. + +

+ +

+\hexadecimalnum{n} +

+ +

+\Hexadecimalnum{n} +

+These are like \hexadecimal and \Hexadecimal +but take an actual number rather than a counter as the +argument. For example: \hexadecimalnum{125} will +produce: 7d, and \Hexadecimalnum{125} will +produce: 7D. + +

+ +

+\decimal{counter} +

+This is similar to \arabic but the number can be padded with +zeroes depending on whether \padzeroes has been used. For +example: \padzeroes[8]\decimal{section} will produce: +00000005. + +

+ +

+\decimalnum{n} +

+This is like \decimal but takes an actual number rather than a +counter as the argument. For example: +\padzeroes[8]\decimalnum{5} will produce: 00000005. + +

+ +

+\aaalph{counter} +

+This will print the value of counter as: a b ... z aa bb +... zz etc. For example, \aaalpha{mycounter} will +produce: uuuuu if mycounter is set to 125. + +

+ +

+\AAAlph{counter} +

+This does the same thing, but uses uppercase characters, e.g. \AAAlph{mycounter} will produce: UUUUU. + +

+ +

+\aaalphnum{n} +

+ +

+\AAAlphnum{n} +

+These macros are like \aaalph and \AAAlph +but take an actual number rather than a counter as the +argument. For example: \aaalphnum{125} will +produce: uuuuu, and \AAAlphnum{125} will +produce: UUUUU. + +

+ +

+\abalph{counter} +

+This will print the value of counter as: a b ... z aa ab +... az etc. For example, \abalpha{mycounter} will +produce: du if mycounter is set to 125. + +

+ +

+\ABAlph{counter} +

+This does the same thing, but uses uppercase characters, e.g. \ABAlph{mycounter} will produce: DU. + +

+ +

+\abalphnum{n} +

+ +

+\ABAlphnum{n} +

+These macros are like \abalph and \ABAlph +but take an actual number rather than a counter as the +argument. For example: \abalphnum{125} will +produce: du, and \ABAlphnum{125} will +produce: DU. + +

+ +

+Package Options +

+ +

+The following options can be passed to this package: + +

+ + + + + + + +
raisemake ordinal st,nd,rd,th appear as superscript
levelmake ordinal st,nd,rd,th appear level with rest of +text
+ +

+These can also be set using the command: + +

+ +

+\fmtcountsetoptions{fmtord=type} +

+where type is either level or +raise. + +

+ +

+Multilingual Support +

+ +

+Version 1.02 of the fmtcount package now has +limited multilingual support. The following languages are +implemented: English, Spanish, Portuguese, French, French (Swiss) +and French (Belgian). German support was added in version +1.1.2Italian support was added in version 1.31.3 +

+The package checks to see if the command \l@language is +defined4, +and will load the code for those languages. The commands +\ordinal, \ordinalstring and \numberstring (and their +variants) will then be formatted in the currently selected language. + +

+If the French language is selected, the French (France) version +will be used by default (e.g. soxiante-dix for 70). To +select the Swiss or Belgian variants (e.g. septente for 70) use: +\fmtcountsetoptions{french=dialect} +where dialect is either swiss or belgian. +You can also use this command to change the action of +\ordinal. +\fmtcountsetoptions{abbrv=true} to produce ordinals +of the form 2e or +\fmtcountsetoptions{abbrv=false} to produce ordinals +of the form 2eme (default). + +

+The french and abbrv settings only have an +effect if the French language has been defined. + +

+The male gender for all languages is used by default, however the +feminine or neuter forms can be obtained by passing f or +n as an optional argument to \ordinal, +\ordinalnum etc. For example: +\numberstring{section}[f]. Note that the optional argument +comes after the compulsory argument. If a gender is +not defined in a given language, the masculine version will +be used instead. + +

+Let me know if you find any spelling mistakes (has been known +to happen in English, let alone other languages with which I'm not so +familiar.) If you want to add support for another language, +you will need to let me know how to form the numbers and ordinals +from 0 to 99999 in that language for each gender. + +

+ +

+Configuration File fmtcount.cfg +

+ +

+You can save your preferred default settings to a file called +fmtcount.cfg, and place it on the TeX path. These +settings will then be loaded by the fmtcount +package. + +

+Note that if you are using the datetime package, +the datetime.cfg configuration file will override +the fmtcount.cfg configuration file. +For example, if datetime.cfg has the line: +

+\renewcommand{\fmtord}[1]{\textsuperscript{\underline{#1}}}
+
+and if fmtcount.cfg has the line: +
+\fmtcountsetoptions{fmtord=level}
+
+then the former definition of \fmtord will take +precedence. + +

+ +

+LaTeX2HTML style +

+ +

+The LaTeX2HTML style file fmtcount.perl is provided. +The following limitations apply: + +

+ +

    +
  • \padzeroes only has an effect in the preamble. + +

    +

  • +
  • The configuration file +fmtcount.cfg 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: +
    +\usepackage{fmtcount}
    +\html{\input{fmtcount.cfg}}
    +
    +This, I agree, is an unpleasant cludge. + +

    +

  • +
+ +

+ +

+Acknowledgements +

+ +

+I would like to thank my mother for the French and Portuguese +support and my Spanish dictionary for the Spanish support. +Thank you to K. H. Fricke for providing me with the German +translations and to Edoardo Pasca for providing me with the +Italian translations. + +

+ +

+Troubleshooting +

+ +

+There is a FAQ available at: +http://theoval.cmp.uea.ac.uk/~nlct/latex/packages/faq/. + +

+


Footnotes

+
+
... +argument1
+
See all the various postings to +comp.text.tex about \MakeUppercase + +
+
... +1.1.2
+
Thanks to K. H. Fricke for supplying the information. + +
+
... 1.31.3
+
Thanks to +Edoardo Pasca for supplying the information. + +
+
... +defined4
+
this will be true if you have loaded babel + +
+
+

+
+Nicola L. C. Talbot. +School of Computing Sciences. +University of East Anglia. +Last Modified: 2009-10-02 +
+ + diff --git a/Master/texmf-dist/doc/latex/fmtcount/fmtcount.pdf b/Master/texmf-dist/doc/latex/fmtcount/fmtcount.pdf new file mode 100644 index 00000000000..8448794662c Binary files /dev/null and b/Master/texmf-dist/doc/latex/fmtcount/fmtcount.pdf differ diff --git a/Master/texmf-dist/doc/latex/fmtcount/fmtcount.perl b/Master/texmf-dist/doc/latex/fmtcount/fmtcount.perl deleted file mode 100644 index bc7d3b9fb4e..00000000000 --- a/Master/texmf-dist/doc/latex/fmtcount/fmtcount.perl +++ /dev/null @@ -1,2670 +0,0 @@ -# File : fmtcount.perl -# Author : Nicola Talbot -# Date : 26 May 2007 -# Version : 1.05 -# Description : LaTeX2HTML implementation of fmtcount package - -package main; - -sub do_fmtcount_raise{ - local($tmp)=""; - - $tmp .= 'sub do_cmd_fmtord{'; - $tmp .= 'local($_) = @_;'; - $tmp .= 'local($suffix) = &missing_braces unless (s/$next_pair_pr_rx/$suffix=$2;\'\'/eo);'; - $tmp .= 'join("", "",$suffix,"",$_);'; - $tmp .='}'; - - eval($tmp); -} - -sub do_fmtcount_level{ - local($tmp)=""; - - $tmp .= 'sub do_cmd_fmtord{'; - $tmp .= 'local($_) = @_;'; - $tmp .= 'local($suffix) = &missing_braces unless (s/$next_pair_pr_rx/$suffix=$2;\'\'/eo);'; - $tmp .= 'join("", $suffix,$_);'; - $tmp .='}'; - - eval($tmp); -} - -if (not defined &do_cmd_fmtord) -{ - &do_fmtcount_raise(@_); -} - -$frenchdialect = 'france'; -$ordinalabbrv = 0; - -sub get_ordinal_suffix_english{ - local($num,$gender) = @_; - local($suffix); - - if ((($num % 10) == 1) && ($num%100 != 11)) - { - $suffix = 'st'; - } - elsif ((($num % 10) == 2) && ($num%100 != 12)) - { - $suffix = 'nd'; - } - elsif ((($num % 10) == 3) && ($num%100 != 13)) - { - $suffix = 'rd'; - } - else - { - $suffix = 'th'; - } - - $suffix; -} - -sub get_ordinal_suffix_french{ - local($num,$gender) = @_; - local($_); - - if ($ordinalabbrv > 0) - { - $_ = 'e'; - } - else - { - if ($num == 1) - { - $_ = ($gender eq 'f' ? 'ere' : 'er'); - } - else - { - $_ = 'eme'; - } - } -} - -sub get_ordinal_suffix_spanish{ - local($num,$gender) = @_; - - ($gender eq 'f' ? 'a' : 'o'); -} - -sub get_ordinal_suffix_portuges{ - local($num,$gender) = @_; - - ($gender eq 'f' ? 'a' : 'o'); -} - -sub get_ordinal_suffix_german{ - local($num,$gender) = @_; - - ''; -} - -sub get_ordinal_suffix_ngerman{ - local($num,$gender) = @_; - - ''; -} - -sub get_ordinal_suffix{ - local($num,$gender) = @_; - local($suffix,$suffixsub); - - $suffixsub = "get_ordinal_suffix_$default_language"; - - if (defined ($suffixsub)) - { - $suffix = &$suffixsub($num,$gender); - } - else - { - $suffix = &get_ordinal_suffix_english($num,$gender); - } - - $suffix; -} - -sub getordinal{ - local($num,$gender) = @_; - local($suffix) = &get_ordinal_suffix($num,$gender); - local($text)=''; - - if ($suffix eq '') - { - $text = $num; - } - else - { - local($br_id) = ++$global{'max_id'}; - $text = $num . "\\fmtord${OP}$br_id${CP}$suffix${OP}$br_id${CP}"; - } - - $text; -} - -sub do_cmd_ordinalnum{ - local($_) = @_; - local($num) = &missing_braces - unless (s/$next_pair_pr_rx/$num=$2;''/eo); - my($gender)='m'; - local($suffix)=''; - - if (s/\[([mfn])\]//) - { - $gender = $1; - } - - $suffix = &get_ordinal_suffix($num,$gender); - - local($br_id) = ++$global{'max_id'}; - join('', $num, "\\fmtord${OP}$br_id${CP}$suffix${OP}$br_id${CP}", $_); -} - -sub do_cmd_FCordinal{ - &do_cmd_ordinal; -} - -sub do_cmd_ordinal{ - local($ctr, $val, $id, $_) = &read_counter_value($_[0]); - my($gender)='m'; - - $_[0] =~ s/${OP}$id${CP}$ctr${OP}$id${CP}//; - - if ($_[0]=~s/\[(.)\]//) - { - $gender = $1; - } - - if ($ctr eq 'DAY' or $ctr eq 'MONTH' or $str eq 'YEAR') - { - # this is a cludge to make it work with newdateformat - join('', '{ORDINAL{', $ctr, '}}', $_[0]); - } - else - { - join('', &getordinal($val, $gender), $_[0]); - } -} - -sub do_cmd_storeordinal{ - local($_) = @_; - local($key); - - $key = &missing_braces - unless ((s/$next_pair_pr_rx//o)&&($key=$2)); - - local($ctr, $val, $id, $_) = &read_counter_value($_); - my($gender)='m'; - - $_ =~ s/${OP}$id${CP}$ctr${OP}$id${CP}//; - - if ($_ =~s/\s*\[(.)\]//) - { - $gender = $1; - } - - if ($ctr eq 'DAY' or $ctr eq 'MONTH' or $ctr eq 'YEAR') - { - # this is a cludge to make it work with newdateformat - $fmtcntvar{$key} = join('', '{ORDINAL{', $ctr, '}}'); - } - else - { - $fmtcntvar{$key} = &getordinal($val, $gender); - } - - $_; -} - -sub do_cmd_storeordinalnum{ - local($_) = @_; - local($key, $val); - - $key = &missing_braces - unless ((s/$next_pair_pr_rx//o)&&($key=$2)); - - $val = &missing_braces - unless (s/$next_pair_pr_rx/$val=$2;''/eo); - - my($gender)='m'; - - if ($_ =~s/\s*\[([mfn])\]//) - { - $gender = $1; - } - - $fmtcntvar{$key} = &getordinal($val, $gender); - - $_; -} - -@unitthstring = ('zeroth', - 'first', - 'second', - 'third', - 'fourth', - 'fifth', - 'sixth', - 'seventh', - 'eighth', - 'ninth'); - -@tenthstring = ('', - 'tenth', - 'twentieth', - 'thirtieth', - 'fortieth', - 'fiftieth', - 'sixtieth', - 'seventieth', - 'eightieth', - 'ninetieth'); - -@teenthstring = ('tenth', - 'eleventh', - 'twelfth', - 'thirteenth', - 'fourteenth', - 'fifteenth', - 'sixteenth', - 'seventeenth', - 'eighteenth', - 'nineteenth'); - -@unitstring = ('zero', - 'one', - 'two', - 'three', - 'four', - 'five', - 'six', - 'seven', - 'eight', - 'nine'); - -@teenstring = ('ten', - 'eleven', - 'twelve', - 'thirteen', - 'fourteen', - 'fifteen', - 'sixteen', - 'seventeen', - 'eighteen', - 'nineteen'); -@tenstring = ('', - 'ten', - 'twenty', - 'thirty', - 'forty', - 'fifty', - 'sixty', - 'seventy', - 'eighty', - 'ninety'); - -$hundredname = "hundred"; -$hundredthname = "hundredth"; -$thousandname = "thousand"; -$thousandthname = "thousandth"; - -sub get_numberstringenglish{ - local($num) = @_; - local($name)=""; - - unless (($num >= 1000000) || ($num < 0)) - { - if ($num >= 1000) - { - local($thousands) = &get_numberstringenglish($num/1000); - $name .= $thousands . " $thousandname"; - $num = $num%1000; - } - - if ($num >= 100) - { - if ($_[0] >= 1000) { $name .= " "; } - - local($hundreds) = &get_numberstringenglish($num/100); - $name .= $hundreds . " $hundredname"; - $num = $num%100; - } - - if (($_[0] > 100) && ($_[0]%100 > 0)) { $name .= " and "; } - - if ($num >= 20) - { - $name .= $tenstring[$num/10]; - - if ($num%10 > 0) { $name .= '-'; } - } - - if (($num >= 10) && ($num < 20)) - { - $name .= $teenstring[$num%10]; - } - elsif (($num%10 > 0) || ($_[0] == 0)) - { - $name .= $unitstring[$num%10]; - } - } - - $name; -} - -@unitthstringfrench = ('zeroi\`eme', - 'uni\`eme', - 'deuxi\`eme', - 'troisi\`eme', - 'quatri\`eme', - 'cinqui\`eme', - 'sixi\`eme', - 'septi\`eme', - 'huiti\`eme', - 'neuvi\`eme'); - -@tenthstringfrench = ('', - 'dixi\`eme', - 'vingti\`eme', - 'trentri\`eme', - 'quaranti\`eme', - 'cinquanti\`eme', - 'soixanti\`eme', - 'septenti\`eme', - 'huitanti\`eme', - 'nonenti\`eme'); - -@teenthstringfrench = ('dixi\`eme', - 'onzi\`eme', - 'douzi\`eme', - 'treizi\`eme', - 'quatorzi\`eme', - 'quinzi\`eme', - 'seizi\`eme', - 'dix-septi\`eme', - 'dix-huiti\`eme', - 'dix-neuvi\`eme'); - -@unitstringfrench = ('zero', - 'un', - 'deux', - 'trois', - 'quatre', - 'cinq', - 'six', - 'sept', - 'huit', - 'neuf'); - -@teenstringfrench = ('dix', - 'onze', - 'douze', - 'treize', - 'quatorze', - 'quinze', - 'seize', - 'dix-sept', - 'dix-huit', - 'dix-neuf'); - -@tenstringfrench = ('', - 'dix', - 'vingt', - 'trente', - 'quarante', - 'cinquante', - 'soixante', - 'septente', - 'huitante', - 'nonente'); - -$hundrednamefrench = "cent"; -$hundredthnamefrench = "centi\\`eme"; -$thousandnamefrench = "mille"; -$thousandthnamefrench = "mili\\`eme"; - -@unitthstringspanish = ('cero', - 'primero', - 'segundo', - 'tercero', - 'cuarto', - 'quinto', - 'sexto', - 's\\\'eptimo', - 'octavo', - 'noveno'); - -@tenthstringspanish = ('', - 'd\\\'ecimo', - 'vig\\\'esimo', - 'trig\\\'esimo', - 'cuadrag\\\'esimo', - 'quincuag\\\'esimo', - 'sexag\\\'esimo', - 'septuag\\\'esimo', - 'octog\\\'esimo', - 'nonag\\\'esimo'); - -@teenthstringspanish = ('d\\\'ecimo', - 'und\\\'ecimo', - 'duod\\\'ecimo', - 'decimotercero', - 'decimocuarto', - 'decimoquinto', - 'decimosexto', - 'decimos\\\'eptimo', - 'decimoctavo', - 'decimonoveno'); - -@hundredthstringspanish = ('', - 'cent\\\'esimo', - 'ducent\\\'esimo', - 'tricent\\\'esimo', - 'cuadringent\\\'esimo', - 'quingent\\\'esimo', - 'sexcent\\\'esimo', - 'septing\\\'esimo', - 'octingent\\\'esimo', - 'noningent\\\'esimo'); - -@unitstringspanish = ('cero', - 'uno', - 'dos', - 'tres', - 'cuatro', - 'cinco', - 'seis', - 'siete', - 'ocho', - 'nueve'); - -@teenstringspanish = ('diez', - 'once', - 'doce', - 'trece', - 'catorce', - 'quince', - 'diecis\\\'eis', - 'diecisiete', - 'dieciocho', - 'diecinueve'); - -@twentystringspanish = ('viente', - 'vientiuno', - 'vientid\\\'os', - 'vientitr\\\'es', - 'vienticuatro', - 'vienticinco', - 'vientis\\\'eis', - 'vientisiete', - 'vientiocho', - 'vientinueve'); - -@tenstringspanish = ('', - 'diez', - 'viente', - 'treinta', - 'cuarenta', - 'cincuenta', - 'sesenta', - 'setenta', - 'ochenta', - 'noventa'); - -@hundredstringspanish = ('', - 'ciento', - 'doscientos', - 'trescientos', - 'cuatrocientos', - 'quinientos', - 'seiscientos', - 'setecientos', - 'ochocientos', - 'novecientos'); - -$hundrednamespanish = "cien"; -$hundredthnamespanish = "centi\\`eme"; -$thousandnamespanish = "mil"; -$thousandthnamespanish = "mil\\'esimo"; - -@unitthstringportuges = ('zero', - 'primeiro', - 'segundo', - 'terceiro', - 'quatro', - 'quinto', - 'sexto', - 's\\\'etimo', - 'oitavo', - 'nono'); - -@tenthstringportuges = ('', - 'd\\\'ecimo', - 'vig\\\'esimo', - 'trig\\\'esimo', - 'quadrag\\\'esimo', - 'q\"uinquag\\\'esimo', - 'sexag\\\'esimo', - 'setuag\\\'esimo', - 'octog\\\'esimo', - 'nonag\\\'esimo'); - -@hundredthstringportuges = ('', - 'cent\\\'esimo', - 'ducent\\\'esimo', - 'trecent\\\'esimo', - 'quadringent\\\'esimo', - 'q\"uingent\\\'esimo', - 'seiscent\\\'esimo', - 'setingent\\\'esimo', - 'octingent\\\'esimo', - 'nongent\\\'esimo'); - -@unitstringportuges = ('zero', - 'um', - 'dois', - 'tr\^es', - 'quatro', - 'cinco', - 'seis', - 'sete', - 'oito', - 'nove'); - -@teenstringportuges = ('dez', - 'onze', - 'doze', - 'treze', - 'quatorze', - 'quinze', - 'dezesseis', - 'dezessete', - 'dezoito', - 'dezenove'); - -@tenstringportuges = ('', - 'dez', - 'vinte', - 'trinta', - 'quaranta', - 'cinq\"uenta', - 'sessenta', - 'setenta', - 'oitenta', - 'noventa'); - -@hundredstringportuges = ('', - 'cento', - 'duzentos', - 'trezentos', - 'quatrocentos', - 'quinhentos', - 'seiscentos', - 'setecentos', - 'oitocentos', - 'novecentos'); - -$hundrednameportuges = "cem"; -$thousandnameportuges = "mil"; -$thousandthnameportuges = "mil\\'esimo"; - -sub get_numberstringfrench{ - local($num,$gender) = @_; - local($name)=""; - - if ($gender eq 'f') - { - $unitstringfrench[1] = 'une'; - } - else - { - $unitstringfrench[1] = 'un'; - } - - unless (($num >= 1000000) || ($num < 0)) - { - if ($num >= 1000) - { - local($thousands) = ''; - - if ($num >= 2000) - { - $thousands = &get_numberstringfrench($num/1000,$gender).' '; - } - - $name .= $thousands . $thousandnamefrench; - $num = $num%1000; - } - - if ($num >= 100) - { - if ($_[0] >= 1000) { $name .= " "; } - - local($hundreds) = ''; - - if ($num >= 200) - { - $hundreds = &get_numberstringfrench($num/100,$gender).' '; - } - - $name .= $hundreds . $hundrednamefrench; - $num = $num%100; - - if (($_[0]%100 == 0) && ($_[0]/100 > 1)) - { - $name .= 's'; - } - } - - if (($_[0] > 100) && ($_[0]%100 > 0)) { $name .= " "; } - - if ($num >= 20) - { - if ($frenchdialect eq 'france' and $num >= 70) - { - if ($num < 80) - { - $name .= $tenstringfrench[6]; - - if ($num%10 == 1) - { - $name .= ' et '; - } - else - { - $name .= '-'; - } - - $num = 10+($num%10); - } - else - { - $name .= 'quatre-vingt' . ($num==80?'s':'-'); - - if ($num >= 90) - { - $num = 10+($num%10); - } - } - } - elsif ($frenchdialect eq 'belgian' - && ($num >= 80) && ($num < 90)) - { - $name .= 'quatre-vingt' . ($num==80?'s':'-'); - } - else - { - $name .= $tenstringfrench[$num/10]; - - if ($num%10 == 1) { $name .= ' et ';} - elsif ($num%10 > 0) { $name .= '-'; } - } - } - - if (($num >= 10) && ($num < 20)) - { - $name .= $teenstringfrench[$num%10]; - } - elsif (($num%10 > 0) || ($_[0] == 0)) - { - $name .= $unitstringfrench[$num%10]; - } - } - - $name; -} - -sub get_numberstringspanish{ - local($num,$gender) = @_; - local($name)=""; - - if ($gender eq 'f') - { - $unitstringspanish[1] = 'una'; - } - else - { - $unitstringspanish[1] = 'uno'; - } - - unless (($num >= 1000000) || ($num < 0)) - { - if ($num >= 1000) - { - local($thousands) = ''; - - if ($num >= 2000) - { - $thousands = &get_numberstringspanish($num/1000,$gender).' '; - } - - $name .= $thousands . $thousandnamespanish; - $num = $num%1000; - } - - if ($num >= 100) - { - if ($_[0] >= 1000) { $name .= " "; } - - local($hundreds) = ''; - - if ($num > 100) - { - $hundreds = $hundredstringspanish[$num/100]; - } - else - { - $hundreds = 'cien'; - } - - $name .= $hundreds; - $num = $num%100; - } - - if (($_[0] > 100) && ($_[0]%100 > 0)) { $name .= " y "; } - - if ($num >= 30) - { - $name .= $tenstringspanish[$num/10]; - - if ($num%10 > 0) { $name .= ' y '; } - } - - if (($num >=20) && ($num < 30)) - { - $name .= $twentystringspanish[$num%10]; - } - elsif (($num >= 10) && ($num < 20)) - { - $name .= $teenstringspanish[$num%10]; - } - elsif (($num%10 > 0) || ($_[0] == 0)) - { - $name .= $unitstringspanish[$num%10]; - } - } - - $name; -} - -sub get_numberstringportuges{ - local($num,$gender) = @_; - local($name)=""; - - if ($gender eq 'f') - { - $unitstringportuges[0] = 'zera'; - $unitstringportuges[1] = 'uma'; - $unitstringportuges[2] = 'duas'; - } - else - { - $unitstringportuges[0] = 'zero'; - $unitstringportuges[1] = 'um'; - $unitstringportuges[2] = 'dois'; - } - - unless (($num >= 1000000) || ($num < 0)) - { - if ($num >= 1000) - { - local($thousands) = ''; - - if ($num >= 2000) - { - $thousands = &get_numberstringportuges($num/1000,$gender).' '; - } - - $name .= $thousands . $thousandnameportuges; - $num = $num%1000; - } - - if ($num >= 100) - { - if ($_[0] >= 1000) { $name .= " "; } - - local($hundreds) = ''; - - if ($num > 100) - { - $hundreds = $hundredstringportuges[$num/100]; - - if ($gender eq 'f' and $num >= 200) - { - $hundreds =~s/o(s?)$/a\1/; - } - } - else - { - $hundreds = $hundrednameportuges; - } - - $name .= $hundreds; - $num = $num%100; - } - - if (($_[0] > 100) && ($_[0]%100 > 0)) { $name .= " e "; } - - if ($num >= 20) - { - $name .= $tenstringportuges[$num/10]; - - if ($num%10 == 1) { $name .= ' e ';} - elsif ($num%10 > 0) { $name .= ' '; } - } - - if (($num >= 10) && ($num < 20)) - { - $name .= $teenstringportuges[$num%10]; - } - elsif (($num%10 > 0) || ($_[0] == 0)) - { - $name .= $unitstringportuges[$num%10]; - } - } - - $name; -} - -@unitthstringMgerman = ('nullter', - 'erster', - 'zweiter', - 'dritter', - 'vierter', - 'f\\"unter', - 'sechster', - 'siebter', - 'achter', - 'neunter'); - -@tenthstringMgerman = ('', - 'zehnter', - 'zwanzigster', - 'drei\\ss igster', - 'vierzigster', - 'f\\"unfzigster', - 'sechzigster', - 'siebzigster', - 'achtzigster', - 'neunzigster'); - -@teenthstringMgerman = ('zehnter', - 'elfter', - 'zw\\"olfter', - 'dreizehnter', - 'vierzehnter', - 'f\\"unfzehnter', - 'sechzehnter', - 'siebzehnter', - 'achtzehnter', - 'neunzehnter'); - -@unitthstringFgerman = ('nullte', - 'erste', - 'zweite', - 'dritte', - 'vierte', - 'f\\"unfte', - 'sechste', - 'siebte', - 'achte', - 'neunte'); - -@tenthstringFgerman = ('', - 'zehnte', - 'zwanzigste', - 'drei\\ss igste', - 'vierzigste', - 'f\\"unfzigste', - 'sechzigste', - 'siebzigste', - 'achtzigste', - 'neunzigste'); - -@teenthstringFgerman = ('zehnte', - 'elfte', - 'zw\\"olfte', - 'dreizehnte', - 'vierzehnte', - 'f\\"unfzehnte', - 'sechzehnte', - 'siebzehnte', - 'achtzehnte', - 'neunzehnte'); - -@unitthstringNgerman = ('nulltes', - 'erstes', - 'zweites', - 'drittes', - 'viertes', - 'f\\"unte', - 'sechstes', - 'siebtes', - 'achtes', - 'neuntes'); - -@tenthstringNgerman = ('', - 'zehntes', - 'zwanzigstes', - 'drei\\ss igstes', - 'vierzigstes', - 'f\\"unfzigstes', - 'sechzigstes', - 'siebzigstes', - 'achtzigstes', - 'neunzigstes'); - -@teenthstringNgerman = ('zehntes', - 'elftes', - 'zw\\"olftes', - 'dreizehntes', - 'vierzehntes', - 'f\\"unfzehntes', - 'sechzehntes', - 'siebzehntes', - 'achtzehntes', - 'neunzehntes'); - -@unitstringgerman = ('null', - 'ein', # eins dealt with separately (this is for prefixes) - 'zwei', - 'drei', - 'vier', - 'f\\"unf', - 'sechs', - 'sieben', - 'acht', - 'neun'); - -@teenstringgerman = ('zehn', - 'elf', - 'zw\\"olf', - 'dreizehn', - 'vierzehn', - 'f\\"unfzehn', - 'sechzehn', - 'siebzehn', - 'achtzehn', - 'neunzehn'); - -@tenstringgerman = ('', - 'zehn', - 'zwanzig', - 'drei\\ss ig', - 'vierzig', - 'f\\"unfzig', - 'sechzig', - 'siebzig', - 'achtzig', - 'neunzig'); - -sub do_cmd_einhundert{ - local($_) = @_; - - "einhundert$_"; -} - -sub do_cmd_eintausend{ - local($_) = @_; - - "eintausend$_"; -} - -sub get_numberunderhundredgerman{ - local($num)=@_; - local($name)=''; - - if ($num == 1) - { - $name = 'eins'; - } - elsif ($num < 10) - { - $name = $unitstringgerman[$num]; - } - elsif ($num%10 == 0) - { - $name = $tenstringgerman[$num/10]; - } - else - { - $name = join('und', $unitstringgerman[$num%10], - $tenstringgerman[$num/10]); - } - - $name; -} - -sub get_numberstringgerman{ - local($orgnum,$gender) = @_; - local($name)=""; - - local($num) = $orgnum; - - unless (($num >= 1000000) || ($num < 0)) - { - if ($num >= 1000 and $num < 2000) - { - $name = &translate_commands("\\eintausend "); - } - elsif ($num >= 2000) - { - $name = &get_numberunderhundredgerman($num/1000) - . "tausend"; - } - - $num = $orgnum%1000; - - if ($num >= 100 and $num < 200) - { - if ($orgnum > 1000) - { - $name .= "einhundert"; - } - else - { - $name = &translate_commands("\\einhundert "); - } - } - elsif ($num >= 200) - { - $name .= $unitstringgerman[$num/100]."hundert"; - } - - $num = $num%100; - - if ($orgnum == 0) - { - $name = 'null'; - } - elsif ($num > 0) - { - $name .= &get_numberunderhundredgerman($num); - } - } - - $name; -} - -sub get_numberstring{ - local($val,$gender) = @_; - - if ($default_language eq 'french') - { - &get_numberstringfrench($val,$gender); - } - elsif ($default_language eq 'spanish') - { - &get_numberstringspanish($val,$gender); - } - elsif ($default_language eq 'portuges') - { - &get_numberstringportuges($val,$gender); - } - elsif ($default_language eq 'german' - or $default_language eq 'ngerman') - { - &get_numberstringgerman($val,$gender); - } - else - { - &get_numberstringenglish($val); - } -} - -sub do_cmd_numberstringnum{ - local($_) = @_; - local($num,$gender); - $num = &missing_braces unless - s/$next_pair_pr_rx/$num=$2;''/eo; - - if (s/\[(m|f|n)\]//) - { - $gender = $1; - } - else - { - $gender = 'm'; - } - - join('', &get_numberstring($num,$gender), $_); -} - -sub do_cmd_numberstring{ - local($ctr, $val, $id, $_) = &read_counter_value($_[0]); - my($gender)='m'; - - $_[0] =~ s/${OP}$id${CP}$ctr${OP}$id${CP}//; - - if ($_[0]=~s/\[(.)\]//) - { - $gender = $1; - } - - if ($ctr eq 'DAY' or $ctr eq 'MONTH' or $ctr eq 'YEAR') - { - # this is a cludge to make it work with newdateformat - join('', '{NUMBERSTRING{', $ctr, '}}', $_[0]); - } - else - { - join('', &get_numberstring($val, $gender), $_[0]); - } -} - -sub do_cmd_storenumberstring{ - local($_) = @_; - local($key); - - $key = &missing_braces - unless ((s/$next_pair_pr_rx//o)&&($key=$2)); - - local($ctr, $val, $id, $_) = &read_counter_value($_); - my($gender)='m'; - - $_ =~ s/${OP}$id${CP}$ctr${OP}$id${CP}//; - - if ($_ =~s/\s*\[(.)\]//) - { - $gender = $1; - } - - if ($ctr eq 'DAY' or $ctr eq 'MONTH' or $ctr eq 'YEAR') - { - # this is a cludge to make it work with newdateformat - $fmtcntvar{$key} = join('', '{NUMBERSTRING{', $ctr, '}}'); - } - else - { - $fmtcntvar{$key} = join('', &get_numberstring($val, $gender)); - } - - $_; -} - -sub do_cmd_storenumberstringnum{ - local($_) = @_; - local($key, $val); - - $key = &missing_braces - unless ((s/$next_pair_pr_rx//o)&&($key=$2)); - - $val = &missing_braces - unless (s/$next_pair_pr_rx/$val=$2;''/eo); - - my($gender)='m'; - - if ($_ =~s/\s*\[([mfn])\]//) - { - $gender = $1; - } - - $fmtcntvar{$key} = join('', &get_numberstring($val, $gender)); - - $_; -} - -sub get_Numberstring{ - local($val,$gender) = @_; - local($string) = &get_numberstring($val,$gender); - - if ($default_language=~m/german/) - { - $string =~ s/([a-z])([^\s\-]+)/\u\1\2/; - } - else - { - $string =~ s/([a-z])([^\s\-]+)/\u\1\2/g; - - if ($default_language eq 'french') - { - $string =~ s/ Et / et /g; - } - elsif ($default_language eq 'spanish') - { - $string =~ s/ Y / y /g; - } - elsif ($default_language eq 'portuges') - { - $string =~ s/ E / e /g; - } - else - { - $string =~ s/ And / and /g; - } - } - - $string; -} - -sub do_cmd_Numberstringnum{ - local($_) = @_; - local($num,$gender); - $num = &missing_braces - unless (s/$next_pair_pr_rx/$num=$2;''/eo); - - if (s/\[(m|f|n)\]//) - { - $gender = $1; - } - else - { - $gender = 'm'; - } - - join('', &get_Numberstring($num,$gender), $_); -} - -sub do_cmd_Numberstring{ - local($ctr, $val, $id, $_) = &read_counter_value($_[0]); - my($gender)='m'; - - $_[0] =~ s/${OP}$id${CP}$ctr${OP}$id${CP}//; - - if ($_[0]=~s/\[(.)\]//) - { - $gender = $1; - } - - if ($ctr eq 'DAY' or $ctr eq 'MONTH' or $ctr eq 'YEAR') - { - # this is a cludge to make it work with newdateformat - join('', '{NNUMBERSTRING{', $ctr, '}}', $_[0]); - } - else - { - join('', &get_Numberstring($val, $gender), $_[0]); - } -} - -sub do_cmd_storeNumberstring{ - local($_) = @_; - local($key); - - $key = &missing_braces - unless ((s/$next_pair_pr_rx//o)&&($key=$2)); - - local($ctr, $val, $id, $_) = &read_counter_value($_); - my($gender)='m'; - - $_ =~ s/${OP}$id${CP}$ctr${OP}$id${CP}//; - - if ($_ =~s/\s*\[([mfn])\]//) - { - $gender = $1; - } - - if ($ctr eq 'DAY' or $ctr eq 'MONTH' or $ctr eq 'YEAR') - { - # this is a cludge to make it work with newdateformat - $fmtcntvar{$key} = join('', '{NNUMBERSTRING{', $ctr, '}}'); - } - else - { - $fmtcntvar{$key} = join('', &get_Numberstring($val, $gender)); - } - - $_; -} - -sub do_cmd_storeNumberstringnum{ - local($_) = @_; - local($key, $val); - - $key = &missing_braces - unless ((s/$next_pair_pr_rx//o)&&($key=$2)); - - $val = &missing_braces - unless (s/$next_pair_pr_rx/$val=$2;''/eo); - - my($gender)='m'; - - if ($_ =~s/\s*\[([mfn])\]//) - { - $gender = $1; - } - - $fmtcntvar{$key} = join('', &get_Numberstring($val, $gender)); - - $_; -} - -sub do_cmd_NUMBERstringnum{ - local($_) = @_; - local($num,$gender); - $num = &missing_braces - unless (s/$next_pair_pr_rx/$num=$2;''/eo); - - if (s/\[(m|f|n)\]//) - { - $gender = $1; - } - else - { - $gender = 'm'; - } - - join('', uc(&get_numberstring($num,$gender)), $_); -} - -sub do_cmd_NUMBERstring{ - local($ctr, $val, $id, $_) = &read_counter_value($_[0]); - my($gender)='m'; - - $_[0] =~ s/${OP}$id${CP}$ctr${OP}$id${CP}//; - - if ($_[0]=~s/\[(.)\]//) - { - $gender = $1; - } - - if ($ctr eq 'DAY' or $ctr eq 'MONTH' or $ctr eq 'YEAR') - { - # this is a cludge to make it work with newdateformat - join('', '{CAPNUMBERSTRING{', $ctr, '}}', $_); - } - else - { - join('', uc(&get_numberstring($val, $gender)), $_); - } -} - -sub do_cmd_storeNUMBERstring{ - local($_) = @_; - local($key); - - $key = &missing_braces - unless ((s/$next_pair_pr_rx//o)&&($key=$2)); - - local($ctr, $val, $id, $_) = &read_counter_value($_); - my($gender)='m'; - - $_ =~ s/${OP}$id${CP}$ctr${OP}$id${CP}//; - - if ($_ =~s/\s*\[(.)\]//) - { - $gender = $1; - } - - if ($ctr eq 'DAY' or $ctr eq 'MONTH' or $ctr eq 'YEAR') - { - # this is a cludge to make it work with newdateformat - $fmtcntvar{$key} = join('', '{CAPNUMBERSTRING{', $ctr, '}}'); - } - else - { - $fmtcntvar{$key} = uc(&get_numberstring($val, $gender)); - } - - $_; -} - -sub do_cmd_storeNUMBERstringnum{ - local($_) = @_; - local($key, $val); - - $key = &missing_braces - unless ((s/$next_pair_pr_rx//o)&&($key=$2)); - - $val = &missing_braces - unless (s/$next_pair_pr_rx/$val=$2;''/eo); - - my($gender)='m'; - - if ($_ =~s/\s*\[([mfn])\]//) - { - $gender = $1; - } - - $fmtcntvar{$key} = uc(&get_numberstring($val, $gender)); - - $_; -} - -sub get_ordinalstringenglish{ - local($num) = @_; - local($name)=""; - - unless (($num >= 1000000) || ($num < 0)) - { - if ($num >= 1000) - { - local($thousands) = &get_numberstring($num/1000); - $name .= $thousands; - - if ($num%1000 > 0) - { - $name .= " $thousandname"; - } - else - { - $name .= " $thousandthname"; - } - - $num = $num%1000; - } - - if ($num >= 100) - { - if ($_[0] >= 1000) { $name .= " "; } - - local($hundreds) = &get_numberstring($num/100); - $name .= $hundreds; - - if ($num%100 > 0) - { - $name .= " $hundredname"; - } - else - { - $name .= " $hundredthname"; - } - - $num = $num%100; - } - - if (($_[0] > 100) && ($_[0]%100 > 0)) { $name .= " and "; } - - if ($num >= 20) - { - if ($num%10 > 0) - { - $name .= $tenstring[$num/10] . '-'; - } - else - { - $name .= $tenthstring[$num/10]; - } - } - - if (($num >= 10) && ($num < 20)) - { - $name .= $teenthstring[$num%10]; - } - elsif (($num%10 > 0) || ($_[0] == 0)) - { - $name .= $unitthstring[$num%10]; - } - } - - $name; -} - -sub get_ordinalstringfrench{ - local($num,$gender) = @_; - local($name)=""; - - unless (($num >= 1000000) || ($num < 0)) - { - if ($num >= 1000) - { - local($thousands) = ''; - - if ($num >= 2000) - { - $thousands = &get_numberstringfrench($num/1000,$gender).' '; - } - - $num = $num%1000; - - if ($num > 0) - { - $name .= $thousands . $thousandnamefrench; - } - else - { - $name .= $thousands . $thousandthnamefrench; - } - } - - if ($num >= 100) - { - if ($_[0] >= 1000) { $name .= " "; } - - local($hundreds) = ''; - - if ($num >= 200) - { - $hundreds = &get_numberstringfrench($num/100,$gender).' '; - } - - $num = $num%100; - - if ($num > 0) - { - $name .= $hundreds . $hundrednamefrench; - } - else - { - $name .= $hundreds . $hundredthnamefrench; - } - } - - if (($_[0] > 100) && ($_[0]%100 > 0)) { $name .= " "; } - - if ($num >= 20) - { - if ($frenchdialect eq 'france' and $num >= 70) - { - if ($num < 80) - { - if ($num%10 > 0) - { - $name .= $tenstringfrench[6]; - } - else - { - $name .= $tenthstringfrench[6]; - } - - if ($num%10 == 1) - { - $name .= ' et '; - } - else - { - $name .= '-'; - } - - $num = 10+($num%10); - } - else - { - $name .= 'quatre-vingt' . ($num==80?'i\`eme':'-'); - - if ($num >= 90) - { - $num = 10+($num%10); - } - } - } - elsif ($frenchdialect eq 'belgian' and $num >= 80) - { - $name .= 'quatre-vingt' . ($num==80?'i\`eme':'-'); - - if ($num >= 90) - { - $num = 10+($num%10); - } - } - else - { - if ($num%10 > 0) - { - $name .= $tenstringfrench[$num/10]; - } - else - { - $name .= $tenthstringfrench[$num/10]; - } - - if ($num%10 == 1) { $name .= ' et ';} - elsif ($num%10 > 0) { $name .= '-'; } - } - } - - if (($num >= 10) && ($num < 20)) - { - $name .= $teenthstringfrench[$num%10]; - } - elsif ($_[0] == 1) - { - $name = 'premi\`ere'; - } - elsif (($num%10 > 0) || ($_[0] == 0)) - { - $name .= $unitthstringfrench[$num%10]; - } - } - - $name; -} - -sub get_ordinalstringspanish{ - local($num,$gender) = @_; - local($name)=""; - local($str); - - unless (($num >= 1000000) || ($num < 0)) - { - if ($num >= 1000) - { - if ($num >= 2000) - { - local($thousands) = &get_ordinalstringspanish($num/1000); - - if ($gender eq 'f') - { - $thousands =~s/o(s?)$/a\1/; - } - - $name .= $thousands. " "; - } - else - { - $name = ""; - } - - $name .= "$thousandthnamespanish"; - - if ($gender eq 'f') - { - $name =~s/o$/a/; - } - - $num = $num%1000; - } - - if ($num >= 100) - { - if ($_[0] >= 1000) { $name .= " "; } - - local($hundreds) = $hundredthstringspanish[$num/100]; - - if ($gender eq 'f') - { - $hundreds =~s/o$/a/; - } - - $name .= $hundreds; - - $num = $num%100; - } - - if (($_[0] > 100) && ($_[0]%100 > 0)) { $name .= " "; } - - local($lastbit)=""; - - if ($num >= 20) - { - $lastbit = $tenthstringspanish[$num/10]; - - if ($num%10 > 0) - { - $lastbit .= ' '; - } - - if ($gender eq 'f') - { - $lastbit =~s/o([ s]*)$/a\1/; - } - - $name .= $lastbit; - - $lastbit = ""; - } - - if (($num >= 10) && ($num < 20)) - { - $lastbit = $teenthstringspanish[$num%10]; - } - elsif (($num%10 > 0) || ($_[0] == 0)) - { - $lastbit = $unitthstringspanish[$num%10]; - } - - if ($gender eq 'f') - { - $lastbit =~s/o([ s]*)$/a\1/; - } - - $name .= $lastbit; - } - - $name; -} - -sub get_ordinalstringportuges{ - local($num,$gender) = @_; - local($name)=""; - local($str); - - unless (($num >= 1000000) || ($num < 0)) - { - if ($num >= 1000) - { - if ($num >= 2000) - { - local($thousands) = &get_ordinalstringportuges($num/1000); - - if ($gender eq 'f') - { - $thousands =~s/o(s?)$/a\1/; - } - - $name .= $thousands. " "; - } - else - { - $name = ""; - } - - $name .= "$thousandthnameportuges"; - - if ($gender eq 'f') - { - $name =~s/o$/a/; - } - - $num = $num%1000; - } - - if ($num >= 100) - { - if ($_[0] >= 1000) { $name .= " "; } - - local($hundreds) = $hundredthstringportuges[$num/100]; - - if ($gender eq 'f') - { - $hundreds =~s/o$/a/; - } - - $name .= $hundreds; - - $num = $num%100; - } - - if (($_[0] > 100) && ($_[0]%100 > 0)) { $name .= "-"; } - - local($lastbit)=""; - - if ($num >= 10) - { - $lastbit = $tenthstringportuges[$num/10]; - - if ($num%10 > 0) - { - $lastbit .= '-'; - } - - if ($gender eq 'f') - { - $lastbit =~s/o([ s]*)$/a\1/; - } - - $name .= $lastbit; - - $lastbit = ""; - } - - if (($num%10 > 0) || ($_[0] == 0)) - { - $lastbit = $unitthstringportuges[$num%10]; - } - - if ($gender eq 'f') - { - $lastbit =~s/o([ s]*)$/a\1/; - } - - $name .= $lastbit; - } - - $name; -} - -sub get_numberunderhundredthgerman{ - local($num,$gender)=@_; - local($name)=''; - - if ($num < 10) - { - if ($gender eq 'F') - { - $name = $unitthstringFgerman[$num]; - } - elsif ($gender eq 'N') - { - $name = $unitthstringNgerman[$num]; - } - else - { - $name = $unitthstringMgerman[$num]; - } - } - elsif ($num%10 == 0) - { - if ($gender eq 'F') - { - $name = $tenthstringFgerman[$num/10]; - } - elsif ($gender eq 'N') - { - $name = $tenthstringNgerman[$num/10]; - } - else - { - $name = $tenthstringMgerman[$num/10]; - } - } - else - { - local($tenth); - if ($gender eq 'F') - { - $tenth = $tenthstringFgerman[$num/10]; - } - elsif ($gender eq 'N') - { - $tenth = $tenthstringNgerman[$num/10]; - } - else - { - $tenth = $tenthstringMgerman[$num/10]; - } - - $name = join('und', $unitstringgerman[$num%10], $tenth); - } - - $name; -} - -sub get_ordinalstringgerman{ - local($orgnum,$gender) = @_; - local($name)=""; - local($suffix)=''; - - $gender = uc($gender); - - if ($gender eq 'F') - { - $suffix = 'ste'; - } - elsif ($gender eq 'N') - { - $suffix = 'stes'; - } - else - { - $suffix = 'ster'; - $gender = 'M'; - } - - local($num) = $orgnum; - - unless (($num >= 1000000) || ($num < 0)) - { - if ($num >= 1000 and $num < 2000) - { - $name = &translate_commands("\\eintausend "); - } - elsif ($num >= 2000) - { - $name = &get_numberunderhundredgerman($num/1000) - . "tausend"; - } - - $num = $orgnum%1000; - - # is that it or is there more? - if ($orgnum >= 1000 and $num == 0) - { - $name .= $suffix; - return $name; - } - - if ($num >= 100 and $num < 200) - { - if ($orgnum > 1000) - { - $name .= "einhundert"; - } - else - { - $name = &translate_commands("\\einhundert "); - } - } - elsif ($num >= 200) - { - $name .= $unitstringgerman[$num/100]."hundert"; - } - - $num = $num%100; - - # is that it or is there more? - if ($orgnum >= 100 and $num == 0) - { - $name .= $suffix; - return $name; - } - - if ($orgnum == 0) - { - if ($gender eq 'F') - { - $name = $unitthstringFgerman[0]; - } - elsif ($gender eq 'N') - { - $name = $unitthstringNgerman[0]; - } - else - { - $name = $unitthstringMgerman[0]; - } - } - elsif ($num > 0) - { - $name .= &get_numberunderhundredthgerman($num,$gender); - } - } - - $name; -} - -sub get_ordinalstring{ - local($val,$gender) = @_; - - if ($default_language eq 'french') - { - &get_ordinalstringfrench($val,$gender); - } - elsif ($default_language eq 'spanish') - { - &get_ordinalstringspanish($val,$gender); - } - elsif ($default_language eq 'portuges') - { - &get_ordinalstringportuges($val,$gender); - } - elsif ($default_language eq 'german' - or $default_language eq 'ngerman') - { - &get_ordinalstringgerman($val,$gender); - } - else - { - &get_ordinalstringenglish($val); - } -} - -sub do_cmd_ordinalstringnum{ - local($_) = @_; - local($num,$gender); - $num = &missing_braces - unless (s/$next_pair_pr_rx/$num=$2;''/eo); - - if (s/\[(m|f|n)\]//) - { - $gender = $1; - } - else - { - $gender = 'm'; - } - - join('', &get_ordinalstring($num,$gender), $_); -} - -sub do_cmd_ordinalstring{ - local($ctr, $val, $id, $_) = &read_counter_value($_[0]); - my($gender)='m'; - - $_[0] =~ s/${OP}$id${CP}$ctr${OP}$id${CP}//; - - if ($_[0]=~s/\[(.)\]//) - { - $gender = $1; - } - - if ($ctr eq 'DAY' or $ctr eq 'MONTH' or $ctr eq 'YEAR') - { - # this is a cludge to make it work with newdateformat - join('', '{ORDINALSTRING{', $ctr, '}}', $_); - } - else - { - join('', &get_ordinalstring($val, $gender), $_); - } -} - - %fmtcntvar = (); - -sub do_cmd_FMCuse{ - local($_) = @_; - local($key); - - $key = &missing_braces - unless ((s/$next_pair_pr_rx//o)&&($key=$2)); - - $fmtcntvar{$key}.$_; -} - -sub do_cmd_storeordinalstring{ - local($_) = @_; - local($key); - - $key = &missing_braces - unless ((s/$next_pair_pr_rx//o)&&($key=$2)); - - local($ctr, $val, $id, $_) = &read_counter_value($_); - my($gender)='m'; - - $_ =~ s/${OP}$id${CP}$ctr${OP}$id${CP}//; - - if ($_ =~s/\s*\[(.)\]//) - { - $gender = $1; - } - - if ($ctr eq 'DAY' or $ctr eq 'MONTH' or $ctr eq 'YEAR') - { - # this is a cludge to make it work with newdateformat - $fmtcntvar{$key} = join('', '{ORDINALSTRING{', $ctr, '}}'); - } - else - { - $fmtcntvar{$key} = join('', &get_ordinalstring($val, $gender)); - } - - $_; -} - -sub do_cmd_storeordinalstringnum{ - local($_) = @_; - local($key, $val); - - $key = &missing_braces - unless ((s/$next_pair_pr_rx//o)&&($key=$2)); - - $val = &missing_braces - unless (s/$next_pair_pr_rx/$val=$2;''/eo); - - my($gender)='m'; - - if ($_ =~s/\s*\[(.)\]//) - { - $gender = $1; - } - - $fmtcntvar{$key} = join('', &get_ordinalstring($val, $gender)); - - $_; -} - -sub get_Ordinalstring{ - local($val,$gender) = @_; - local($string) = &get_ordinalstring($val,$gender); - - if ($default_language=~m/german/) - { - $string =~ s/\b([a-z])([^\s\-]+)/\u\1\2/; - } - else - { - $string =~ s/\b([a-z])([^\s\-]+)/\u\1\2/g; - - if ($default_language eq 'french') - { - $string =~ s/ Et / et /g; - } - else - { - $string =~ s/ And / and /g; - } - } - - $string; -} - -sub do_cmd_Ordinalstringnum{ - local($_) = @_; - local($num,$gender); - $num = &missing_braces - unless (s/$next_pair_pr_rx/$num=$2;''/eo); - - if (s/\[(m|f|n)\]//) - { - $gender = $1; - } - else - { - $gender = 'm'; - } - - join('', &get_Ordinalstring($num,$gender), $_); -} - -sub do_cmd_Ordinalstring{ - local($ctr, $val, $id, $_) = &read_counter_value($_[0]); - my($gender)='m'; - - $_[0] =~ s/${OP}$id${CP}$ctr${OP}$id${CP}//; - - if ($_[0]=~s/\[(.)\]//) - { - $gender = $1; - } - - if ($ctr eq 'DAY' or $ctr eq 'MONTH' or $ctr eq 'YEAR') - { - # this is a cludge to make it work with newdateformat - join('', '{OORDINALSTRING{', $ctr, '}}', $_[0]); - } - else - { - join('', &get_Ordinalstring($val, $gender), $_[0]); - } -} - -sub do_cmd_storeOrdinalstring{ - local($_) = @_; - local($key); - - $key = &missing_braces - unless ((s/$next_pair_pr_rx//o)&&($key=$2)); - - local($ctr, $val, $id, $_) = &read_counter_value($_); - my($gender)='m'; - - $_ =~ s/${OP}$id${CP}$ctr${OP}$id${CP}//; - - if ($_ =~s/\s*\[(.)\]//) - { - $gender = $1; - } - - if ($ctr eq 'DAY' or $ctr eq 'MONTH' or $ctr eq 'YEAR') - { - # this is a cludge to make it work with newdateformat - $fmtcntvar{$key} = join('', '{OORDINALSTRING{', $ctr, '}}'); - } - else - { - $fmtcntvar{$key} = join('', &get_Ordinalstring($val, $gender)); - } - - $_; -} - -sub do_cmd_storeOrdinalstringnum{ - local($_) = @_; - local($key, $val); - - $key = &missing_braces - unless ((s/$next_pair_pr_rx//o)&&($key=$2)); - - $val = &missing_braces - unless (s/$next_pair_pr_rx/$val=$2;''/eo); - - my($gender)='m'; - - if ($_ =~s/\s*\[(.)\]//) - { - $gender = $1; - } - - $fmtcntvar{$key} = join('', &get_Ordinalstring($val, $gender)); - - $_; -} - -sub do_cmd_ORDINALstringnum{ - local($_) = @_; - local($num,$gender); - $num = &missing_braces - unless (s/$next_pair_pr_rx/$num=$2;''/eo); - - if (s/\[(m|f|n)\]//) - { - $gender = $1; - } - else - { - $gender = 'm'; - } - - join('', uc(&get_ordinalstring($num,$gender)), $_); -} - -sub do_cmd_ORDINALstring{ - local($ctr, $val, $id, $_) = &read_counter_value($_[0]); - my($gender)='m'; - - $_[0] =~ s/${OP}$id${CP}$ctr${OP}$id${CP}//; - - if ($_[0]=~s/\[(.)\]//) - { - $gender = $1; - } - - if ($ctr eq 'DAY' or $ctr eq 'MONTH' or $ctr eq 'YEAR') - { - # this is a cludge to make it work with newdateformat - join('', '{CAPORDINALSTRING{', $ctr, '}}', $_); - } - else - { - join('', uc(&get_ordinalstring($val, $gender)), $_); - } -} - -sub do_cmd_storeORDINALstring{ - local($_) = @_; - local($key); - - $key = &missing_braces - unless ((s/$next_pair_pr_rx//o)&&($key=$2)); - - local($ctr, $val, $id, $_) = &read_counter_value($_); - my($gender)='m'; - - $_ =~ s/${OP}$id${CP}$ctr${OP}$id${CP}//; - - if ($_ =~s/\s*\[(.)\]//) - { - $gender = $1; - } - - if ($ctr eq 'DAY' or $ctr eq 'MONTH' or $ctr eq 'YEAR') - { - # this is a cludge to make it work with newdateformat - $fmtcntvar{$key} = join('', '{CAPORDINALSTRING{', $ctr, '}}'); - } - else - { - $fmtcntvar{$key} = uc(&get_ordinalstring($val, $gender)); - } - - $_; -} - -sub do_cmd_storeORDINALstringnum{ - local($_) = @_; - local($key, $val); - - $key = &missing_braces - unless ((s/$next_pair_pr_rx//o)&&($key=$2)); - - $val = &missing_braces - unless (s/$next_pair_pr_rx/$val=$2;''/eo); - - my($gender)='m'; - - if ($_ =~s/\s*\[(.)\]//) - { - $gender = $1; - } - - $fmtcntvar{$key} = uc(&get_ordinalstring($val, $gender)); - - $_; -} - -sub do_cmd_fmtcountsetoptions{ - local($_) = @_; - local($options) = &missing_braces unless ($_[0]=~(s/$next_pair_pr_rx//o)&&($options=$2)); - - if ($options =~ m/french=?(\w*)(,|$)/) - { - if ($1 eq 'france' or $1 eq 'swiss' or $1 eq 'belgian') - { - $frenchdialect = $1; - - print "Using French dialect: $1" if ($VERBOSITY > 0) ; - } - elsif ($1 eq '') - { - $frenchdialect = 'france'; - - print "Using French dialect: france" if ($VERBOSITY > 0); - } - else - { - &write_warnings("unknown french dialect '$1'"); - } - } - - if ($options =~ m/abbrv=?(\w*)(,|$)/) - { - if ($1 eq 'true' or $1 eq '') - { - $ordinalabbrv = 1; - - print "Setting abbrv=true" if ($VERBOSITY > 0); - } - elsif ($1 eq 'false') - { - $ordinalabbrv = 0; - - print "Setting abbrv=false" if ($VERBOSITY > 0); - } - else - { - &write_warnings("fmtcountsetoptions key abbrv: unknown value '$1'."); - } - } - - if ($options =~ m/fmtord=(\w*)(,|$)/) - { - if ($1 eq 'raise') - { - &do_fmtcount_raise(); - - print "Using raised ordinals" if ($VERBOSITY > 0); - } - elsif ($1 eq 'level') - { - &do_fmtcount_level(); - - print "Using level ordinals" if ($VERBOSITY > 0); - } - elsif ($1 eq 'user') - { - # do nothing - - print "Using user defined fmtord" if ($VERBOSITY > 0); - } - else - { - &write_warnings("unknown fmtcount option fmtord=$1"); - } - } - - $_[0]; -} - -$padzeroes = 0; - -sub do_cmd_padzeroes{ - local($_) = @_; - local($val,$pat) = &get_next_optional_argument; - - if ($val eq '') - { - $padzeroes = 17; - } - else - { - $padzeroes = $val; - } - - $_; -} - -sub get_binary{ - local($num) = @_; - local($val) = ""; - - for (my $i=17; $i>=0; $i--) - { - if (($i < $padzeroes) || ($num & (1 << $i)) || !($val eq "")) - { - $val .= ($num & (1 << $i) ? 1 : 0); - } - } - - $val; -} - -sub do_cmd_binary{ - local($ctr, $val, $id, $_) = &read_counter_value($_[0]); - - join('', &get_binary($val), $_); -} - -sub do_cmd_binarynum{ - local($_) = @_; - local($num) = &missing_braces - unless (s/$next_pair_pr_rx/$num=$2;''/eo); - - join('', &get_binary($num), $_); -} - -sub get_decimal{ - local($num) = @_; - - sprintf "%0${padzeroes}d", $num; -} - -sub do_cmd_decimal{ - local($ctr, $val, $id, $_) = &read_counter_value($_[0]); - - join('', &get_decimal($val), $_); -} - -sub do_cmd_decimalnum{ - local($_) = @_; - local($num) = &missing_braces - unless (s/$next_pair_pr_rx/$num=$2;''/eo); - - join('', &get_decimal($num), $_); -} - -sub get_hexadecimal{ - local($num) = @_; - - sprintf "%0${padzeroes}lx", $num; -} - -sub do_cmd_hexadecimal{ - local($ctr, $val, $id, $_) = &read_counter_value($_[0]); - - join('', &get_hexadecimal($val), $_); -} - -sub do_cmd_hexadecimalnum{ - local($_) = @_; - local($num) = &missing_braces - unless (s/$next_pair_pr_rx/$num=$2;''/eo); - - join('', &get_hexadecimal($num), $_); -} - -sub get_Hexadecimal{ - local($num) = @_; - - sprintf "%0${padzeroes}lX", $num; -} - -sub do_cmd_Hexadecimal{ - local($ctr, $val, $id, $_) = &read_counter_value($_[0]); - - join('', &get_Hexadecimal($val), $_); -} - -sub do_cmd_Hexadecimalnum{ - local($_) = @_; - local($num) = &missing_braces - unless (s/$next_pair_pr_rx/$num=$2;''/eo); - - join('', &get_Hexadecimal($num), $_); -} - -sub get_octal{ - local($num) = @_; - - sprintf "%0${padzeroes}lo", $num; -} - -sub do_cmd_octal{ - local($ctr, $val, $id, $_) = &read_counter_value($_[0]); - - join('', &get_octal($val), $_); -} - -sub do_cmd_octalnum{ - local($_) = @_; - local($num) = &missing_braces - unless (s/$next_pair_pr_rx/$num=$2;''/eo); - - join('', &get_octal($num), $_); -} - -sub get_aaalph{ - local($num) = @_; - local($rep) = int($num/26) + 1; - local($c) = chr(ord('a')-1+$num%26); - - local($_) = $c x $rep; -} - -sub do_cmd_aaalph{ - local($ctr, $val, $id, $_) = &read_counter_value($_[0]); - - join('', &get_aaalph($val), $_); -} - -sub get_AAAlph{ - local($num) = @_; - local($rep) = int($num/26) + 1; - local($c) = chr(ord('A')-1+$num%26); - - local($_) = $c x $rep; -} - -sub do_cmd_AAAlph{ - local($ctr, $val, $id, $_) = &read_counter_value($_[0]); - - join('', &get_AAAlph($val), $_); -} - -sub do_cmd_aaalphnum{ - local($_) = @_; - local($num) = &missing_braces - unless (s/$next_pair_pr_rx/$num=$2;''/eo); - - join('', (sprintf "%${padzeroes}s", &get_aaalph($num)), $_); -} - -sub do_cmd_AAAlphnum{ - local($_) = @_; - local($num) = &missing_braces - unless (s/$next_pair_pr_rx/$num=$2;''/eo); - - join('', uc(sprintf "%${padzeroes}s", &get_aaalph($num)), $_); -} - -sub get_abalph{ - local($num) = @_; - local($str); - - if ($num == 0) - { - $str = ''; - } - elsif ($num > 0 && $num <= 26) - { - $str = chr(ord('a')-1+$num); - } - else - { - $str = &get_abalph(int($num/26)) . chr(ord('a')-1+($num%26)); - } - - $str; -} - -sub do_cmd_abalph{ - local($ctr, $val, $id, $_) = &read_counter_value($_[0]); - - join('', (sprintf "%${padzeroes}s", &get_abalph($val)), $_); -} - -sub do_cmd_abalphnum{ - local($_) = @_; - local($num) = &missing_braces - unless (s/$next_pair_pr_rx/$num=$2;''/eo); - - join('', (sprintf "%${padzeroes}s", &get_abalph($num)), $_); -} - -sub do_cmd_ABAlph{ - local($ctr, $val, $id, $_) = &read_counter_value($_[0]); - - join('', uc(sprintf "%${padzeroes}s", &get_abalph($val)), $_); -} - -sub do_cmd_ABAlphnum{ - local($_) = @_; - local($num) = &missing_braces - unless (s/$next_pair_pr_rx/$num=$2;''/eo); - - join('', uc(sprintf "%${padzeroes}s", &get_abalph($num)), $_); -} - -sub get_twodigit{ - local($num) = @_; - - sprintf "%02d", $num; -} - -sub do_cmd_twodigit{ - local($_) = @_; - local($num) = &missing_braces - unless (s/$next_pair_pr_rx/$num=$2;''/eo); - - # this is a cludge - if ($num eq "THEDAY" or $num eq "THEYEAR" or $num eq "THEMONTH") - { - join('', 'TWODIGIT{', $num, '}', $_); - } - else - { - join('', &get_twodigit($num), $_); - } -} - -# this was put here to help with the definition of \datelatin - -sub do_cmd_romannumeral{ - local($_) = @_; - local($num) = &missing_braces - unless (s/$next_pair_pr_rx/$num=$2;''/eo); - - # this is a cludge - if ($num eq "THEDAY" or $num eq "THEYEAR" or $num eq "THEMONTH") - { - join('', 'ROMANNUMERAL{', $num, '}', $_); - } - else - { - join('', &froman($num), $_); - } -} - -# load configuration file if it exists -# Note: The configuration file should be loaded before -# the package options are executed. - -# why doesn't this work? If I call this subroutine it -# causes an infinite loop. - -sub load_fmtcount_cfg{ - local($file,$found); - - $file = &fulltexpath('fmtcount.cfg'); - - $found = (-f $file); - - if (!$found) - { - foreach $texpath (split /$envkey/, $TEXINPUTS) - { - $file = "$texpath${dd}fmtcount.cfg"; - - last if ($found = (-f $file)); - } - } - - if ($found) - { - print "\nusing configuration file $file\n"; - - &slurp_input($file); - &pre_process; - &substitute_meta_cmds if (%new_command || %new_environment); - &wrap_shorthand_environments; - $_ = &translate_commands(&translate_environments($_)); - - print "\n processed size: ".length($_)."\n" if ($VERBOSITY>1) - } - else - { - print "\nNo configuation file fmtcount.cfg found\n" if ($VERBOSITY>1) - } -} - -1; diff --git a/Master/texmf-dist/doc/latex/fmtcount/latex2html/fmtcount.perl b/Master/texmf-dist/doc/latex/fmtcount/latex2html/fmtcount.perl deleted file mode 100644 index bc7d3b9fb4e..00000000000 --- a/Master/texmf-dist/doc/latex/fmtcount/latex2html/fmtcount.perl +++ /dev/null @@ -1,2670 +0,0 @@ -# File : fmtcount.perl -# Author : Nicola Talbot -# Date : 26 May 2007 -# Version : 1.05 -# Description : LaTeX2HTML implementation of fmtcount package - -package main; - -sub do_fmtcount_raise{ - local($tmp)=""; - - $tmp .= 'sub do_cmd_fmtord{'; - $tmp .= 'local($_) = @_;'; - $tmp .= 'local($suffix) = &missing_braces unless (s/$next_pair_pr_rx/$suffix=$2;\'\'/eo);'; - $tmp .= 'join("", "",$suffix,"",$_);'; - $tmp .='}'; - - eval($tmp); -} - -sub do_fmtcount_level{ - local($tmp)=""; - - $tmp .= 'sub do_cmd_fmtord{'; - $tmp .= 'local($_) = @_;'; - $tmp .= 'local($suffix) = &missing_braces unless (s/$next_pair_pr_rx/$suffix=$2;\'\'/eo);'; - $tmp .= 'join("", $suffix,$_);'; - $tmp .='}'; - - eval($tmp); -} - -if (not defined &do_cmd_fmtord) -{ - &do_fmtcount_raise(@_); -} - -$frenchdialect = 'france'; -$ordinalabbrv = 0; - -sub get_ordinal_suffix_english{ - local($num,$gender) = @_; - local($suffix); - - if ((($num % 10) == 1) && ($num%100 != 11)) - { - $suffix = 'st'; - } - elsif ((($num % 10) == 2) && ($num%100 != 12)) - { - $suffix = 'nd'; - } - elsif ((($num % 10) == 3) && ($num%100 != 13)) - { - $suffix = 'rd'; - } - else - { - $suffix = 'th'; - } - - $suffix; -} - -sub get_ordinal_suffix_french{ - local($num,$gender) = @_; - local($_); - - if ($ordinalabbrv > 0) - { - $_ = 'e'; - } - else - { - if ($num == 1) - { - $_ = ($gender eq 'f' ? 'ere' : 'er'); - } - else - { - $_ = 'eme'; - } - } -} - -sub get_ordinal_suffix_spanish{ - local($num,$gender) = @_; - - ($gender eq 'f' ? 'a' : 'o'); -} - -sub get_ordinal_suffix_portuges{ - local($num,$gender) = @_; - - ($gender eq 'f' ? 'a' : 'o'); -} - -sub get_ordinal_suffix_german{ - local($num,$gender) = @_; - - ''; -} - -sub get_ordinal_suffix_ngerman{ - local($num,$gender) = @_; - - ''; -} - -sub get_ordinal_suffix{ - local($num,$gender) = @_; - local($suffix,$suffixsub); - - $suffixsub = "get_ordinal_suffix_$default_language"; - - if (defined ($suffixsub)) - { - $suffix = &$suffixsub($num,$gender); - } - else - { - $suffix = &get_ordinal_suffix_english($num,$gender); - } - - $suffix; -} - -sub getordinal{ - local($num,$gender) = @_; - local($suffix) = &get_ordinal_suffix($num,$gender); - local($text)=''; - - if ($suffix eq '') - { - $text = $num; - } - else - { - local($br_id) = ++$global{'max_id'}; - $text = $num . "\\fmtord${OP}$br_id${CP}$suffix${OP}$br_id${CP}"; - } - - $text; -} - -sub do_cmd_ordinalnum{ - local($_) = @_; - local($num) = &missing_braces - unless (s/$next_pair_pr_rx/$num=$2;''/eo); - my($gender)='m'; - local($suffix)=''; - - if (s/\[([mfn])\]//) - { - $gender = $1; - } - - $suffix = &get_ordinal_suffix($num,$gender); - - local($br_id) = ++$global{'max_id'}; - join('', $num, "\\fmtord${OP}$br_id${CP}$suffix${OP}$br_id${CP}", $_); -} - -sub do_cmd_FCordinal{ - &do_cmd_ordinal; -} - -sub do_cmd_ordinal{ - local($ctr, $val, $id, $_) = &read_counter_value($_[0]); - my($gender)='m'; - - $_[0] =~ s/${OP}$id${CP}$ctr${OP}$id${CP}//; - - if ($_[0]=~s/\[(.)\]//) - { - $gender = $1; - } - - if ($ctr eq 'DAY' or $ctr eq 'MONTH' or $str eq 'YEAR') - { - # this is a cludge to make it work with newdateformat - join('', '{ORDINAL{', $ctr, '}}', $_[0]); - } - else - { - join('', &getordinal($val, $gender), $_[0]); - } -} - -sub do_cmd_storeordinal{ - local($_) = @_; - local($key); - - $key = &missing_braces - unless ((s/$next_pair_pr_rx//o)&&($key=$2)); - - local($ctr, $val, $id, $_) = &read_counter_value($_); - my($gender)='m'; - - $_ =~ s/${OP}$id${CP}$ctr${OP}$id${CP}//; - - if ($_ =~s/\s*\[(.)\]//) - { - $gender = $1; - } - - if ($ctr eq 'DAY' or $ctr eq 'MONTH' or $ctr eq 'YEAR') - { - # this is a cludge to make it work with newdateformat - $fmtcntvar{$key} = join('', '{ORDINAL{', $ctr, '}}'); - } - else - { - $fmtcntvar{$key} = &getordinal($val, $gender); - } - - $_; -} - -sub do_cmd_storeordinalnum{ - local($_) = @_; - local($key, $val); - - $key = &missing_braces - unless ((s/$next_pair_pr_rx//o)&&($key=$2)); - - $val = &missing_braces - unless (s/$next_pair_pr_rx/$val=$2;''/eo); - - my($gender)='m'; - - if ($_ =~s/\s*\[([mfn])\]//) - { - $gender = $1; - } - - $fmtcntvar{$key} = &getordinal($val, $gender); - - $_; -} - -@unitthstring = ('zeroth', - 'first', - 'second', - 'third', - 'fourth', - 'fifth', - 'sixth', - 'seventh', - 'eighth', - 'ninth'); - -@tenthstring = ('', - 'tenth', - 'twentieth', - 'thirtieth', - 'fortieth', - 'fiftieth', - 'sixtieth', - 'seventieth', - 'eightieth', - 'ninetieth'); - -@teenthstring = ('tenth', - 'eleventh', - 'twelfth', - 'thirteenth', - 'fourteenth', - 'fifteenth', - 'sixteenth', - 'seventeenth', - 'eighteenth', - 'nineteenth'); - -@unitstring = ('zero', - 'one', - 'two', - 'three', - 'four', - 'five', - 'six', - 'seven', - 'eight', - 'nine'); - -@teenstring = ('ten', - 'eleven', - 'twelve', - 'thirteen', - 'fourteen', - 'fifteen', - 'sixteen', - 'seventeen', - 'eighteen', - 'nineteen'); -@tenstring = ('', - 'ten', - 'twenty', - 'thirty', - 'forty', - 'fifty', - 'sixty', - 'seventy', - 'eighty', - 'ninety'); - -$hundredname = "hundred"; -$hundredthname = "hundredth"; -$thousandname = "thousand"; -$thousandthname = "thousandth"; - -sub get_numberstringenglish{ - local($num) = @_; - local($name)=""; - - unless (($num >= 1000000) || ($num < 0)) - { - if ($num >= 1000) - { - local($thousands) = &get_numberstringenglish($num/1000); - $name .= $thousands . " $thousandname"; - $num = $num%1000; - } - - if ($num >= 100) - { - if ($_[0] >= 1000) { $name .= " "; } - - local($hundreds) = &get_numberstringenglish($num/100); - $name .= $hundreds . " $hundredname"; - $num = $num%100; - } - - if (($_[0] > 100) && ($_[0]%100 > 0)) { $name .= " and "; } - - if ($num >= 20) - { - $name .= $tenstring[$num/10]; - - if ($num%10 > 0) { $name .= '-'; } - } - - if (($num >= 10) && ($num < 20)) - { - $name .= $teenstring[$num%10]; - } - elsif (($num%10 > 0) || ($_[0] == 0)) - { - $name .= $unitstring[$num%10]; - } - } - - $name; -} - -@unitthstringfrench = ('zeroi\`eme', - 'uni\`eme', - 'deuxi\`eme', - 'troisi\`eme', - 'quatri\`eme', - 'cinqui\`eme', - 'sixi\`eme', - 'septi\`eme', - 'huiti\`eme', - 'neuvi\`eme'); - -@tenthstringfrench = ('', - 'dixi\`eme', - 'vingti\`eme', - 'trentri\`eme', - 'quaranti\`eme', - 'cinquanti\`eme', - 'soixanti\`eme', - 'septenti\`eme', - 'huitanti\`eme', - 'nonenti\`eme'); - -@teenthstringfrench = ('dixi\`eme', - 'onzi\`eme', - 'douzi\`eme', - 'treizi\`eme', - 'quatorzi\`eme', - 'quinzi\`eme', - 'seizi\`eme', - 'dix-septi\`eme', - 'dix-huiti\`eme', - 'dix-neuvi\`eme'); - -@unitstringfrench = ('zero', - 'un', - 'deux', - 'trois', - 'quatre', - 'cinq', - 'six', - 'sept', - 'huit', - 'neuf'); - -@teenstringfrench = ('dix', - 'onze', - 'douze', - 'treize', - 'quatorze', - 'quinze', - 'seize', - 'dix-sept', - 'dix-huit', - 'dix-neuf'); - -@tenstringfrench = ('', - 'dix', - 'vingt', - 'trente', - 'quarante', - 'cinquante', - 'soixante', - 'septente', - 'huitante', - 'nonente'); - -$hundrednamefrench = "cent"; -$hundredthnamefrench = "centi\\`eme"; -$thousandnamefrench = "mille"; -$thousandthnamefrench = "mili\\`eme"; - -@unitthstringspanish = ('cero', - 'primero', - 'segundo', - 'tercero', - 'cuarto', - 'quinto', - 'sexto', - 's\\\'eptimo', - 'octavo', - 'noveno'); - -@tenthstringspanish = ('', - 'd\\\'ecimo', - 'vig\\\'esimo', - 'trig\\\'esimo', - 'cuadrag\\\'esimo', - 'quincuag\\\'esimo', - 'sexag\\\'esimo', - 'septuag\\\'esimo', - 'octog\\\'esimo', - 'nonag\\\'esimo'); - -@teenthstringspanish = ('d\\\'ecimo', - 'und\\\'ecimo', - 'duod\\\'ecimo', - 'decimotercero', - 'decimocuarto', - 'decimoquinto', - 'decimosexto', - 'decimos\\\'eptimo', - 'decimoctavo', - 'decimonoveno'); - -@hundredthstringspanish = ('', - 'cent\\\'esimo', - 'ducent\\\'esimo', - 'tricent\\\'esimo', - 'cuadringent\\\'esimo', - 'quingent\\\'esimo', - 'sexcent\\\'esimo', - 'septing\\\'esimo', - 'octingent\\\'esimo', - 'noningent\\\'esimo'); - -@unitstringspanish = ('cero', - 'uno', - 'dos', - 'tres', - 'cuatro', - 'cinco', - 'seis', - 'siete', - 'ocho', - 'nueve'); - -@teenstringspanish = ('diez', - 'once', - 'doce', - 'trece', - 'catorce', - 'quince', - 'diecis\\\'eis', - 'diecisiete', - 'dieciocho', - 'diecinueve'); - -@twentystringspanish = ('viente', - 'vientiuno', - 'vientid\\\'os', - 'vientitr\\\'es', - 'vienticuatro', - 'vienticinco', - 'vientis\\\'eis', - 'vientisiete', - 'vientiocho', - 'vientinueve'); - -@tenstringspanish = ('', - 'diez', - 'viente', - 'treinta', - 'cuarenta', - 'cincuenta', - 'sesenta', - 'setenta', - 'ochenta', - 'noventa'); - -@hundredstringspanish = ('', - 'ciento', - 'doscientos', - 'trescientos', - 'cuatrocientos', - 'quinientos', - 'seiscientos', - 'setecientos', - 'ochocientos', - 'novecientos'); - -$hundrednamespanish = "cien"; -$hundredthnamespanish = "centi\\`eme"; -$thousandnamespanish = "mil"; -$thousandthnamespanish = "mil\\'esimo"; - -@unitthstringportuges = ('zero', - 'primeiro', - 'segundo', - 'terceiro', - 'quatro', - 'quinto', - 'sexto', - 's\\\'etimo', - 'oitavo', - 'nono'); - -@tenthstringportuges = ('', - 'd\\\'ecimo', - 'vig\\\'esimo', - 'trig\\\'esimo', - 'quadrag\\\'esimo', - 'q\"uinquag\\\'esimo', - 'sexag\\\'esimo', - 'setuag\\\'esimo', - 'octog\\\'esimo', - 'nonag\\\'esimo'); - -@hundredthstringportuges = ('', - 'cent\\\'esimo', - 'ducent\\\'esimo', - 'trecent\\\'esimo', - 'quadringent\\\'esimo', - 'q\"uingent\\\'esimo', - 'seiscent\\\'esimo', - 'setingent\\\'esimo', - 'octingent\\\'esimo', - 'nongent\\\'esimo'); - -@unitstringportuges = ('zero', - 'um', - 'dois', - 'tr\^es', - 'quatro', - 'cinco', - 'seis', - 'sete', - 'oito', - 'nove'); - -@teenstringportuges = ('dez', - 'onze', - 'doze', - 'treze', - 'quatorze', - 'quinze', - 'dezesseis', - 'dezessete', - 'dezoito', - 'dezenove'); - -@tenstringportuges = ('', - 'dez', - 'vinte', - 'trinta', - 'quaranta', - 'cinq\"uenta', - 'sessenta', - 'setenta', - 'oitenta', - 'noventa'); - -@hundredstringportuges = ('', - 'cento', - 'duzentos', - 'trezentos', - 'quatrocentos', - 'quinhentos', - 'seiscentos', - 'setecentos', - 'oitocentos', - 'novecentos'); - -$hundrednameportuges = "cem"; -$thousandnameportuges = "mil"; -$thousandthnameportuges = "mil\\'esimo"; - -sub get_numberstringfrench{ - local($num,$gender) = @_; - local($name)=""; - - if ($gender eq 'f') - { - $unitstringfrench[1] = 'une'; - } - else - { - $unitstringfrench[1] = 'un'; - } - - unless (($num >= 1000000) || ($num < 0)) - { - if ($num >= 1000) - { - local($thousands) = ''; - - if ($num >= 2000) - { - $thousands = &get_numberstringfrench($num/1000,$gender).' '; - } - - $name .= $thousands . $thousandnamefrench; - $num = $num%1000; - } - - if ($num >= 100) - { - if ($_[0] >= 1000) { $name .= " "; } - - local($hundreds) = ''; - - if ($num >= 200) - { - $hundreds = &get_numberstringfrench($num/100,$gender).' '; - } - - $name .= $hundreds . $hundrednamefrench; - $num = $num%100; - - if (($_[0]%100 == 0) && ($_[0]/100 > 1)) - { - $name .= 's'; - } - } - - if (($_[0] > 100) && ($_[0]%100 > 0)) { $name .= " "; } - - if ($num >= 20) - { - if ($frenchdialect eq 'france' and $num >= 70) - { - if ($num < 80) - { - $name .= $tenstringfrench[6]; - - if ($num%10 == 1) - { - $name .= ' et '; - } - else - { - $name .= '-'; - } - - $num = 10+($num%10); - } - else - { - $name .= 'quatre-vingt' . ($num==80?'s':'-'); - - if ($num >= 90) - { - $num = 10+($num%10); - } - } - } - elsif ($frenchdialect eq 'belgian' - && ($num >= 80) && ($num < 90)) - { - $name .= 'quatre-vingt' . ($num==80?'s':'-'); - } - else - { - $name .= $tenstringfrench[$num/10]; - - if ($num%10 == 1) { $name .= ' et ';} - elsif ($num%10 > 0) { $name .= '-'; } - } - } - - if (($num >= 10) && ($num < 20)) - { - $name .= $teenstringfrench[$num%10]; - } - elsif (($num%10 > 0) || ($_[0] == 0)) - { - $name .= $unitstringfrench[$num%10]; - } - } - - $name; -} - -sub get_numberstringspanish{ - local($num,$gender) = @_; - local($name)=""; - - if ($gender eq 'f') - { - $unitstringspanish[1] = 'una'; - } - else - { - $unitstringspanish[1] = 'uno'; - } - - unless (($num >= 1000000) || ($num < 0)) - { - if ($num >= 1000) - { - local($thousands) = ''; - - if ($num >= 2000) - { - $thousands = &get_numberstringspanish($num/1000,$gender).' '; - } - - $name .= $thousands . $thousandnamespanish; - $num = $num%1000; - } - - if ($num >= 100) - { - if ($_[0] >= 1000) { $name .= " "; } - - local($hundreds) = ''; - - if ($num > 100) - { - $hundreds = $hundredstringspanish[$num/100]; - } - else - { - $hundreds = 'cien'; - } - - $name .= $hundreds; - $num = $num%100; - } - - if (($_[0] > 100) && ($_[0]%100 > 0)) { $name .= " y "; } - - if ($num >= 30) - { - $name .= $tenstringspanish[$num/10]; - - if ($num%10 > 0) { $name .= ' y '; } - } - - if (($num >=20) && ($num < 30)) - { - $name .= $twentystringspanish[$num%10]; - } - elsif (($num >= 10) && ($num < 20)) - { - $name .= $teenstringspanish[$num%10]; - } - elsif (($num%10 > 0) || ($_[0] == 0)) - { - $name .= $unitstringspanish[$num%10]; - } - } - - $name; -} - -sub get_numberstringportuges{ - local($num,$gender) = @_; - local($name)=""; - - if ($gender eq 'f') - { - $unitstringportuges[0] = 'zera'; - $unitstringportuges[1] = 'uma'; - $unitstringportuges[2] = 'duas'; - } - else - { - $unitstringportuges[0] = 'zero'; - $unitstringportuges[1] = 'um'; - $unitstringportuges[2] = 'dois'; - } - - unless (($num >= 1000000) || ($num < 0)) - { - if ($num >= 1000) - { - local($thousands) = ''; - - if ($num >= 2000) - { - $thousands = &get_numberstringportuges($num/1000,$gender).' '; - } - - $name .= $thousands . $thousandnameportuges; - $num = $num%1000; - } - - if ($num >= 100) - { - if ($_[0] >= 1000) { $name .= " "; } - - local($hundreds) = ''; - - if ($num > 100) - { - $hundreds = $hundredstringportuges[$num/100]; - - if ($gender eq 'f' and $num >= 200) - { - $hundreds =~s/o(s?)$/a\1/; - } - } - else - { - $hundreds = $hundrednameportuges; - } - - $name .= $hundreds; - $num = $num%100; - } - - if (($_[0] > 100) && ($_[0]%100 > 0)) { $name .= " e "; } - - if ($num >= 20) - { - $name .= $tenstringportuges[$num/10]; - - if ($num%10 == 1) { $name .= ' e ';} - elsif ($num%10 > 0) { $name .= ' '; } - } - - if (($num >= 10) && ($num < 20)) - { - $name .= $teenstringportuges[$num%10]; - } - elsif (($num%10 > 0) || ($_[0] == 0)) - { - $name .= $unitstringportuges[$num%10]; - } - } - - $name; -} - -@unitthstringMgerman = ('nullter', - 'erster', - 'zweiter', - 'dritter', - 'vierter', - 'f\\"unter', - 'sechster', - 'siebter', - 'achter', - 'neunter'); - -@tenthstringMgerman = ('', - 'zehnter', - 'zwanzigster', - 'drei\\ss igster', - 'vierzigster', - 'f\\"unfzigster', - 'sechzigster', - 'siebzigster', - 'achtzigster', - 'neunzigster'); - -@teenthstringMgerman = ('zehnter', - 'elfter', - 'zw\\"olfter', - 'dreizehnter', - 'vierzehnter', - 'f\\"unfzehnter', - 'sechzehnter', - 'siebzehnter', - 'achtzehnter', - 'neunzehnter'); - -@unitthstringFgerman = ('nullte', - 'erste', - 'zweite', - 'dritte', - 'vierte', - 'f\\"unfte', - 'sechste', - 'siebte', - 'achte', - 'neunte'); - -@tenthstringFgerman = ('', - 'zehnte', - 'zwanzigste', - 'drei\\ss igste', - 'vierzigste', - 'f\\"unfzigste', - 'sechzigste', - 'siebzigste', - 'achtzigste', - 'neunzigste'); - -@teenthstringFgerman = ('zehnte', - 'elfte', - 'zw\\"olfte', - 'dreizehnte', - 'vierzehnte', - 'f\\"unfzehnte', - 'sechzehnte', - 'siebzehnte', - 'achtzehnte', - 'neunzehnte'); - -@unitthstringNgerman = ('nulltes', - 'erstes', - 'zweites', - 'drittes', - 'viertes', - 'f\\"unte', - 'sechstes', - 'siebtes', - 'achtes', - 'neuntes'); - -@tenthstringNgerman = ('', - 'zehntes', - 'zwanzigstes', - 'drei\\ss igstes', - 'vierzigstes', - 'f\\"unfzigstes', - 'sechzigstes', - 'siebzigstes', - 'achtzigstes', - 'neunzigstes'); - -@teenthstringNgerman = ('zehntes', - 'elftes', - 'zw\\"olftes', - 'dreizehntes', - 'vierzehntes', - 'f\\"unfzehntes', - 'sechzehntes', - 'siebzehntes', - 'achtzehntes', - 'neunzehntes'); - -@unitstringgerman = ('null', - 'ein', # eins dealt with separately (this is for prefixes) - 'zwei', - 'drei', - 'vier', - 'f\\"unf', - 'sechs', - 'sieben', - 'acht', - 'neun'); - -@teenstringgerman = ('zehn', - 'elf', - 'zw\\"olf', - 'dreizehn', - 'vierzehn', - 'f\\"unfzehn', - 'sechzehn', - 'siebzehn', - 'achtzehn', - 'neunzehn'); - -@tenstringgerman = ('', - 'zehn', - 'zwanzig', - 'drei\\ss ig', - 'vierzig', - 'f\\"unfzig', - 'sechzig', - 'siebzig', - 'achtzig', - 'neunzig'); - -sub do_cmd_einhundert{ - local($_) = @_; - - "einhundert$_"; -} - -sub do_cmd_eintausend{ - local($_) = @_; - - "eintausend$_"; -} - -sub get_numberunderhundredgerman{ - local($num)=@_; - local($name)=''; - - if ($num == 1) - { - $name = 'eins'; - } - elsif ($num < 10) - { - $name = $unitstringgerman[$num]; - } - elsif ($num%10 == 0) - { - $name = $tenstringgerman[$num/10]; - } - else - { - $name = join('und', $unitstringgerman[$num%10], - $tenstringgerman[$num/10]); - } - - $name; -} - -sub get_numberstringgerman{ - local($orgnum,$gender) = @_; - local($name)=""; - - local($num) = $orgnum; - - unless (($num >= 1000000) || ($num < 0)) - { - if ($num >= 1000 and $num < 2000) - { - $name = &translate_commands("\\eintausend "); - } - elsif ($num >= 2000) - { - $name = &get_numberunderhundredgerman($num/1000) - . "tausend"; - } - - $num = $orgnum%1000; - - if ($num >= 100 and $num < 200) - { - if ($orgnum > 1000) - { - $name .= "einhundert"; - } - else - { - $name = &translate_commands("\\einhundert "); - } - } - elsif ($num >= 200) - { - $name .= $unitstringgerman[$num/100]."hundert"; - } - - $num = $num%100; - - if ($orgnum == 0) - { - $name = 'null'; - } - elsif ($num > 0) - { - $name .= &get_numberunderhundredgerman($num); - } - } - - $name; -} - -sub get_numberstring{ - local($val,$gender) = @_; - - if ($default_language eq 'french') - { - &get_numberstringfrench($val,$gender); - } - elsif ($default_language eq 'spanish') - { - &get_numberstringspanish($val,$gender); - } - elsif ($default_language eq 'portuges') - { - &get_numberstringportuges($val,$gender); - } - elsif ($default_language eq 'german' - or $default_language eq 'ngerman') - { - &get_numberstringgerman($val,$gender); - } - else - { - &get_numberstringenglish($val); - } -} - -sub do_cmd_numberstringnum{ - local($_) = @_; - local($num,$gender); - $num = &missing_braces unless - s/$next_pair_pr_rx/$num=$2;''/eo; - - if (s/\[(m|f|n)\]//) - { - $gender = $1; - } - else - { - $gender = 'm'; - } - - join('', &get_numberstring($num,$gender), $_); -} - -sub do_cmd_numberstring{ - local($ctr, $val, $id, $_) = &read_counter_value($_[0]); - my($gender)='m'; - - $_[0] =~ s/${OP}$id${CP}$ctr${OP}$id${CP}//; - - if ($_[0]=~s/\[(.)\]//) - { - $gender = $1; - } - - if ($ctr eq 'DAY' or $ctr eq 'MONTH' or $ctr eq 'YEAR') - { - # this is a cludge to make it work with newdateformat - join('', '{NUMBERSTRING{', $ctr, '}}', $_[0]); - } - else - { - join('', &get_numberstring($val, $gender), $_[0]); - } -} - -sub do_cmd_storenumberstring{ - local($_) = @_; - local($key); - - $key = &missing_braces - unless ((s/$next_pair_pr_rx//o)&&($key=$2)); - - local($ctr, $val, $id, $_) = &read_counter_value($_); - my($gender)='m'; - - $_ =~ s/${OP}$id${CP}$ctr${OP}$id${CP}//; - - if ($_ =~s/\s*\[(.)\]//) - { - $gender = $1; - } - - if ($ctr eq 'DAY' or $ctr eq 'MONTH' or $ctr eq 'YEAR') - { - # this is a cludge to make it work with newdateformat - $fmtcntvar{$key} = join('', '{NUMBERSTRING{', $ctr, '}}'); - } - else - { - $fmtcntvar{$key} = join('', &get_numberstring($val, $gender)); - } - - $_; -} - -sub do_cmd_storenumberstringnum{ - local($_) = @_; - local($key, $val); - - $key = &missing_braces - unless ((s/$next_pair_pr_rx//o)&&($key=$2)); - - $val = &missing_braces - unless (s/$next_pair_pr_rx/$val=$2;''/eo); - - my($gender)='m'; - - if ($_ =~s/\s*\[([mfn])\]//) - { - $gender = $1; - } - - $fmtcntvar{$key} = join('', &get_numberstring($val, $gender)); - - $_; -} - -sub get_Numberstring{ - local($val,$gender) = @_; - local($string) = &get_numberstring($val,$gender); - - if ($default_language=~m/german/) - { - $string =~ s/([a-z])([^\s\-]+)/\u\1\2/; - } - else - { - $string =~ s/([a-z])([^\s\-]+)/\u\1\2/g; - - if ($default_language eq 'french') - { - $string =~ s/ Et / et /g; - } - elsif ($default_language eq 'spanish') - { - $string =~ s/ Y / y /g; - } - elsif ($default_language eq 'portuges') - { - $string =~ s/ E / e /g; - } - else - { - $string =~ s/ And / and /g; - } - } - - $string; -} - -sub do_cmd_Numberstringnum{ - local($_) = @_; - local($num,$gender); - $num = &missing_braces - unless (s/$next_pair_pr_rx/$num=$2;''/eo); - - if (s/\[(m|f|n)\]//) - { - $gender = $1; - } - else - { - $gender = 'm'; - } - - join('', &get_Numberstring($num,$gender), $_); -} - -sub do_cmd_Numberstring{ - local($ctr, $val, $id, $_) = &read_counter_value($_[0]); - my($gender)='m'; - - $_[0] =~ s/${OP}$id${CP}$ctr${OP}$id${CP}//; - - if ($_[0]=~s/\[(.)\]//) - { - $gender = $1; - } - - if ($ctr eq 'DAY' or $ctr eq 'MONTH' or $ctr eq 'YEAR') - { - # this is a cludge to make it work with newdateformat - join('', '{NNUMBERSTRING{', $ctr, '}}', $_[0]); - } - else - { - join('', &get_Numberstring($val, $gender), $_[0]); - } -} - -sub do_cmd_storeNumberstring{ - local($_) = @_; - local($key); - - $key = &missing_braces - unless ((s/$next_pair_pr_rx//o)&&($key=$2)); - - local($ctr, $val, $id, $_) = &read_counter_value($_); - my($gender)='m'; - - $_ =~ s/${OP}$id${CP}$ctr${OP}$id${CP}//; - - if ($_ =~s/\s*\[([mfn])\]//) - { - $gender = $1; - } - - if ($ctr eq 'DAY' or $ctr eq 'MONTH' or $ctr eq 'YEAR') - { - # this is a cludge to make it work with newdateformat - $fmtcntvar{$key} = join('', '{NNUMBERSTRING{', $ctr, '}}'); - } - else - { - $fmtcntvar{$key} = join('', &get_Numberstring($val, $gender)); - } - - $_; -} - -sub do_cmd_storeNumberstringnum{ - local($_) = @_; - local($key, $val); - - $key = &missing_braces - unless ((s/$next_pair_pr_rx//o)&&($key=$2)); - - $val = &missing_braces - unless (s/$next_pair_pr_rx/$val=$2;''/eo); - - my($gender)='m'; - - if ($_ =~s/\s*\[([mfn])\]//) - { - $gender = $1; - } - - $fmtcntvar{$key} = join('', &get_Numberstring($val, $gender)); - - $_; -} - -sub do_cmd_NUMBERstringnum{ - local($_) = @_; - local($num,$gender); - $num = &missing_braces - unless (s/$next_pair_pr_rx/$num=$2;''/eo); - - if (s/\[(m|f|n)\]//) - { - $gender = $1; - } - else - { - $gender = 'm'; - } - - join('', uc(&get_numberstring($num,$gender)), $_); -} - -sub do_cmd_NUMBERstring{ - local($ctr, $val, $id, $_) = &read_counter_value($_[0]); - my($gender)='m'; - - $_[0] =~ s/${OP}$id${CP}$ctr${OP}$id${CP}//; - - if ($_[0]=~s/\[(.)\]//) - { - $gender = $1; - } - - if ($ctr eq 'DAY' or $ctr eq 'MONTH' or $ctr eq 'YEAR') - { - # this is a cludge to make it work with newdateformat - join('', '{CAPNUMBERSTRING{', $ctr, '}}', $_); - } - else - { - join('', uc(&get_numberstring($val, $gender)), $_); - } -} - -sub do_cmd_storeNUMBERstring{ - local($_) = @_; - local($key); - - $key = &missing_braces - unless ((s/$next_pair_pr_rx//o)&&($key=$2)); - - local($ctr, $val, $id, $_) = &read_counter_value($_); - my($gender)='m'; - - $_ =~ s/${OP}$id${CP}$ctr${OP}$id${CP}//; - - if ($_ =~s/\s*\[(.)\]//) - { - $gender = $1; - } - - if ($ctr eq 'DAY' or $ctr eq 'MONTH' or $ctr eq 'YEAR') - { - # this is a cludge to make it work with newdateformat - $fmtcntvar{$key} = join('', '{CAPNUMBERSTRING{', $ctr, '}}'); - } - else - { - $fmtcntvar{$key} = uc(&get_numberstring($val, $gender)); - } - - $_; -} - -sub do_cmd_storeNUMBERstringnum{ - local($_) = @_; - local($key, $val); - - $key = &missing_braces - unless ((s/$next_pair_pr_rx//o)&&($key=$2)); - - $val = &missing_braces - unless (s/$next_pair_pr_rx/$val=$2;''/eo); - - my($gender)='m'; - - if ($_ =~s/\s*\[([mfn])\]//) - { - $gender = $1; - } - - $fmtcntvar{$key} = uc(&get_numberstring($val, $gender)); - - $_; -} - -sub get_ordinalstringenglish{ - local($num) = @_; - local($name)=""; - - unless (($num >= 1000000) || ($num < 0)) - { - if ($num >= 1000) - { - local($thousands) = &get_numberstring($num/1000); - $name .= $thousands; - - if ($num%1000 > 0) - { - $name .= " $thousandname"; - } - else - { - $name .= " $thousandthname"; - } - - $num = $num%1000; - } - - if ($num >= 100) - { - if ($_[0] >= 1000) { $name .= " "; } - - local($hundreds) = &get_numberstring($num/100); - $name .= $hundreds; - - if ($num%100 > 0) - { - $name .= " $hundredname"; - } - else - { - $name .= " $hundredthname"; - } - - $num = $num%100; - } - - if (($_[0] > 100) && ($_[0]%100 > 0)) { $name .= " and "; } - - if ($num >= 20) - { - if ($num%10 > 0) - { - $name .= $tenstring[$num/10] . '-'; - } - else - { - $name .= $tenthstring[$num/10]; - } - } - - if (($num >= 10) && ($num < 20)) - { - $name .= $teenthstring[$num%10]; - } - elsif (($num%10 > 0) || ($_[0] == 0)) - { - $name .= $unitthstring[$num%10]; - } - } - - $name; -} - -sub get_ordinalstringfrench{ - local($num,$gender) = @_; - local($name)=""; - - unless (($num >= 1000000) || ($num < 0)) - { - if ($num >= 1000) - { - local($thousands) = ''; - - if ($num >= 2000) - { - $thousands = &get_numberstringfrench($num/1000,$gender).' '; - } - - $num = $num%1000; - - if ($num > 0) - { - $name .= $thousands . $thousandnamefrench; - } - else - { - $name .= $thousands . $thousandthnamefrench; - } - } - - if ($num >= 100) - { - if ($_[0] >= 1000) { $name .= " "; } - - local($hundreds) = ''; - - if ($num >= 200) - { - $hundreds = &get_numberstringfrench($num/100,$gender).' '; - } - - $num = $num%100; - - if ($num > 0) - { - $name .= $hundreds . $hundrednamefrench; - } - else - { - $name .= $hundreds . $hundredthnamefrench; - } - } - - if (($_[0] > 100) && ($_[0]%100 > 0)) { $name .= " "; } - - if ($num >= 20) - { - if ($frenchdialect eq 'france' and $num >= 70) - { - if ($num < 80) - { - if ($num%10 > 0) - { - $name .= $tenstringfrench[6]; - } - else - { - $name .= $tenthstringfrench[6]; - } - - if ($num%10 == 1) - { - $name .= ' et '; - } - else - { - $name .= '-'; - } - - $num = 10+($num%10); - } - else - { - $name .= 'quatre-vingt' . ($num==80?'i\`eme':'-'); - - if ($num >= 90) - { - $num = 10+($num%10); - } - } - } - elsif ($frenchdialect eq 'belgian' and $num >= 80) - { - $name .= 'quatre-vingt' . ($num==80?'i\`eme':'-'); - - if ($num >= 90) - { - $num = 10+($num%10); - } - } - else - { - if ($num%10 > 0) - { - $name .= $tenstringfrench[$num/10]; - } - else - { - $name .= $tenthstringfrench[$num/10]; - } - - if ($num%10 == 1) { $name .= ' et ';} - elsif ($num%10 > 0) { $name .= '-'; } - } - } - - if (($num >= 10) && ($num < 20)) - { - $name .= $teenthstringfrench[$num%10]; - } - elsif ($_[0] == 1) - { - $name = 'premi\`ere'; - } - elsif (($num%10 > 0) || ($_[0] == 0)) - { - $name .= $unitthstringfrench[$num%10]; - } - } - - $name; -} - -sub get_ordinalstringspanish{ - local($num,$gender) = @_; - local($name)=""; - local($str); - - unless (($num >= 1000000) || ($num < 0)) - { - if ($num >= 1000) - { - if ($num >= 2000) - { - local($thousands) = &get_ordinalstringspanish($num/1000); - - if ($gender eq 'f') - { - $thousands =~s/o(s?)$/a\1/; - } - - $name .= $thousands. " "; - } - else - { - $name = ""; - } - - $name .= "$thousandthnamespanish"; - - if ($gender eq 'f') - { - $name =~s/o$/a/; - } - - $num = $num%1000; - } - - if ($num >= 100) - { - if ($_[0] >= 1000) { $name .= " "; } - - local($hundreds) = $hundredthstringspanish[$num/100]; - - if ($gender eq 'f') - { - $hundreds =~s/o$/a/; - } - - $name .= $hundreds; - - $num = $num%100; - } - - if (($_[0] > 100) && ($_[0]%100 > 0)) { $name .= " "; } - - local($lastbit)=""; - - if ($num >= 20) - { - $lastbit = $tenthstringspanish[$num/10]; - - if ($num%10 > 0) - { - $lastbit .= ' '; - } - - if ($gender eq 'f') - { - $lastbit =~s/o([ s]*)$/a\1/; - } - - $name .= $lastbit; - - $lastbit = ""; - } - - if (($num >= 10) && ($num < 20)) - { - $lastbit = $teenthstringspanish[$num%10]; - } - elsif (($num%10 > 0) || ($_[0] == 0)) - { - $lastbit = $unitthstringspanish[$num%10]; - } - - if ($gender eq 'f') - { - $lastbit =~s/o([ s]*)$/a\1/; - } - - $name .= $lastbit; - } - - $name; -} - -sub get_ordinalstringportuges{ - local($num,$gender) = @_; - local($name)=""; - local($str); - - unless (($num >= 1000000) || ($num < 0)) - { - if ($num >= 1000) - { - if ($num >= 2000) - { - local($thousands) = &get_ordinalstringportuges($num/1000); - - if ($gender eq 'f') - { - $thousands =~s/o(s?)$/a\1/; - } - - $name .= $thousands. " "; - } - else - { - $name = ""; - } - - $name .= "$thousandthnameportuges"; - - if ($gender eq 'f') - { - $name =~s/o$/a/; - } - - $num = $num%1000; - } - - if ($num >= 100) - { - if ($_[0] >= 1000) { $name .= " "; } - - local($hundreds) = $hundredthstringportuges[$num/100]; - - if ($gender eq 'f') - { - $hundreds =~s/o$/a/; - } - - $name .= $hundreds; - - $num = $num%100; - } - - if (($_[0] > 100) && ($_[0]%100 > 0)) { $name .= "-"; } - - local($lastbit)=""; - - if ($num >= 10) - { - $lastbit = $tenthstringportuges[$num/10]; - - if ($num%10 > 0) - { - $lastbit .= '-'; - } - - if ($gender eq 'f') - { - $lastbit =~s/o([ s]*)$/a\1/; - } - - $name .= $lastbit; - - $lastbit = ""; - } - - if (($num%10 > 0) || ($_[0] == 0)) - { - $lastbit = $unitthstringportuges[$num%10]; - } - - if ($gender eq 'f') - { - $lastbit =~s/o([ s]*)$/a\1/; - } - - $name .= $lastbit; - } - - $name; -} - -sub get_numberunderhundredthgerman{ - local($num,$gender)=@_; - local($name)=''; - - if ($num < 10) - { - if ($gender eq 'F') - { - $name = $unitthstringFgerman[$num]; - } - elsif ($gender eq 'N') - { - $name = $unitthstringNgerman[$num]; - } - else - { - $name = $unitthstringMgerman[$num]; - } - } - elsif ($num%10 == 0) - { - if ($gender eq 'F') - { - $name = $tenthstringFgerman[$num/10]; - } - elsif ($gender eq 'N') - { - $name = $tenthstringNgerman[$num/10]; - } - else - { - $name = $tenthstringMgerman[$num/10]; - } - } - else - { - local($tenth); - if ($gender eq 'F') - { - $tenth = $tenthstringFgerman[$num/10]; - } - elsif ($gender eq 'N') - { - $tenth = $tenthstringNgerman[$num/10]; - } - else - { - $tenth = $tenthstringMgerman[$num/10]; - } - - $name = join('und', $unitstringgerman[$num%10], $tenth); - } - - $name; -} - -sub get_ordinalstringgerman{ - local($orgnum,$gender) = @_; - local($name)=""; - local($suffix)=''; - - $gender = uc($gender); - - if ($gender eq 'F') - { - $suffix = 'ste'; - } - elsif ($gender eq 'N') - { - $suffix = 'stes'; - } - else - { - $suffix = 'ster'; - $gender = 'M'; - } - - local($num) = $orgnum; - - unless (($num >= 1000000) || ($num < 0)) - { - if ($num >= 1000 and $num < 2000) - { - $name = &translate_commands("\\eintausend "); - } - elsif ($num >= 2000) - { - $name = &get_numberunderhundredgerman($num/1000) - . "tausend"; - } - - $num = $orgnum%1000; - - # is that it or is there more? - if ($orgnum >= 1000 and $num == 0) - { - $name .= $suffix; - return $name; - } - - if ($num >= 100 and $num < 200) - { - if ($orgnum > 1000) - { - $name .= "einhundert"; - } - else - { - $name = &translate_commands("\\einhundert "); - } - } - elsif ($num >= 200) - { - $name .= $unitstringgerman[$num/100]."hundert"; - } - - $num = $num%100; - - # is that it or is there more? - if ($orgnum >= 100 and $num == 0) - { - $name .= $suffix; - return $name; - } - - if ($orgnum == 0) - { - if ($gender eq 'F') - { - $name = $unitthstringFgerman[0]; - } - elsif ($gender eq 'N') - { - $name = $unitthstringNgerman[0]; - } - else - { - $name = $unitthstringMgerman[0]; - } - } - elsif ($num > 0) - { - $name .= &get_numberunderhundredthgerman($num,$gender); - } - } - - $name; -} - -sub get_ordinalstring{ - local($val,$gender) = @_; - - if ($default_language eq 'french') - { - &get_ordinalstringfrench($val,$gender); - } - elsif ($default_language eq 'spanish') - { - &get_ordinalstringspanish($val,$gender); - } - elsif ($default_language eq 'portuges') - { - &get_ordinalstringportuges($val,$gender); - } - elsif ($default_language eq 'german' - or $default_language eq 'ngerman') - { - &get_ordinalstringgerman($val,$gender); - } - else - { - &get_ordinalstringenglish($val); - } -} - -sub do_cmd_ordinalstringnum{ - local($_) = @_; - local($num,$gender); - $num = &missing_braces - unless (s/$next_pair_pr_rx/$num=$2;''/eo); - - if (s/\[(m|f|n)\]//) - { - $gender = $1; - } - else - { - $gender = 'm'; - } - - join('', &get_ordinalstring($num,$gender), $_); -} - -sub do_cmd_ordinalstring{ - local($ctr, $val, $id, $_) = &read_counter_value($_[0]); - my($gender)='m'; - - $_[0] =~ s/${OP}$id${CP}$ctr${OP}$id${CP}//; - - if ($_[0]=~s/\[(.)\]//) - { - $gender = $1; - } - - if ($ctr eq 'DAY' or $ctr eq 'MONTH' or $ctr eq 'YEAR') - { - # this is a cludge to make it work with newdateformat - join('', '{ORDINALSTRING{', $ctr, '}}', $_); - } - else - { - join('', &get_ordinalstring($val, $gender), $_); - } -} - - %fmtcntvar = (); - -sub do_cmd_FMCuse{ - local($_) = @_; - local($key); - - $key = &missing_braces - unless ((s/$next_pair_pr_rx//o)&&($key=$2)); - - $fmtcntvar{$key}.$_; -} - -sub do_cmd_storeordinalstring{ - local($_) = @_; - local($key); - - $key = &missing_braces - unless ((s/$next_pair_pr_rx//o)&&($key=$2)); - - local($ctr, $val, $id, $_) = &read_counter_value($_); - my($gender)='m'; - - $_ =~ s/${OP}$id${CP}$ctr${OP}$id${CP}//; - - if ($_ =~s/\s*\[(.)\]//) - { - $gender = $1; - } - - if ($ctr eq 'DAY' or $ctr eq 'MONTH' or $ctr eq 'YEAR') - { - # this is a cludge to make it work with newdateformat - $fmtcntvar{$key} = join('', '{ORDINALSTRING{', $ctr, '}}'); - } - else - { - $fmtcntvar{$key} = join('', &get_ordinalstring($val, $gender)); - } - - $_; -} - -sub do_cmd_storeordinalstringnum{ - local($_) = @_; - local($key, $val); - - $key = &missing_braces - unless ((s/$next_pair_pr_rx//o)&&($key=$2)); - - $val = &missing_braces - unless (s/$next_pair_pr_rx/$val=$2;''/eo); - - my($gender)='m'; - - if ($_ =~s/\s*\[(.)\]//) - { - $gender = $1; - } - - $fmtcntvar{$key} = join('', &get_ordinalstring($val, $gender)); - - $_; -} - -sub get_Ordinalstring{ - local($val,$gender) = @_; - local($string) = &get_ordinalstring($val,$gender); - - if ($default_language=~m/german/) - { - $string =~ s/\b([a-z])([^\s\-]+)/\u\1\2/; - } - else - { - $string =~ s/\b([a-z])([^\s\-]+)/\u\1\2/g; - - if ($default_language eq 'french') - { - $string =~ s/ Et / et /g; - } - else - { - $string =~ s/ And / and /g; - } - } - - $string; -} - -sub do_cmd_Ordinalstringnum{ - local($_) = @_; - local($num,$gender); - $num = &missing_braces - unless (s/$next_pair_pr_rx/$num=$2;''/eo); - - if (s/\[(m|f|n)\]//) - { - $gender = $1; - } - else - { - $gender = 'm'; - } - - join('', &get_Ordinalstring($num,$gender), $_); -} - -sub do_cmd_Ordinalstring{ - local($ctr, $val, $id, $_) = &read_counter_value($_[0]); - my($gender)='m'; - - $_[0] =~ s/${OP}$id${CP}$ctr${OP}$id${CP}//; - - if ($_[0]=~s/\[(.)\]//) - { - $gender = $1; - } - - if ($ctr eq 'DAY' or $ctr eq 'MONTH' or $ctr eq 'YEAR') - { - # this is a cludge to make it work with newdateformat - join('', '{OORDINALSTRING{', $ctr, '}}', $_[0]); - } - else - { - join('', &get_Ordinalstring($val, $gender), $_[0]); - } -} - -sub do_cmd_storeOrdinalstring{ - local($_) = @_; - local($key); - - $key = &missing_braces - unless ((s/$next_pair_pr_rx//o)&&($key=$2)); - - local($ctr, $val, $id, $_) = &read_counter_value($_); - my($gender)='m'; - - $_ =~ s/${OP}$id${CP}$ctr${OP}$id${CP}//; - - if ($_ =~s/\s*\[(.)\]//) - { - $gender = $1; - } - - if ($ctr eq 'DAY' or $ctr eq 'MONTH' or $ctr eq 'YEAR') - { - # this is a cludge to make it work with newdateformat - $fmtcntvar{$key} = join('', '{OORDINALSTRING{', $ctr, '}}'); - } - else - { - $fmtcntvar{$key} = join('', &get_Ordinalstring($val, $gender)); - } - - $_; -} - -sub do_cmd_storeOrdinalstringnum{ - local($_) = @_; - local($key, $val); - - $key = &missing_braces - unless ((s/$next_pair_pr_rx//o)&&($key=$2)); - - $val = &missing_braces - unless (s/$next_pair_pr_rx/$val=$2;''/eo); - - my($gender)='m'; - - if ($_ =~s/\s*\[(.)\]//) - { - $gender = $1; - } - - $fmtcntvar{$key} = join('', &get_Ordinalstring($val, $gender)); - - $_; -} - -sub do_cmd_ORDINALstringnum{ - local($_) = @_; - local($num,$gender); - $num = &missing_braces - unless (s/$next_pair_pr_rx/$num=$2;''/eo); - - if (s/\[(m|f|n)\]//) - { - $gender = $1; - } - else - { - $gender = 'm'; - } - - join('', uc(&get_ordinalstring($num,$gender)), $_); -} - -sub do_cmd_ORDINALstring{ - local($ctr, $val, $id, $_) = &read_counter_value($_[0]); - my($gender)='m'; - - $_[0] =~ s/${OP}$id${CP}$ctr${OP}$id${CP}//; - - if ($_[0]=~s/\[(.)\]//) - { - $gender = $1; - } - - if ($ctr eq 'DAY' or $ctr eq 'MONTH' or $ctr eq 'YEAR') - { - # this is a cludge to make it work with newdateformat - join('', '{CAPORDINALSTRING{', $ctr, '}}', $_); - } - else - { - join('', uc(&get_ordinalstring($val, $gender)), $_); - } -} - -sub do_cmd_storeORDINALstring{ - local($_) = @_; - local($key); - - $key = &missing_braces - unless ((s/$next_pair_pr_rx//o)&&($key=$2)); - - local($ctr, $val, $id, $_) = &read_counter_value($_); - my($gender)='m'; - - $_ =~ s/${OP}$id${CP}$ctr${OP}$id${CP}//; - - if ($_ =~s/\s*\[(.)\]//) - { - $gender = $1; - } - - if ($ctr eq 'DAY' or $ctr eq 'MONTH' or $ctr eq 'YEAR') - { - # this is a cludge to make it work with newdateformat - $fmtcntvar{$key} = join('', '{CAPORDINALSTRING{', $ctr, '}}'); - } - else - { - $fmtcntvar{$key} = uc(&get_ordinalstring($val, $gender)); - } - - $_; -} - -sub do_cmd_storeORDINALstringnum{ - local($_) = @_; - local($key, $val); - - $key = &missing_braces - unless ((s/$next_pair_pr_rx//o)&&($key=$2)); - - $val = &missing_braces - unless (s/$next_pair_pr_rx/$val=$2;''/eo); - - my($gender)='m'; - - if ($_ =~s/\s*\[(.)\]//) - { - $gender = $1; - } - - $fmtcntvar{$key} = uc(&get_ordinalstring($val, $gender)); - - $_; -} - -sub do_cmd_fmtcountsetoptions{ - local($_) = @_; - local($options) = &missing_braces unless ($_[0]=~(s/$next_pair_pr_rx//o)&&($options=$2)); - - if ($options =~ m/french=?(\w*)(,|$)/) - { - if ($1 eq 'france' or $1 eq 'swiss' or $1 eq 'belgian') - { - $frenchdialect = $1; - - print "Using French dialect: $1" if ($VERBOSITY > 0) ; - } - elsif ($1 eq '') - { - $frenchdialect = 'france'; - - print "Using French dialect: france" if ($VERBOSITY > 0); - } - else - { - &write_warnings("unknown french dialect '$1'"); - } - } - - if ($options =~ m/abbrv=?(\w*)(,|$)/) - { - if ($1 eq 'true' or $1 eq '') - { - $ordinalabbrv = 1; - - print "Setting abbrv=true" if ($VERBOSITY > 0); - } - elsif ($1 eq 'false') - { - $ordinalabbrv = 0; - - print "Setting abbrv=false" if ($VERBOSITY > 0); - } - else - { - &write_warnings("fmtcountsetoptions key abbrv: unknown value '$1'."); - } - } - - if ($options =~ m/fmtord=(\w*)(,|$)/) - { - if ($1 eq 'raise') - { - &do_fmtcount_raise(); - - print "Using raised ordinals" if ($VERBOSITY > 0); - } - elsif ($1 eq 'level') - { - &do_fmtcount_level(); - - print "Using level ordinals" if ($VERBOSITY > 0); - } - elsif ($1 eq 'user') - { - # do nothing - - print "Using user defined fmtord" if ($VERBOSITY > 0); - } - else - { - &write_warnings("unknown fmtcount option fmtord=$1"); - } - } - - $_[0]; -} - -$padzeroes = 0; - -sub do_cmd_padzeroes{ - local($_) = @_; - local($val,$pat) = &get_next_optional_argument; - - if ($val eq '') - { - $padzeroes = 17; - } - else - { - $padzeroes = $val; - } - - $_; -} - -sub get_binary{ - local($num) = @_; - local($val) = ""; - - for (my $i=17; $i>=0; $i--) - { - if (($i < $padzeroes) || ($num & (1 << $i)) || !($val eq "")) - { - $val .= ($num & (1 << $i) ? 1 : 0); - } - } - - $val; -} - -sub do_cmd_binary{ - local($ctr, $val, $id, $_) = &read_counter_value($_[0]); - - join('', &get_binary($val), $_); -} - -sub do_cmd_binarynum{ - local($_) = @_; - local($num) = &missing_braces - unless (s/$next_pair_pr_rx/$num=$2;''/eo); - - join('', &get_binary($num), $_); -} - -sub get_decimal{ - local($num) = @_; - - sprintf "%0${padzeroes}d", $num; -} - -sub do_cmd_decimal{ - local($ctr, $val, $id, $_) = &read_counter_value($_[0]); - - join('', &get_decimal($val), $_); -} - -sub do_cmd_decimalnum{ - local($_) = @_; - local($num) = &missing_braces - unless (s/$next_pair_pr_rx/$num=$2;''/eo); - - join('', &get_decimal($num), $_); -} - -sub get_hexadecimal{ - local($num) = @_; - - sprintf "%0${padzeroes}lx", $num; -} - -sub do_cmd_hexadecimal{ - local($ctr, $val, $id, $_) = &read_counter_value($_[0]); - - join('', &get_hexadecimal($val), $_); -} - -sub do_cmd_hexadecimalnum{ - local($_) = @_; - local($num) = &missing_braces - unless (s/$next_pair_pr_rx/$num=$2;''/eo); - - join('', &get_hexadecimal($num), $_); -} - -sub get_Hexadecimal{ - local($num) = @_; - - sprintf "%0${padzeroes}lX", $num; -} - -sub do_cmd_Hexadecimal{ - local($ctr, $val, $id, $_) = &read_counter_value($_[0]); - - join('', &get_Hexadecimal($val), $_); -} - -sub do_cmd_Hexadecimalnum{ - local($_) = @_; - local($num) = &missing_braces - unless (s/$next_pair_pr_rx/$num=$2;''/eo); - - join('', &get_Hexadecimal($num), $_); -} - -sub get_octal{ - local($num) = @_; - - sprintf "%0${padzeroes}lo", $num; -} - -sub do_cmd_octal{ - local($ctr, $val, $id, $_) = &read_counter_value($_[0]); - - join('', &get_octal($val), $_); -} - -sub do_cmd_octalnum{ - local($_) = @_; - local($num) = &missing_braces - unless (s/$next_pair_pr_rx/$num=$2;''/eo); - - join('', &get_octal($num), $_); -} - -sub get_aaalph{ - local($num) = @_; - local($rep) = int($num/26) + 1; - local($c) = chr(ord('a')-1+$num%26); - - local($_) = $c x $rep; -} - -sub do_cmd_aaalph{ - local($ctr, $val, $id, $_) = &read_counter_value($_[0]); - - join('', &get_aaalph($val), $_); -} - -sub get_AAAlph{ - local($num) = @_; - local($rep) = int($num/26) + 1; - local($c) = chr(ord('A')-1+$num%26); - - local($_) = $c x $rep; -} - -sub do_cmd_AAAlph{ - local($ctr, $val, $id, $_) = &read_counter_value($_[0]); - - join('', &get_AAAlph($val), $_); -} - -sub do_cmd_aaalphnum{ - local($_) = @_; - local($num) = &missing_braces - unless (s/$next_pair_pr_rx/$num=$2;''/eo); - - join('', (sprintf "%${padzeroes}s", &get_aaalph($num)), $_); -} - -sub do_cmd_AAAlphnum{ - local($_) = @_; - local($num) = &missing_braces - unless (s/$next_pair_pr_rx/$num=$2;''/eo); - - join('', uc(sprintf "%${padzeroes}s", &get_aaalph($num)), $_); -} - -sub get_abalph{ - local($num) = @_; - local($str); - - if ($num == 0) - { - $str = ''; - } - elsif ($num > 0 && $num <= 26) - { - $str = chr(ord('a')-1+$num); - } - else - { - $str = &get_abalph(int($num/26)) . chr(ord('a')-1+($num%26)); - } - - $str; -} - -sub do_cmd_abalph{ - local($ctr, $val, $id, $_) = &read_counter_value($_[0]); - - join('', (sprintf "%${padzeroes}s", &get_abalph($val)), $_); -} - -sub do_cmd_abalphnum{ - local($_) = @_; - local($num) = &missing_braces - unless (s/$next_pair_pr_rx/$num=$2;''/eo); - - join('', (sprintf "%${padzeroes}s", &get_abalph($num)), $_); -} - -sub do_cmd_ABAlph{ - local($ctr, $val, $id, $_) = &read_counter_value($_[0]); - - join('', uc(sprintf "%${padzeroes}s", &get_abalph($val)), $_); -} - -sub do_cmd_ABAlphnum{ - local($_) = @_; - local($num) = &missing_braces - unless (s/$next_pair_pr_rx/$num=$2;''/eo); - - join('', uc(sprintf "%${padzeroes}s", &get_abalph($num)), $_); -} - -sub get_twodigit{ - local($num) = @_; - - sprintf "%02d", $num; -} - -sub do_cmd_twodigit{ - local($_) = @_; - local($num) = &missing_braces - unless (s/$next_pair_pr_rx/$num=$2;''/eo); - - # this is a cludge - if ($num eq "THEDAY" or $num eq "THEYEAR" or $num eq "THEMONTH") - { - join('', 'TWODIGIT{', $num, '}', $_); - } - else - { - join('', &get_twodigit($num), $_); - } -} - -# this was put here to help with the definition of \datelatin - -sub do_cmd_romannumeral{ - local($_) = @_; - local($num) = &missing_braces - unless (s/$next_pair_pr_rx/$num=$2;''/eo); - - # this is a cludge - if ($num eq "THEDAY" or $num eq "THEYEAR" or $num eq "THEMONTH") - { - join('', 'ROMANNUMERAL{', $num, '}', $_); - } - else - { - join('', &froman($num), $_); - } -} - -# load configuration file if it exists -# Note: The configuration file should be loaded before -# the package options are executed. - -# why doesn't this work? If I call this subroutine it -# causes an infinite loop. - -sub load_fmtcount_cfg{ - local($file,$found); - - $file = &fulltexpath('fmtcount.cfg'); - - $found = (-f $file); - - if (!$found) - { - foreach $texpath (split /$envkey/, $TEXINPUTS) - { - $file = "$texpath${dd}fmtcount.cfg"; - - last if ($found = (-f $file)); - } - } - - if ($found) - { - print "\nusing configuration file $file\n"; - - &slurp_input($file); - &pre_process; - &substitute_meta_cmds if (%new_command || %new_environment); - &wrap_shorthand_environments; - $_ = &translate_commands(&translate_environments($_)); - - print "\n processed size: ".length($_)."\n" if ($VERBOSITY>1) - } - else - { - print "\nNo configuation file fmtcount.cfg found\n" if ($VERBOSITY>1) - } -} - -1; -- cgit v1.2.3