diff options
author | Karl Berry <karl@freefriends.org> | 2007-10-02 18:31:22 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2007-10-02 18:31:22 +0000 |
commit | 9c9e1d5e6434f13aa45ae9a0e546c4f77f052c38 (patch) | |
tree | 72750febaf565cfa47d24285ccf28964728c7b4a /Master/texmf-dist/tex/latex/ordinalpt | |
parent | 812e6404069fec7fc8b4b6a7677e0e8480b08c56 (diff) |
ordinalpt update (8feb07)
git-svn-id: svn://tug.org/texlive/trunk@5097 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/ordinalpt')
-rw-r--r-- | Master/texmf-dist/tex/latex/ordinalpt/ordinalpt.sty | 259 |
1 files changed, 143 insertions, 116 deletions
diff --git a/Master/texmf-dist/tex/latex/ordinalpt/ordinalpt.sty b/Master/texmf-dist/tex/latex/ordinalpt/ordinalpt.sty index 84f52970370..5aef30328e4 100644 --- a/Master/texmf-dist/tex/latex/ordinalpt/ordinalpt.sty +++ b/Master/texmf-dist/tex/latex/ordinalpt/ordinalpt.sty @@ -19,10 +19,23 @@ %% but WITHOUT ANY WARRANTY; without even the implied warranty of %% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. %% -%% \CheckSum{260} +%% \CheckSum{242} \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{ordinalpt}[2007/01/11 v1.0 Ordinal numbers in Portuguese] -\RequirePackage{ifthen} +\ProvidesPackage{ordinalpt}[2007/02/08 v2.1 Ordinal numbers in Portuguese] +\newif\if@ordpt@twelveshort +\newif\if@ordpt@thirteenshort +\@ordpt@twelveshorttrue +\@ordpt@thirteenshortfalse +\DeclareOption{11-12-curtos}{% + \@ordpt@twelveshorttrue + \@ordpt@thirteenshortfalse} +\DeclareOption{11-13-curtos}{% + \@ordpt@twelveshorttrue + \@ordpt@thirteenshorttrue} +\DeclareOption{11-13-longos}{% + \@ordpt@twelveshortfalse + \@ordpt@thirteenshortfalse} +\ExecuteOptions{11-12-curtos} \DeclareOption{tricentesimo}{\def\@ordpt@tricent{i}} \DeclareOption{trecentesimo}{\def\@ordpt@tricent{e}} \ExecuteOptions{tricentesimo} @@ -33,122 +46,136 @@ \DeclareOption{nongentesimo}{\def\@ordpt@noningent{}} \ExecuteOptions{noningentesimo} \ProcessOptions -\newboolean{@ordpt@putspace} -\newcounter{@ordpt@counter} -\newcounter{@ordpt@alg} -\newcommand{\@ordpt@case}{} -\newcommand{\@ordpt@masc}{o} -\newcommand{\@ordpt@fem}{a} -\newcommand{\@ordpt@ul}{o} -\newcommand{\@ordpt@capitalize}[1]{\MakeUppercase#1} -\newcommand{\@ordpt@ordunits}[1]{% - \ifcase#1\or - \@ordpt@case{primeir\@ordpt@ul}\or - \@ordpt@case{segund\@ordpt@ul}\or - \@ordpt@case{terceir\@ordpt@ul}\or - \@ordpt@case{quart\@ordpt@ul}\or - \@ordpt@case{quint\@ordpt@ul}\or - \@ordpt@case{sext\@ordpt@ul}\or - \@ordpt@case{s\'etim\@ordpt@ul}\or - \@ordpt@case{oitav\@ordpt@ul}\or - \@ordpt@case{non\@ordpt@ul}% +\newcommand{\@ordpt@lowercase}[2]{#1#2} +\newcommand{\@ordpt@capitalize}[2]{\uppercase{#1}#2} +\newcommand{\@ordpt@uppercase}[2]{\uppercase{#1#2}} +\newcommand{\@ordpt@printunits}[3]{% + \ifcase#3 \or + #1{p}{rimeir#2}\or + #1{s}{egund#2}\or + #1{t}{erceir#2}\or + #1{q}{uart#2}\or + #1{q}{uint#2}\or + #1{s}{ext#2}\or + #1{s}{\'etim#2}\or + #1{o}{itav#2}\or + #1{n}{on#2}% \fi} -\newcommand{\@ordpt@ordtens}[1]{% - \ifcase#1\or - \@ordpt@case{d\'ecim\@ordpt@ul}\or - \@ordpt@case{vig\'esim\@ordpt@ul}\or - \@ordpt@case{trig\'esim\@ordpt@ul}\or - \@ordpt@case{quadrag\'esim\@ordpt@ul}\or - \@ordpt@case{quinquag\'esim\@ordpt@ul}\or - \@ordpt@case{sexag\'esim\@ordpt@ul}\or - \@ordpt@case{septuag\'esim\@ordpt@ul}\or - \@ordpt@case{octog\'esim\@ordpt@ul}\or - \@ordpt@case{nonag\'esim\@ordpt@ul}% +\newcommand{\@ordpt@printtens}[4]{% + \ifx#31% + \ifx#41% + \if@ordpt@twelveshort + #1{u}{nd\'ecim#2}% + \else + #1{d}{\'ecim#2}\space#1{p}{rimeir#2}% + \fi + \else + \ifx#42% + \if@ordpt@twelveshort + #1{d}{uod\'ecim#2}% + \else + #1{d}{\'ecim#2}\space#1{s}{egund#2}%% + \fi + \else + \ifx#43% + \if@ordpt@thirteenshort + #1{t}{red\'ecim#2}% + \else + #1{d}{\'ecim#2}\space#1{t}{erceir#2}%% + \fi + \else + #1{d}{\'ecim#2}% + \ifx#40% + \else + \space\@ordpt@printunits#1#2#4% + \fi + \fi + \fi + \fi + \else + \ifcase#3 \or\or + #1{v}{ig\'esim#2}\or + #1{t}{rig\'esim#2}\or + #1{q}{uadrag\'esim#2}\or + #1{q}{uinquag\'esim#2}\or + #1{s}{exag\'esim#2}\or + #1{s}{eptuag\'esim#2}\or + #1{o}{ctog\'esim#2}\or + #1{n}{onag\'esim#2}% + \fi + \ifx#40% + \else + \space\@ordpt@printunits#1#2#4% + \fi \fi} -\newcommand{\@ordpt@ordcents}[1]{% - \ifcase#1\or - \@ordpt@case{cent\'esim\@ordpt@ul}\or - \@ordpt@case{ducent\'esim\@ordpt@ul}\or - \@ordpt@case{tr\@ordpt@tricent cent\'esim\@ordpt@ul}\or - \@ordpt@case{quadringent\'esim\@ordpt@ul}\or - \@ordpt@case{quingent\'esim\@ordpt@ul}\or - \@ordpt@case{se\@ordpt@sexcent cent\'esim\@ordpt@ul}\or - \@ordpt@case{septingent\'esim\@ordpt@ul}\or - \@ordpt@case{octingent\'esim\@ordpt@ul}\or - \@ordpt@case{non\@ordpt@noningent gent\'esim\@ordpt@ul}% +\newcommand{\@ordpt@printhundreds}[5]{% + \ifcase#3 \or + #1{c}{ent\'esim#2}\or + #1{d}{ucent\'esim#2}\or + #1{t}{r\@ordpt@tricent cent\'esim#2}\or + #1{q}{uadringent\'esim#2}\or + #1{q}{uingent\'esim#2}\or + #1{s}{e\@ordpt@sexcent cent\'esim#2}\or + #1{s}{eptingent\'esim#2}\or + #1{o}{ctingent\'esim#2}\or + #1{n}{on\@ordpt@noningent gent\'esim#2}% + \fi + \ifx#40% + \ifx#50% + \else + \space\@ordpt@printunits#1#2#5% + \fi + \else + \space\@ordpt@printtens#1#2#4#5% \fi} -\newcommand{\@ordpt@ordinal}[1]{% - \ifthenelse{\value{#1}>0\and\value{#1}<2000} - {% - \setcounter{@ordpt@counter}{\value{#1}}% - \ifthenelse{\value{@ordpt@counter}>999} - {% - \@ordpt@case{mil\'esim\@ordpt@ul}% - \setboolean{@ordpt@putspace}{true}% - \addtocounter{@ordpt@counter}{-1000}% - } - {% - \setboolean{@ordpt@putspace}{false}% - }% - \setcounter{@ordpt@alg}{0}% - \whiledo{\value{@ordpt@counter}>99} - {% - \stepcounter{@ordpt@alg}% - \addtocounter{@ordpt@counter}{-100}% - }% - \ifthenelse{\value{@ordpt@alg}>0} - {% - \ifthenelse{\boolean{@ordpt@putspace}}{\space}{}% - \@ordpt@ordcents{\value{@ordpt@alg}}% - \setboolean{@ordpt@putspace}{true}% - } - {}% - \setcounter{@ordpt@alg}{0}% - \whiledo{\value{@ordpt@counter}>9} - {% - \stepcounter{@ordpt@alg}% - \addtocounter{@ordpt@counter}{-10}% - }% - \ifthenelse{\value{@ordpt@alg}>0} - {% - \ifthenelse{\boolean{@ordpt@putspace}}{\space}{}% - \@ordpt@ordtens{\value{@ordpt@alg}}% - \setboolean{@ordpt@putspace}{true}% - } - {}% - \ifthenelse{\value{@ordpt@counter}>0} - {% - \ifthenelse{\boolean{@ordpt@putspace}}{\space}{}% - \@ordpt@ordunits{\value{@ordpt@counter}}% - } - {}% - } - {\@ctrerr}% -} -\newcommand{\ordptmasc}[1]{% - \let\@ordpt@case\@firstofone - \let\@ordpt@ul\@ordpt@masc - \@ordpt@ordinal{#1}} -\newcommand{\Ordptmasc}[1]{% - \let\@ordpt@case\@ordpt@capitalize - \let\@ordpt@ul\@ordpt@masc - \@ordpt@ordinal{#1}} -\newcommand{\ORDPTMASC}[1]{% - \let\@ordpt@case\MakeUppercase - \let\@ordpt@ul\@ordpt@masc - \@ordpt@ordinal{#1}} -\newcommand{\ordptfem}[1]{% - \let\@ordpt@case\@firstofone - \let\@ordpt@ul\@ordpt@fem - \@ordpt@ordinal{#1}} -\newcommand{\Ordptfem}[1]{% - \let\@ordpt@case\@ordpt@capitalize - \let\@ordpt@ul\@ordpt@fem - \@ordpt@ordinal{#1}} -\newcommand{\ORDPTFEM}[1]{% - \let\@ordpt@case\MakeUppercase - \let\@ordpt@ul\@ordpt@fem - \@ordpt@ordinal{#1}} +\newcommand{\@ordpt@printthousands}[6]{% + \ifcase#3 \or + #1{m}{il\'esim#2}% + \fi + \ifx#40% + \ifx#50% + \ifx#60% + \else + \space\@ordpt@printunits#1#2#6% + \fi + \else + \space\@ordpt@printtens#1#2#5#6% + \fi + \else + \space\@ordpt@printhundreds#1#2#4#5#6 + \fi} +\newcommand{\@ordpt@print}{} +\def\@ordpt@print#1#2#3#4#5#6#7!{% + \ifx#4?% + \@ordpt@printunits#1#2#3% + \else + \ifx#5?% + \@ordpt@printtens#1#2#3#4% + \else + \ifx#6?% + \@ordpt@printhundreds#1#2#3#4#5% + \else + \@ordpt@printthousands#1#2#3#4#5#6% + \fi + \fi + \fi} +\newcommand{\@ordpt@ordinal}[3]{% + \ifnum\csname c@#3\endcsname<1 + \@ctrerr + \else + \ifnum\csname c@#3\endcsname>1999 + \@ctrerr + \else + \expandafter\@ordpt@print + \expandafter#1\expandafter#2\the\csname c@#3\endcsname????!% + \fi + \fi} +\newcommand{\ordptmasc}[1]{\@ordpt@ordinal\@ordpt@lowercase o{#1}} +\newcommand{\Ordptmasc}[1]{\@ordpt@ordinal\@ordpt@capitalize o{#1}} +\newcommand{\ORDPTMASC}[1]{\@ordpt@ordinal\@ordpt@uppercase o{#1}} +\newcommand{\ordptfem}[1]{\@ordpt@ordinal\@ordpt@lowercase a{#1}} +\newcommand{\Ordptfem}[1]{\@ordpt@ordinal\@ordpt@capitalize a{#1}} +\newcommand{\ORDPTFEM}[1]{\@ordpt@ordinal\@ordpt@uppercase a{#1}} \endinput %% %% End of file `ordinalpt.sty'. |