diff options
Diffstat (limited to 'Master/texmf-dist/tex/latex/fmtcount/fmtcount.sty')
-rw-r--r-- | Master/texmf-dist/tex/latex/fmtcount/fmtcount.sty | 154 |
1 files changed, 93 insertions, 61 deletions
diff --git a/Master/texmf-dist/tex/latex/fmtcount/fmtcount.sty b/Master/texmf-dist/tex/latex/fmtcount/fmtcount.sty index df80c35e55e..6d55bef08fc 100644 --- a/Master/texmf-dist/tex/latex/fmtcount/fmtcount.sty +++ b/Master/texmf-dist/tex/latex/fmtcount/fmtcount.sty @@ -7,7 +7,7 @@ %% fmtcount.dtx (with options: `fmtcount.sty,package') %% %% fmtcount.dtx -%% Copyright 2014 Nicola Talbot and Vincent Belaïche +%% Copyright 2015 Nicola Talbot and Vincent Belaïche %% %% This work may be distributed and/or modified under the %% conditions of the LaTeX Project Public License, either version 1.3 @@ -21,7 +21,7 @@ %% %% The Current Maintainer of this work is Nicola Talbot and Vincent Belaïche. %% -%% This work consists of the files fmtcount.dtx and fmtcount.ins and the derived files fcnumparser.sty, fcprefix.sty, fmtcount.sty, fc-american.def, fc-british.def, fc-english.def, fc-francais.def, fc-french.def, fc-frenchb.def, fc-german.def, fc-germanb.def, fc-italian.def, fc-ngerman.def, fc-ngermanb.def, fc-portuges.def, fc-portuguese.def, fc-spanish.def, fc-UKenglish.def, fc-USenglish.def. +%% This work consists of the files fmtcount.dtx and fmtcount.ins and the derived files fc-american.def, fc-british.def, fc-english.def, fc-francais.def, fc-french.def, fc-frenchb.def, fc-german.def, fc-germanb.def, fc-italian.def, fc-ngerman.def, fc-ngermanb.def, fc-portuges.def, fc-portuguese.def, fc-spanish.def, fc-UKenglish.def, fc-USenglish.def, fcnumparser.sty, fcprefix.sty, fmtcount.sty. %% %% \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 @@ -48,15 +48,25 @@ %%\begin{definition}[\DescribeMacro{\latinnumeralstringnum}] %%\cs{latinnumeralstringnum}\marg{number}\oarg{prefix options} %%\end{definition} +%% Local Variables: +%% coding: utf-8 +%% End: \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{fmtcount}[2014/07/18 v3.00] +\ProvidesPackage{fmtcount}[2015/05/05 v3.01] \RequirePackage{ifthen} -\RequirePackage{keyval} +\RequirePackage{xkeyval} \RequirePackage{etoolbox} \RequirePackage{fcprefix} \RequirePackage{ifxetex} \RequirePackage{amsgen} -\providecommand*{\fmtord}[1]{\textsuperscript{#1}} +\providecommand*{\fc@orddef@ult}[1]{\fc@textsuperscript{#1}} +\providecommand*{\fc@ord@multiling}[1]{% + \ifcsundef{fc@\languagename @alias@of}{% + \fc@orddef@ult{#1}}{% + \expandafter\let\expandafter\@tempa\csname fc@\languagename @alias@of\endcsname + \ifcsundef{fc@ord@\@tempa}{% + \fc@orddef@ult{#1}}{% +\csname fc@ord@\@tempa\endcsname{#1}}}} \newcount\c@padzeroesN \c@padzeroesN=1\relax \providecommand*{\padzeroes}[1][17]{\c@padzeroesN=#1} @@ -139,34 +149,72 @@ italian} \fi } \fc@iterate@on@languages\@fc@loadifbabelorpolyglossialdf -\def\fmtcount@french{france} -\define@key{fmtcount}{french}[france]{% - \@FC@iflangloaded{french}% - {% - \setkeys{fcfrench}{#1}% +\def\fc@iterate@on@languages@body#1{% + \expandafter\def\csname fc@#1@alias@of\endcsname{#1}} +\expandafter\@fc@iterate@on@languages\fc@supported@language@list,\@nil,% +\def\@tempa#1#2{% + \expandafter\def\csname fc@#1@alias@of\endcsname{#2}% +}% +\@tempa{frenchb}{french} +\@tempa{francais}{french} +\@tempa{germanb}{german} +\@tempa{ngermanb}{german} +\@tempa{ngerman}{german} +\@tempa{british}{english} +\@tempa{american}{USenglish} +\def\fc@iterate@on@languages@body#1{% + \define@key{fmtcount}{#1}[]{% + \@FC@iflangloaded{#1}% + {% + \setkeys{fc\csname fc@#1@alias@of\endcsname}{##1}% + }{% + \PackageError{fmtcount}% + {Language `#1' not defined}% + {You need to load \ifxetex polyglossia\else babel\fi\space before loading fmtcount}% + }% }% - {% - \PackageError{fmtcount}% - {Language `french' not defined}% - {You need to load babel before loading fmtcount}% + \ifthenelse{\equal{\csname fc@#1@alias@of\endcsname}{#1}}{% + \define@key{fc\csname fc@#1@alias@of\endcsname}{fmtord}{% + \ifthenelse{\equal{##1}{raise}\or\equal{##1}{level}}{% + \expandafter\let\expandafter\@tempa\csname fc@set@ord@as@##1\endcsname + \expandafter\@tempa\csname fc@ord@#1\endcsname + }{% + \ifthenelse{\equal{##1}{undefine}}{% + \expandafter\let\csname fc@ord@#1\endcsname\undefined + }{% + \PackageError{fmtcount}% + {Invalid value `##1' to fmtord key}% + {Option `fmtord' can only take the values `level', `raise' + or `undefine'}% + }} + }% + }{% + \expandafter\let\expandafter\@tempa\csname KV@\csname fc@#1@alias@of\endcsname @fmtord\endcsname + \expandafter\let\csname KV@#1@fmtord\endcsname\@tempa }% } +\expandafter\@fc@iterate@on@languages\fc@supported@language@list,\@nil,% +\def\fc@set@ord@as@level#1{% + \def#1##1{##1}% +} +\def\fc@set@ord@as@raise#1{% + \let#1\fc@textsuperscript +} \define@key{fmtcount}{fmtord}{% \ifthenelse{\equal{#1}{level} - \or\equal{#1}{raise} - \or\equal{#1}{user}}% + \or\equal{#1}{raise}}% {% + \csname fc@set@ord@as@#1\endcsname\fc@orddef@ult \def\fmtcount@fmtord{#1}% }% {% \PackageError{fmtcount}% {Invalid value `#1' to fmtord key}% - {Option `fmtord' can only take the values `level', `raise' - or `user'}% + {Option `fmtord' can only take the values `level' or `raise'}% }% } \newif\iffmtord@abbrv -\fmtord@abbrvfalse +\fmtord@abbrvtrue \define@key{fmtcount}{abbrv}[true]{% \ifthenelse{\equal{#1}{true}\or\equal{#1}{false}}% {% @@ -175,7 +223,7 @@ italian} {% \PackageError{fmtcount}% {Invalid value `#1' to fmtord key}% - {Option `fmtord' can only take the values `true' or + {Option `abbrv' can only take the values `true' or `false'}% }% } @@ -183,59 +231,38 @@ italian} \RequirePackage{fmtprefix}% \fmtprefixsetoption{#1}% } -\newcommand*{\fmtcountsetoptions}[1]{% +\def\fmtcountsetoptions{% \def\fmtcount@fmtord{}% - \setkeys{fmtcount}{#1}% - \@FC@iflangloaded{french}{\ifcsundef{@ordinalstringMfrench}% - {% - \edef\@ordinalstringMfrench{\noexpand - \csname @ordinalstringMfrench\fmtcount@french\noexpand\endcsname}% - \edef\@ordinalstringFfrench{\noexpand - \csname @ordinalstringFfrench\fmtcount@french\noexpand\endcsname}% - \edef\@OrdinalstringMfrench{\noexpand - \csname @OrdinalstringMfrench\fmtcount@french\noexpand\endcsname}% - \edef\@OrdinalstringFfrench{\noexpand - \csname @OrdinalstringFfrench\fmtcount@french\noexpand\endcsname}% - \edef\@numberstringMfrench{\noexpand - \csname @numberstringMfrench\fmtcount@french\noexpand\endcsname}% - \edef\@numberstringFfrench{\noexpand - \csname @numberstringFfrench\fmtcount@french\noexpand\endcsname}% - \edef\@NumberstringMfrench{\noexpand - \csname @NumberstringMfrench\fmtcount@french\noexpand\endcsname}% - \edef\@NumberstringFfrench{\noexpand - \csname @NumberstringFfrench\fmtcount@french\noexpand\endcsname}% - }{}}{}% - \ifthenelse{\equal{\fmtcount@fmtord}{level}}% - {% - \renewcommand{\fmtord}[1]{##1}% - }% - {% - \ifthenelse{\equal{\fmtcount@fmtord}{raise}}% - {% - \renewcommand{\fmtord}[1]{\textsuperscript{##1}}% - }% - {% - }% - } -} + \setkeys{fmtcount}}% \InputIfFileExists{fmtcount.cfg}% {% \PackageInfo{fmtcount}{Using configuration file fmtcount.cfg}% }% {% } +\newcommand*{\fmtcount@loaded@by@option@lang@list}{} \newcommand*\@fc@declare@language@option[1]{% \DeclareOption{#1}{% - \@FC@iflangloaded{#1}{}{% - \fmtcount@language@optiontrue - \FCloadlang{#1}% - }}}% + \ifx\fmtcount@loaded@by@option@lang@list\@empty + \def\fmtcount@loaded@by@option@lang@list{#1}% + \else + \edef\fmtcount@loaded@by@option@lang@list{\fmtcount@loaded@by@option@lang@list,#1}% + \fi + }}% \fc@iterate@on@languages\@fc@declare@language@option \DeclareOption{level}{\def\fmtcount@fmtord{level}% - \def\fmtord#1{#1}} + \def\fc@orddef@ult#1{#1}} \DeclareOption{raise}{\def\fmtcount@fmtord{raise}% - \def\fmtord#1{\textsuperscript{#1}}} + \def\fc@orddef@ult#1{\fc@textsuperscript{#1}}} \ProcessOptions\relax +\ifx\fmtcount@loaded@by@option@lang@list\@empty\else +\def\fc@iterate@on@languages@body#1{% + \@FC@iflangloaded{#1}{}{% + \fmtcount@language@optiontrue + \FCloadlang{#1}% + }} +\expandafter\@fc@iterate@on@languages\fmtcount@loaded@by@option@lang@list,\@nil,% +\fi \newcount\@DT@modctr \newcommand*{\@FCmodulo}[2]{% \@DT@modctr=#1\relax @@ -712,7 +739,7 @@ italian} \protect\@ordinalstringM{#2}{\@fc@ordstr}% }% }% - \expandafter\edef\csname @fcs@#1\endcsname{% + \expandafter\protected@edef\csname @fcs@#1\endcsname{% \noexpand\MakeUppercase{\@fc@ordstr}% }% } @@ -1004,6 +1031,7 @@ italian} \def\@ordinalM{\@ordinalMenglish}% \let\@ordinalF=\@ordinalM \let\@ordinalN=\@ordinalM + \let\fmtord\fc@orddef@ult } \newcommand*{\fc@multiling}[2]{% \ifcsundef{@#1#2\languagename}% @@ -1085,6 +1113,7 @@ italian} \def\@OrdinalstringN{% \fc@multiling{Ordinalstring}{N}% }% + \let\fmtord\fc@ord@multiling } \expandafter\@ifpackageloaded \expandafter{\ifxetex polyglossia\else babel\fi}% @@ -1125,6 +1154,9 @@ italian} \fi }% } +\AtBeginDocument{% + \ifcsundef{FBsupR}{\let\fc@textsuperscript\textsuperscript}{\let\fc@textsuperscript\fup}% +} \let\@ordinal=\@ordinalM \let\@ordinalstring=\@ordinalstringM \let\@Ordinalstring=\@OrdinalstringM |