6

How can I get fmtcount to work when babel is loaded with the Australian option?

Consider the following code which doesn't compile, due to babel australian not being supported:

\documentclass{minimal}

\usepackage[australian]{babel}
\usepackage{fmtcount}

\begin{document}
    \numberstringnum{100}   

\end{document}
lockstep
  • 250,273

2 Answers2

6

If you load fmtcount before babel (or don't load babel at all), fmtcount will fall back to english language strings.

\documentclass{article}

\usepackage{fmtcount}
\usepackage[australian]{babel}

\begin{document}

The current language: \languagename

\numberstringnum{100}   

\end{document}

enter image description here

EDIT: Here's my file list produced by adding \listfiles to the MWE (I'm using TeXLive 2012 with babel updated to v3.9c):

 *File List*
 article.cls    2007/10/19 v1.4h Standard LaTeX document class
  size10.clo    2007/10/19 v1.4h Standard LaTeX file (size option)
fmtcount.sty    2012/10/24 v2.02
  ifthen.sty    2001/05/26 v1.1c Standard LaTeX ifthen package (DPC)
  keyval.sty    1999/03/16 v1.13 key=value parser (DPC)
etoolbox.sty    2011/01/03 v2.1 e-TeX tools for LaTeX
    etex.sty    1998/03/26 v2.0 eTeX basic definition package (PEB)
fcprefix.sty    2012/09/28
fcnumparser.sty    2012/09/28
  amsgen.sty    1999/11/30 v2.0
fc-english.def    2012/06/18
   babel.sty    2013/04/08 v3.9c The Babel package
 english.ldf    2005/03/30 v3.3o English support from the babel system
 ***********
lockstep
  • 250,273
  • Thanks, I actuall tried that before, it still throws error: Missing number, treated as zero \adddialect\l@australian\l@british – Nicholas Hamilton Jun 20 '13 at 10:28
  • @ADP Does my MWE work for you? If yes, there must be something else going on, and you should update your question with a new example. – lockstep Jun 20 '13 at 10:30
  • The document gets produced, however, the error gets thrown as per my previous comment. Copied and pasted from your MWE. Tried to build using lualatex and pdflatex. – Nicholas Hamilton Jun 20 '13 at 10:32
  • @ADP Works for me with pdflatex. Did you delete all auxiliary files? – lockstep Jun 20 '13 at 10:33
  • Yes, no change. – Nicholas Hamilton Jun 20 '13 at 10:37
  • Your MWE works with my MiKTeX 2.9 (babel v3.8m for some reason) when using pdfLaTeX or XeLaTeX. LuaLaTeX gives me: ! LuaTeX error ...6)/MiKTeX/2.9/tex/luatex/hyph-utf8/luatex-hyphen.lua:53: luatex-hyphen: no entry in language.dat.lua for this language: australian – doncherry Jun 20 '13 at 11:57
  • TeX Live 2012’s LuaLaTeX gives me four errors "! LuaTeX error <\directlua >:1: assertion failed!", while pdfLaTeX and XeLaTeX work just like on MiKTeX. Looks like it’s something LuaLaTeX-specific, potentially a bug there? – doncherry Jun 20 '13 at 12:01
6

Create this file and name it fc-australian.def. Put it in the same directory as your test file for experimenting with it; if the tests are successful, move it in some place where TeX looks for input.

% File name: fc-australian.def
% This file has been obtained by modifying
% fc-british.def in the fmtcount bundle
\ProvidesFCLanguage{australian}[2013/06/20]
\FCloadlang{australian}
\let\@ordinalMaustralian\@ordinalMenglish
\let\@ordinalFaustralian\@ordinalMenglish
\let\@ordinalNaustralian\@ordinalMenglish
\let\@numberstringMaustralian\@numberstringMenglish
\let\@numberstringFaustralian\@numberstringMenglish
\let\@numberstringNaustralian\@numberstringMenglish
\let\@NumberstringMaustralian\@NumberstringMenglish
\let\@NumberstringFaustralian\@NumberstringMenglish
\let\@NumberstringNaustralian\@NumberstringMenglish
\let\@ordinalstringMaustralian\@ordinalstringMenglish
\let\@ordinalstringFaustralian\@ordinalstringMenglish
\let\@ordinalstringNaustralian\@ordinalstringMenglish
\let\@OrdinalstringMaustralian\@OrdinalstringMenglish
\let\@OrdinalstringFaustralian\@OrdinalstringMenglish
\let\@OrdinalstringNaustralian\@OrdinalstringMenglish
\endinput
%%
%% End of file `fc-australian.def'.

Now the example file

\documentclass{article}

\usepackage[australian]{babel}
\usepackage{fmtcount}

\begin{document}
    \numberstringnum{100}

\end{document}

runs.

Note This will give errors with LuaLaTeX on TeX Live 2013, but it's not related to fmtcount. The problem is probably related to the recent changes in babel management. It should be reported to the people in charge. It disappears if I modify the entry in language.dat.lua for ukenglish with the addition of the synonym australian.

    ['ukenglish'] = {
            loader = 'loadhyph-en-gb.tex',
            lefthyphenmin = 2,
            righthyphenmin = 3,
            synonyms = { 'british', 'UKenglish', 'australian' },
            patterns = 'hyph-en-gb.pat.txt',
            hyphenation = 'hyph-en-gb.hyp.txt',
    },
egreg
  • 1,121,712
  • Thanks. This works for me. Czech language. I had issue with using package bibleref with czech babel. fc-czech.def file helped. – LiborStefek Jan 28 '21 at 17:45