summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/fmtcount
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2017-12-28 23:44:51 +0000
committerKarl Berry <karl@freefriends.org>2017-12-28 23:44:51 +0000
commit06185309fb0f91e4619d8fb10a81d445ac221b67 (patch)
treee3c681134efae2523747c403f55da5e0f24e1482 /Master/texmf-dist/source/latex/fmtcount
parentefb05e5b6b2687f9611f7a7bc5bf381c1a7c538f (diff)
fmtcount (28dec17)
git-svn-id: svn://tug.org/texlive/trunk@46159 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/fmtcount')
-rw-r--r--Master/texmf-dist/source/latex/fmtcount/fmtcount.dtx388
-rw-r--r--Master/texmf-dist/source/latex/fmtcount/fmtcount.ins6
2 files changed, 302 insertions, 92 deletions
diff --git a/Master/texmf-dist/source/latex/fmtcount/fmtcount.dtx b/Master/texmf-dist/source/latex/fmtcount/fmtcount.dtx
index 68456a33e5c..20d2f751954 100644
--- a/Master/texmf-dist/source/latex/fmtcount/fmtcount.dtx
+++ b/Master/texmf-dist/source/latex/fmtcount/fmtcount.dtx
@@ -1,11 +1,11 @@
%\iffalse
% fmtcount.dtx generated using makedtx version 1.2 (c) Nicola Talbot
% Command line args:
+% -author "Nicola Talbot and Vincent Belaïche"
% -doc "fmtcount-manual.tex"
% -src "(.+)\.(sty|def)$=>\1.\2"
-% -author "Nicola Talbot and Vincent Belaïche"
% fmtcount
-% Created on 2017/9/17 22:04
+% Created on 2017/12/26 22:09
%\fi
%\iffalse
%<*package>
@@ -77,7 +77,7 @@
pdftitle={fmtcount.sty: Displaying the Values of LaTeX Counters},
pdfkeywords={LaTeX,counter}]{hyperref}
-\CheckSum{10120}
+\CheckSum{10334}
\doxitem{Option}{option}{options}
@@ -104,7 +104,7 @@
% \url{www.dickimaw-books.com}
% \and
% Vincent Bela\"iche}
-% \date{2017-09-16 (version 3.04)\relax
+% \date{2017-12-26 (version 3.05)\relax
%}
% \maketitle
% \tableofcontents
@@ -490,25 +490,33 @@
%Italian support was added in version 1.31.\footnote{Thanks to
%Edoardo Pasca for supplying the information.}
%
+%Actually, \sty{fmtcount} has two modes:
+%\begin{itemize}
+%\item a multilingual mode, in which the commands \cs{numberstring}, \cs{ordinalstring}, \cs{ordinal}, and
+% their variants will be formatted in the currently selected language, as per the \cs{languagename} macro set
+% by \sty{babel}, \sty{polyglossia} or suchlikes, and
+%\item a default mode for backward compatibility in which these commands are formatted in English irrespective
+% of \cs{languagename}, and to which \sty{fmtcount} falls back when it cannot detects packages such as
+% \sty{babel} or \sty{polyglossia} are loaded.
+%\end{itemize}
%
-%To ensure the language definitions are loaded correctly for document
-%dialects, use
+%For multilingual mode, \sty{fmtcount} needs to load correctly the language definition for document dialects. To
+%do this use
%\begin{definition}[\DescribeMacro{\FCloadlang}]
%\cs{FCloadlang}\marg{dialect}
%\end{definition}
-%in the preamble. The \meta{dialect} should match the options passed to \sty{babel} or
-%\sty{polyglossia}. \sty{fmtcount} currently supports the following \meta{dialect}:
-%\LanguagePackageOptionList. If you don't use this,
-%\sty{fmtcount} will attempt to detect the required dialects, but
-%this isn't guaranteed to work.
+%in the preamble --- this will both switch on multilingual mode, and load the \meta{dialect} definition. The
+%\meta{dialect} should match the options passed to \sty{babel} or \sty{polyglossia}. \sty{fmtcount} currently
+%supports the following \meta{dialect}'s: \LanguagePackageOptionList.
%
-%The commands
-%\cs{ordinal}, \cs{ordinalstring} and \cs{numberstring} (and their
-%variants) will be formatted in the currently selected language.
-%If the current language hasn't been loaded (via \cs{FCloadlang}
-%above) and \sty{fmtcount} detects a definition file for that
-%language it will attempt to load it, but this isn't robust and may
-%cause problems, so it's best to use \cs{FCloadlang}.
+%If you don't use \cs{FCloadlang}, \sty{fmtcount} will attempt to detect the required dialects and call
+%\cs{FCloadlang} for you, but this isn't guaranteed to work. Notably, when \cs{FCloadlang} is not used and
+%\sty{fmtcount} has switched on multilingual mode, but without detecting the needed dialects in the preamble,
+%and \sty{fmtcount} has to format a number for a dialect for which definition has not been loaded (via
+%\cs{FCloadlang} above), then if \sty{fmtcount} detects a definition file for this dialect it will attempt to
+%load it, and cause an error otherwise. This loading in body has not been tested extensively, and may may cause
+%problems such as spurious spaces insertion before the first formatted number, so it's best to use
+%\cs{FCloadlang} explicitely in the preamble.
%
%If the French language is selected, the \texttt{french} option let you
%configure the dialect and other aspects. The \texttt{abbr} also has
@@ -935,6 +943,152 @@
%\fi
%\iffalse
% \begin{macrocode}
+%<*fc-brazilian.def>
+% \end{macrocode}
+%\fi
+% \subsubsection{fc-brazilian.def}
+% Brazilian definitions.
+% \begin{macrocode}
+\ProvidesFCLanguage{brazilian}[2017/12/26]%
+% \end{macrocode}
+% Load \sty{fc-portuges.def} if not already loaded.
+% \begin{macrocode}
+\FCloadlang{portuges}%
+% \end{macrocode}
+% Set |brazilian| to be equivalent to |portuges| for all the numeral ordinals, and string ordinals.
+% \begin{macrocode}
+\global\let\@ordinalMbrazilian=\@ordinalMportuges
+\global\let\@ordinalFbrazilian=\@ordinalFportuges
+\global\let\@ordinalNbrazilian=\@ordinalNportuges
+\global\let\@ordinalstringFbrazilian\@ordinalstringFportuges
+\global\let\@ordinalstringMbrazilian\@ordinalstringMportuges
+\global\let\@ordinalstringNbrazilian\@ordinalstringMportuges
+\global\let\@OrdinalstringMbrazilian\@OrdinalstringMportuges
+\global\let\@OrdinalstringFbrazilian\@OrdinalstringFportuges
+\global\let\@OrdinalstringNbrazilian\@OrdinalstringMportuges
+% \end{macrocode}
+% Convert a number to a textual representation. To make it easier, split it up into units, tens, teens and
+% hundreds. Units, tens, and hundreds are the same as for |portuges| and are not redefined, only the teens are
+% Brazilian specific.\\
+% Teens (argument must be a number from 0 to 9):
+% \begin{macrocode}
+\newcommand*\@@teenstringbrazilian[1]{%
+ \ifcase#1\relax
+ dez%
+ \or onze%
+ \or doze%
+ \or treze%
+ \or quatorze%
+ \or quinze%
+ \or dezesseis%
+ \or dezessete%
+ \or dezoito%
+ \or dezenove%
+ \fi
+}%
+\global\let\@@teenstringbrazilian\@@teenstringbrazilian
+% \end{macrocode}
+% Teens (with initial letter in upper case):
+% \begin{macrocode}
+\newcommand*\@@Teenstringbrazilian[1]{%
+ \ifcase#1\relax
+ Dez%
+ \or Onze%
+ \or Doze%
+ \or Treze%
+ \or Quatorze%
+ \or Quinze%
+ \or Dezesseis%
+ \or Dezessete%
+ \or Dezoito%
+ \or Dezenove%
+ \fi
+}%
+\global\let\@@Teenstringbrazilian\@@Teenstringbrazilian
+% \end{macrocode}
+% This has changed in version 1.08, so that it now stores
+% the result in the second argument, but doesn't display
+% anything. Since it only affects internal macros, it shouldn't
+% affect documents created with older versions. (These internal
+% macros are not meant for use in documents.)
+% \changes{3.02}{2016/01/12}{Replace \cs{DeclareRobustCommand} by
+% \cs{newcommand*} as robustness is handled now at top level in
+% \texttt{fmtcount.sty}, and we don't need \cs{long} macros. Concerned macros
+% are \cs{@numberstringMbrazilian}, \cs{@numberstringFbrazilian},
+% \cs{@NumberstringMbrazilian}, \cs{@NumberstringFbrazilian},
+% \cs{@ordinalstringMbrazilian}, \cs{@ordinalstringFbrazilian},
+% \cs{@OrdinalstringMbrazilian}, and \cs{@OrdinalstringFbrazilian}.}
+% \changes{3.03}{2017/07/21}{Fix bug
+% \#\href{https://github.com/nlct/fmtcount/issues/25}{25}.}
+% \begin{macrocode}
+\newcommand*{\@numberstringMbrazilian}[2]{%
+ \let\@unitstring=\@@unitstringportuges
+ \let\@teenstring=\@@teenstringbrazilian
+ \let\@tenstring=\@@tenstringportuges
+ \let\@hundredstring=\@@hundredstringportuges
+ \def\@hundred{cem}\def\@thousand{mil}%
+ \def\@andname{e}%
+ \@@numberstringportuges{#1}{#2}%
+}%
+\global\let\@numberstringMbrazilian\@numberstringMbrazilian
+% \end{macrocode}
+% As above, but feminine form:
+% \begin{macrocode}
+\newcommand*{\@numberstringFbrazilian}[2]{%
+ \let\@unitstring=\@@unitstringFportuges
+ \let\@teenstring=\@@teenstringbrazilian
+ \let\@tenstring=\@@tenstringportuges
+ \let\@hundredstring=\@@hundredstringFportuges
+ \def\@hundred{cem}\def\@thousand{mil}%
+ \def\@andname{e}%
+ \@@numberstringportuges{#1}{#2}%
+}%
+\global\let\@numberstringFbrazilian\@numberstringFbrazilian
+% \end{macrocode}
+% Make neuter same as masculine:
+% \begin{macrocode}
+\global\let\@numberstringNbrazilian\@numberstringMbrazilian
+% \end{macrocode}
+% As above, but initial letters in upper case:
+% \begin{macrocode}
+\newcommand*{\@NumberstringMbrazilian}[2]{%
+ \let\@unitstring=\@@unitstringportuges
+ \let\@teenstring=\@@Teenstringbrazilian
+ \let\@tenstring=\@@Tenstringportuges
+ \let\@hundredstring=\@@hundredstringportuges
+ \def\@hundred{Cem}\def\@thousand{Mil}%
+ \def\@andname{e}%
+ \@@numberstringportuges{#1}{#2}%
+}%
+\global\let\@NumberstringMbrazilian\@NumberstringMbrazilian
+% \end{macrocode}
+% As above, but feminine form:
+% \begin{macrocode}
+\newcommand*{\@NumberstringFbrazilian}[2]{%
+ \let\@unitstring=\@@UnitstringFportuges
+ \let\@teenstring=\@@Teenstringbrazilian
+ \let\@tenstring=\@@Tenstringportuges
+ \let\@hundredstring=\@@HundredstringFportuges
+ \def\@hundred{Cem}\def\@thousand{Mil}%
+ \def\@andname{e}%
+ \@@numberstringportuges{#1}{#2}%
+}%
+\global\let\@NumberstringFbrazilian\@NumberstringFbrazilian
+% \end{macrocode}
+% Make neuter same as masculine:
+% \begin{macrocode}
+\global\let\@NumberstringNbrazilian\@NumberstringMbrazilian
+% \end{macrocode}
+\iffalse Local variables: \fi
+\iffalse mode: docTeX \fi
+\iffalse End: \fi
+%\iffalse
+% \begin{macrocode}
+%</fc-brazilian.def>
+% \end{macrocode}
+%\fi
+%\iffalse
+% \begin{macrocode}
%<*fc-british.def>
% \end{macrocode}
%\fi
@@ -4172,9 +4326,9 @@ z\'ero%
% \end{macrocode}
%\fi
% \subsubsection{fc-portuges.def}
-% Portuguse definitions
+% Portuguese definitions
% \begin{macrocode}
-\ProvidesFCLanguage{portuges}[2016/01/12]%
+\ProvidesFCLanguage{portuges}[2017/12/26]%
% \end{macrocode}
% Define macro that converts a number or count register (first
% argument) to an ordinal, and stores the result in the second
@@ -4264,6 +4418,8 @@ z\'ero%
\global\let\@@tenstringportuges\@@tenstringportuges
% \end{macrocode}
% Teens (argument must be a number from 0 to 9):
+% \changes{3.05}{2017/12/26}{Take fix of teen contributed by \href{https://github.com/sant0s}{sant0s}, prior
+% definitions pushed to \sty{fc-brazilian.def}.}
% \begin{macrocode}
\newcommand*\@@teenstringportuges[1]{%
\ifcase#1\relax
@@ -4271,12 +4427,12 @@ z\'ero%
\or onze%
\or doze%
\or treze%
- \or quatorze%
+ \or catorze%
\or quinze%
- \or dezesseis%
- \or dezessete%
+ \or dezasseis%
+ \or dezassete%
\or dezoito%
- \or dezenove%
+ \or dezanove%
\fi
}%
\global\let\@@teenstringportuges\@@teenstringportuges
@@ -4370,6 +4526,8 @@ z\'ero%
\global\let\@@Tenstringportuges\@@Tenstringportuges
% \end{macrocode}
% Teens (with initial letter in upper case):
+% \changes{3.05}{2017/12/26}{Take fix of teen contributed by \href{https://github.com/sant0s}{sant0s}, prior
+% definitions pushed to \sty{fc-brazilian.def}.}
% \begin{macrocode}
\newcommand*\@@Teenstringportuges[1]{%
\ifcase#1\relax
@@ -4377,12 +4535,12 @@ z\'ero%
\or Onze%
\or Doze%
\or Treze%
- \or Quatorze%
+ \or Catorze%
\or Quinze%
- \or Dezesseis%
- \or Dezessete%
+ \or Dezasseis%
+ \or Dezassete%
\or Dezoito%
- \or Dezenove%
+ \or Dezanove%
\fi
}%
\global\let\@@Teenstringportuges\@@Teenstringportuges
@@ -4997,7 +5155,7 @@ this number}%
% \begin{macrocode}
\ProvidesFCLanguage{portuguese}[2014/06/09]%
% \end{macrocode}
-% Load fc-portuges.def if not already loaded
+% Load \sty{fc-portuges.def} if not already loaded.
% \begin{macrocode}
\FCloadlang{portuges}%
% \end{macrocode}
@@ -7262,7 +7420,7 @@ this number}%
% This section deals with the code for |fmtcount.sty|
% \begin{macrocode}
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{fmtcount}[2017/09/16 v3.04]
+\ProvidesPackage{fmtcount}[2017/12/24 v3.05]
\RequirePackage{ifthen}
% \end{macrocode}
% \changes{3.01}{2014/12/03}{Use \styfmt{xkeyval} instead of \styfmt{keyval}, so that we do not get in trouble
@@ -7273,11 +7431,9 @@ this number}%
\RequirePackage{fcprefix}
% \end{macrocode}
% \changes{3.00}{2014/07/3}{Add \cs{RequirePackage} for \texttt{ifxetex}}
-% \begin{macrocode}
-\RequirePackage{ifxetex}
-% \end{macrocode}
-% \changes{1.3}{2007/7/19}{no
-%longer using xspace package}
+% \changes{3.05}{2017/12/24}{Stop using \cs{ifxetex} to trigger multilingual mode. Instead only packages are
+% tested for being loaded.}
+% \changes{1.3}{2007/7/19}{no longer using xspace package}
%\changes{1.31}{2009/10/02}{amsgen now loaded (\cs{new@ifnextchar}
% needed)}
% Need to use \cs{new@ifnextchar} instead of \cs{@ifnextchar} in
@@ -7419,15 +7575,18 @@ this number}%
% be some corner cases when a package would be required --- as a result of loading language definition for
% one language --- between a \cs{DeclareOption} and a \cs{ProcessOption} which is forbidden by \LaTeXe.
%\changes{3.00}{2014/07/3}{new}
+%\changes{3.05}{2017/12/26}{Add brazilian and portuguese.}
% \begin{macrocode}
\newcommand*\fc@supported@language@list{%
english,%
UKenglish,%
+brazilian,%
british,%
USenglish,%
american,%
spanish,%
portuges,%
+portuguese,%
french,%
frenchb,%
francais,%
@@ -7493,16 +7652,20 @@ italian}
%
%\changes{2.03}{2012/11/03}{renamed \cs{@fc@loadifbabelldf} to
% \cs{@fc@loadifbabelorpolyglossialdf}}
-%\changes{2.03}{2012/11/03}{added check for polyglossia language}
-%\changes{3.00}{2014/07/03}{use \cs{ifxetex} to discriminate between \styfmt{babel} and \styfmt{polyglossia}}
-% \begin{macrocode}
-\newcommand*{\@fc@loadifbabelorpolyglossialdf}[1]{%
- \ifxetex
- \IfFileExists{gloss-#1.ldf}{\ifcsundef{#1@loaded}{}{\FCloadlang{#1}}}{}%
- \else
- \ifcsundef{ver@#1.ldf}{}{\FCloadlang{#1}}%
- \fi
-}
+%\changes{2.03}{2012/11/03}{added check for polyglossia language.}
+%\changes{3.00}{2014/07/03}{use \cs{ifxetex} to discriminate between \styfmt{babel} and \styfmt{polyglossia}.}
+%\changes{3.05}{2017/12/24}{Stop using \cs{ifxetex} to discriminate between \styfmt{babel} and
+% \styfmt{polyglossia}, instead just test which package is loaded.}
+% \begin{macrocode}
+\newcommand*\@fc@loadifbabelldf[1]{\ifcsundef{ver@#1.ldf}{}{\FCloadlang{#1}}}
+\newcommand*{\@fc@loadifbabelorpolyglossialdf}[1]{}
+\@ifpackageloaded{polyglossia}{%
+ \def\@fc@loadifbabelorpolyglossialdf#1{\IfFileExists{gloss-#1.ldf}{\ifcsundef{#1@loaded}{}{\FCloadlang{#1}}}{}%
+ \@fc@loadifbabelldf{#1}%
+ }%
+}{\@ifpackageloaded{babel}{%
+ \let\@fc@loadifbabelorpolyglossialdf\@fc@loadifbabelldf
+}{}}
% \end{macrocode}
%\end{macro}
%
@@ -7568,7 +7731,7 @@ italian}
}%
}{%
% \end{macrocode}
-% When the language \#1 is an alias, do the same as the language of which it is an alias:
+% When the language \texttt{\#1} is an alias, do the same as the language of which it is an alias:
% \begin{macrocode}
\expandafter\let\expandafter\@tempa\csname KV@\csname fc@#1@alias@of\endcsname @fmtord\endcsname
\expandafter\let\csname KV@#1@fmtord\endcsname\@tempa
@@ -9050,13 +9213,22 @@ italian}
%\end{macro}
%
%\subsubsection{Multilinguage Definitions}
+% Flag \cs{fc@languagemode@detected} allows to stop scanning for multilingual mode trigger conditions. It is
+% initialized to \texttt{false} as no such scanning as taken place yet.
+%\changes{3.05}{2017/12/22}{New flag \cs{iffc@languagemode@detected}.}
+% \begin{macrocode}
+\newif\iffc@languagemode@detected
+\fc@languagemode@detectedfalse
+% \end{macrocode}
%\begin{macro}{\@setdef@ultfmtcount}
% If multilingual support is provided, make \cs{@numberstring}
% etc use the correct language (if defined).
% Otherwise use English definitions. \cs{@setdef@ultfmtcount}
% sets the macros to use English.
+%\changes{3.05}{2017/12/22}{Set flag \cs{iffc@languagemode@detected}.}
% \begin{macrocode}
\def\@setdef@ultfmtcount{%
+ \fc@languagemode@detectedtrue
\ifcsundef{@ordinalMenglish}{\FCloadlang{english}}{}%
\def\@ordinalstringM{\@ordinalstringMenglish}%
\let\@ordinalstringF=\@ordinalstringMenglish
@@ -9125,8 +9297,10 @@ italian}
% \cs{languagename}:
%\changes{2.0}{2012/06/03}{changed errors to warnings for
%unsupported languages}
+%\changes{3.05}{2017/12/22}{Set flag \cs{iffc@languagemode@detected}.}
% \begin{macrocode}
\def\@set@mulitling@fmtcount{%
+ \fc@languagemode@detectedtrue
% \end{macrocode}
% The masculine version of \cs{numberstring}:
% \begin{macrocode}
@@ -9225,59 +9399,93 @@ italian}
}
% \end{macrocode}
%\end{macro}
-% Check to see if \styfmt{babel}, \styfmt{polyglossia} or \styfmt{ngerman} packages have been loaded, and if
-% yes set \styfmt{fmtcount} in multiling.
+%\changes{3.05}{2017/12/22}{Change all the code about detecting multiling. \cs{ifxetex} is no longer used,
+% instead we loop on the list of packages of interest \styfmt{babel}, \styfmt{polyglossia}, \styfmt{mlp}, or
+% \styfmt{ngerman}, and set or not \cs{iffc@languagemode@detected} flag as a result.}
+% Check to see if \styfmt{babel}, \styfmt{polyglossia}, \styfmt{mlp}, or \styfmt{ngerman} packages have been
+% loaded, and if yes set \styfmt{fmtcount} in multiling. First we define some \cs{fc@check@for@multiling}
+% macro to do such action where \texttt{\#1} is the package name, and \texttt{\#2} is a callback.
+% \begin{macrocode}
+\def\fc@check@for@multiling#1:#2\@nil{%
+ \@ifpackageloaded{#1}{%
+ #2\@set@mulitling@fmtcount
+ }{}%
+}
+% \end{macrocode}
+% Now we define \cs{fc@loop@on@multiling@pkg} as an iterator to scan whether any of \styfmt{babel},
+% \styfmt{polyglossia}, \styfmt{mlp}, or \styfmt{ngerman} packages has been loaded, and if so set multilingual
+% mode.
% \begin{macrocode}
-\expandafter\@ifpackageloaded
-\expandafter{\ifxetex polyglossia\else babel\fi}%
-{%
- \@set@mulitling@fmtcount
-}%
-{%
- \@ifpackageloaded{ngerman}%
- {%
- \FCloadlang{ngerman}%
- \@set@mulitling@fmtcount
- }%
- {%
+\def\fc@loop@on@multiling@pkg#1,{%
+ \def\@tempb{#1}%
+ \ifx\@tempb\@nnil
+% \end{macrocode}
+% We have reached the end of the loop, so stop here.
+% \begin{macrocode}
+ \let\fc@loop@on@multiling@pkg\@empty
+ \else
% \end{macrocode}
-% In the case that neither babel/polyglossia, nor ngerman has been loaded, then we go to multiling if a
-% language has been loaded by package option, and to delfault language otherwise.
+% Make the \cs{@ifpackageloaded} test and break the loop if it was positive.
% \begin{macrocode}
- \iffmtcount@language@option
+ \fc@check@for@multiling#1\@nil
+ \iffc@languagemode@detected
+ \def\fc@loop@on@multiling@pkg##1\@nil,{}%
+ \fi
+ \fi
+ \fc@loop@on@multiling@pkg
+}
+% \end{macrocode}
+% Now, do the loop itself, we do this at beginning of document not to constrain the order of loading
+% \styfmt{fmtcount} and the multilingual package \styfmt{babel}, \styfmt{polyglossia}, etc.:
+% \begin{macrocode}
+\AtBeginDocument{%
+ \fc@loop@on@multiling@pkg babel:,polyglossia:,ngerman:\FCloadlang{ngerman},\@nil,
+% \end{macrocode}
+% In the case that no multilingual package (such as
+% \styfmt{babel}/\styfmt{polyglossia}/\styfmt{ngerman}) has been loaded, then we go to multiling
+% if a language has been loaded by package option.
+% \begin{macrocode}
+ \unless\iffc@languagemode@detected\iffmtcount@language@option
+% \end{macrocode}
+% If the multilingual mode has not been yet activated, but a language option has been passed to
+% \styfmt{fmtcount}, we should go to multilingual mode. However, first of, we do some sanity check, as this
+% may help the end user understand what is wrong: we check that macro \cs{languagename} is defined, and
+% activate the multilingual mode only then, and otherwise fall back to default legacy mode.
+% \begin{macrocode}
+ \ifcsundef{languagename}%
+ {%
+ \PackageWarning{fmtcount}{%
+ `\protect\languagename' is undefined, you should use a language package such as babel/polyglossia
+ when loading a language via package option. Reverting to default language.
+ }%
+ \@setdef@ultfmtcount
+ }{%
\@set@mulitling@fmtcount
+
+% \end{macrocode}
+% Now, some more checking, having activated multilingual mode after a language option has been passed to
+% \styfmt{fmtcount}, we check that the \styfmt{fmtcount} language definitions corresponding to
+% \cs{languagename} have been loaded, and otherwise fall \cs{languagename} back to the latest
+% \styfmt{fmtcount} language definition loaded.
+% \begin{macrocode}
+ \@FC@iflangloaded{\languagename}{}{%
% \end{macrocode}
-% Some sanity check at the beginning of document may help the end user understand what is wrong:
+% The current \cs{languagename} is not a \styfmt{fmtcount} language that has been previously loaded. The
+% correction is to have \cs{languagename} let to \cs{fc@mainlang}. Please note that, as
+% \cs{iffmtcount@language@option} is true, we know that \texttt{fmtcount} has loaded some language.
% \begin{macrocode}
- \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.
+ 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 ;
}%
- \@setdef@ultfmtcount
- }{%
- \@FC@iflangloaded{\languagename}{}{%
-% \end{macrocode}
-% The current \cs{languagename} is not a language that has been previously loaded. The correction is to have
-% \cs{languagename} let to \cs{fc@mainlang}. Please note that, as \cs{iffmtcount@language@option} is true,
-% we know that \texttt{fmtcount} has loaded some language.
-% \begin{macrocode}
- \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
+ \let\languagename\fc@mainlang
+ }%
+ }%
+ \else
\@setdef@ultfmtcount
- \fi
- }%
+ \fi\fi
}
% \end{macrocode}
% \changes{3.01}{2014/12/03}{Substitute \cs{textsuperscript} for \cs{fc@textsuperscript}, and define
diff --git a/Master/texmf-dist/source/latex/fmtcount/fmtcount.ins b/Master/texmf-dist/source/latex/fmtcount/fmtcount.ins
index 34bd064a9be..0c6535c3e7e 100644
--- a/Master/texmf-dist/source/latex/fmtcount/fmtcount.ins
+++ b/Master/texmf-dist/source/latex/fmtcount/fmtcount.ins
@@ -1,4 +1,4 @@
-% fmtcount.ins generated using makedtx version 1.2 2017/9/17 22:04
+% fmtcount.ins generated using makedtx version 1.2 2017/12/26 22:09
\input docstrip
\preamble
@@ -18,7 +18,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 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.
+ This work consists of the files fmtcount.dtx and fmtcount.ins and the derived files fc-american.def, fc-brazilian.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.
\endpreamble
@@ -26,6 +26,8 @@
\generate{\file{fc-american.def}{\usepreamble\defaultpreamble
\usepostamble\defaultpostamble\from{fmtcount.dtx}{fc-american.def,package}}
+\file{fc-brazilian.def}{\usepreamble\defaultpreamble
+\usepostamble\defaultpostamble\from{fmtcount.dtx}{fc-brazilian.def,package}}
\file{fc-british.def}{\usepreamble\defaultpreamble
\usepostamble\defaultpostamble\from{fmtcount.dtx}{fc-british.def,package}}
\file{fc-english.def}{\usepreamble\defaultpreamble