diff options
author | Norbert Preining <preining@logic.at> | 2014-07-30 01:59:27 +0000 |
---|---|---|
committer | Norbert Preining <preining@logic.at> | 2014-07-30 01:59:27 +0000 |
commit | f084f6c5ea5c0e70e3db167a3696fe45e5babaef (patch) | |
tree | 17387bb4e2094f021df4a23623d157dfc6e331f8 /Master/texmf-dist/tex/latex/fmtcount/fmtcount.sty | |
parent | d2408bd93ba8e4b4fe01d3a9fb61155f87c89912 (diff) |
fmtcount (29Jul)
git-svn-id: svn://tug.org/texlive/trunk@34771 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/fmtcount/fmtcount.sty')
-rw-r--r-- | Master/texmf-dist/tex/latex/fmtcount/fmtcount.sty | 124 |
1 files changed, 95 insertions, 29 deletions
diff --git a/Master/texmf-dist/tex/latex/fmtcount/fmtcount.sty b/Master/texmf-dist/tex/latex/fmtcount/fmtcount.sty index 8c2ee534e9d..df80c35e55e 100644 --- a/Master/texmf-dist/tex/latex/fmtcount/fmtcount.sty +++ b/Master/texmf-dist/tex/latex/fmtcount/fmtcount.sty @@ -49,11 +49,12 @@ %%\cs{latinnumeralstringnum}\marg{number}\oarg{prefix options} %%\end{definition} \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{fmtcount}[2014/06/18 v2.04] +\ProvidesPackage{fmtcount}[2014/07/18 v3.00] \RequirePackage{ifthen} \RequirePackage{keyval} \RequirePackage{etoolbox} \RequirePackage{fcprefix} +\RequirePackage{ifxetex} \RequirePackage{amsgen} \providecommand*{\fmtord}[1]{\textsuperscript{#1}} \newcount\c@padzeroesN @@ -88,25 +89,56 @@ \newcommand*{\ProvidesFCLanguage}[1]{% \ProvidesFile{fc-#1.def}% } +\newif\iffmtcount@language@option +\fmtcount@language@optionfalse +\newcommand*\fc@supported@language@list{% +english,% +UKenglish,% +british,% +USenglish,% +american,% +spanish,% +portuges,% +french,% +frenchb,% +francais,% +german,% +germanb,% +ngerman,% +ngermanb,% +italian} +\newcommand*\fc@iterate@on@languages[1]{% + \ifx\fc@supported@language@list\@empty + \PackageError{fmtcount}{Macro `\protect\@fc@iterate@on@languages' is empty}{You should never get here: + Something is broken within \texttt{fmtcount}, please report the issue on + \texttt{https://github.com/search?q=fmtcount\&ref=cmdform\&type=Issues}}% + \else + \let\fc@iterate@on@languages@body#1 + \expandafter\@fc@iterate@on@languages\fc@supported@language@list,\@nil,% + \fi +} +\def\@fc@iterate@on@languages#1,{% + {% + \def\@tempa{#1}% + \ifx\@tempa\@nnil + \let\@tempa\@empty + \else + \def\@tempa{% + \fc@iterate@on@languages@body{#1}% + \@fc@iterate@on@languages + }% + \fi + \expandafter + }\@tempa +}% \newcommand*{\@fc@loadifbabelorpolyglossialdf}[1]{% - \ifcsundef{ver@#1.ldf}{}{\FCloadlang{#1}}% - \IfFileExists{gloss-#1.ldf}{\ifcsundef{#1@loaded}{}{\FCloadlang{#1}}}{}% -} -\@fc@loadifbabelorpolyglossialdf{english} -\@fc@loadifbabelorpolyglossialdf{UKenglish} -\@fc@loadifbabelorpolyglossialdf{british} -\@fc@loadifbabelorpolyglossialdf{USenglish} -\@fc@loadifbabelorpolyglossialdf{american} -\@fc@loadifbabelorpolyglossialdf{spanish} -\@fc@loadifbabelorpolyglossialdf{portuges} -\@fc@loadifbabelorpolyglossialdf{french} -\@fc@loadifbabelorpolyglossialdf{frenchb} -\@fc@loadifbabelorpolyglossialdf{francais} -\@fc@loadifbabelorpolyglossialdf{german}% -\@fc@loadifbabelorpolyglossialdf{germanb}% -\@fc@loadifbabelorpolyglossialdf{ngerman}% -\@fc@loadifbabelorpolyglossialdf{ngermanb}% -\@fc@loadifbabelorpolyglossialdf{italian} + \ifxetex + \IfFileExists{gloss-#1.ldf}{\ifcsundef{#1@loaded}{}{\FCloadlang{#1}}}{}% + \else + \ifcsundef{ver@#1.ldf}{}{\FCloadlang{#1}}% + \fi +} +\fc@iterate@on@languages\@fc@loadifbabelorpolyglossialdf \def\fmtcount@french{france} \define@key{fmtcount}{french}[france]{% \@FC@iflangloaded{french}% @@ -192,11 +224,18 @@ }% {% } +\newcommand*\@fc@declare@language@option[1]{% + \DeclareOption{#1}{% + \@FC@iflangloaded{#1}{}{% + \fmtcount@language@optiontrue + \FCloadlang{#1}% + }}}% +\fc@iterate@on@languages\@fc@declare@language@option \DeclareOption{level}{\def\fmtcount@fmtord{level}% \def\fmtord#1{#1}} \DeclareOption{raise}{\def\fmtcount@fmtord{raise}% \def\fmtord#1{\textsuperscript{#1}}} -\ProcessOptions +\ProcessOptions\relax \newcount\@DT@modctr \newcommand*{\@FCmodulo}[2]{% \@DT@modctr=#1\relax @@ -445,8 +484,8 @@ {\let\ordinal\FCordinal}% {% \PackageWarning{fmtcount}% - {\string\ordinal \space already defined use - \string\FCordinal \space instead.} + {\protect\ordinal \space already defined use + \protect\FCordinal \space instead.} } \newcommand*{\ordinalnum}[1]{% \new@ifnextchar[% @@ -536,8 +575,8 @@ {}% {% \PackageError{fmtcount}% - {Invalid gender option `#2' to \string\ordinalstring}% - {Available options are m, f or f}% + {Invalid gender option `#2' to \protect\ordinalstring}% + {Available options are m, f or n}% }% \protect\@ordinalstringM{#1}{\@fc@ordstr}% }% @@ -569,7 +608,7 @@ {}% {% \PackageError{fmtcount}% - {Invalid gender option `#3' to \string\ordinalstring}% + {Invalid gender option `#3' to \protect\ordinalstring}% {Available options are m, f or n}% }% \protect\@ordinalstringM{#2}{\@fc@ordstr}% @@ -976,7 +1015,7 @@ \ifcsundef{@#1#2\languagename}% {% \PackageWarning{fmtcount}% - {No support for \expandafter\string\csname#1\endcsname\space for + {No support for \expandafter\protect\csname #1\endcsname\space for language '\languagename'}% \ifthenelse{\equal{\languagename}{\fc@mainlang}}% {% @@ -1047,7 +1086,8 @@ \fc@multiling{Ordinalstring}{N}% }% } -\@ifpackageloaded{babel}% +\expandafter\@ifpackageloaded +\expandafter{\ifxetex polyglossia\else babel\fi}% {% \@set@mulitling@fmtcount }% @@ -1058,7 +1098,31 @@ \@set@mulitling@fmtcount }% {% - \@setdef@ultfmtcount + \iffmtcount@language@option + \@set@mulitling@fmtcount + \AtBeginDocument{% + \ifcsundef{languagename}% + {% + \PackageWarning{fmtcount}{% + `\protect\languagename' is undefined, you should use package babel/polyglossia when loading a + language via package option. Reverting to default language. + }% + \@setdef@ultfmtcount + }{% + \@FC@iflangloaded{\languagename}{}{% + \PackageWarning{fmtcount}{% + Setting `\protect\languagename' to `\fc@mainlang'.\MessageBreak + Reason is that `\protect\languagename' was `\languagename',\MessageBreak + but `\languagename' was not loaded by fmtcount,\MessageBreak + whereas `\fc@mainlang' was the last language loaded by fmtcount ; + }% + \let\languagename\fc@mainlang + } + }% + } + \else + \@setdef@ultfmtcount + \fi }% } \let\@ordinal=\@ordinalM @@ -1066,7 +1130,9 @@ \let\@Ordinalstring=\@OrdinalstringM \let\@numberstring=\@numberstringM \let\@Numberstring=\@NumberstringM - +\iffalse Local variables: \fi +\iffalse mode: docTeX \fi +\iffalse End: \fi \endinput %% %% End of file `fmtcount.sty'. |