I'm working on a Swedish language file to fmtcount
and, to support some of fmtcount
's commands (e.g. \Numberstring
and NUMBERstring
), I need to make strings containing the Swedish characters å
, ä
and ö
uppercase. This seems unproblematic with XeTeX
and LuaTeX
, but not so much in pdfTeX
.
The macro level
A full version of what I want to do that involves as little of my LaTeX fumbling as possible would be the example below. As my own language file is based on the German language file (fc-german.def
), I here make a minimal change to that file to highlight the problem, which leads to the compilation with pdfTeX
simply not finishing. Without my change the document reads "Acht" and with my change I had hoped that it would read "Åtta".
\documentclass[german]{article}
% \usepackage[T1]{fontenc}
\usepackage{babel}
\usepackage{fmtcount}
\FCloadlang{german}
\makeatletter
% Redefine code from fc-german.def
\renewcommand*\@@unitstringgerman[1]{%
\ifcase#1%
null%
\or ein%
\or zwei%
\or drei%
\or vier%
\or f\"unf%
\or sechs%
\or sieben%
\or åtta% Changed from "acht" to "åtta"
\or neun%
\fi
}%
\global\let\@@unitstringgerman\@@unitstringgerman
\makeatother
\begin{document}
\newcounter{mycounter}
\setcounter{mycounter}{8} \themycounter\ \Numberstring{mycounter}\\
\end{document}
- If I uncomment
\usepackage[T1]{fontenc}
, then the compilation still does not finish. - If I write
{\aa}tta
instead ofåtta
, then the compilation crashes. - If I write
{\aa}tta
instead ofåtta
and uncomment\usepackage[T1]{fontenc}
, then the compilation again does not finish.
My fumbling attempt to approach the micro level
I think that this example has the same problem as the macro level one. It at least sure behaves the same way. (It is probably very related to my last question.)
\documentclass{article}
% \usepackage[T1]{fontenc}
\makeatletter
\newcommand*\@@unitstringgerman[1]{%
\ifcase#1%
null%
\or ein%
\or zwei%
\or drei%
\or vier%
\or f\"unf%
\or sechs%
\or sieben%
\or åtta% Changed from "acht" to "åtta"
\or neun%
\fi
}%
\usepackage{etoolbox}
\newcommand*{\zz}{% Supposed to make the first letter of `\@@unitstringgerman{8}` (i.e. "åtta") uppercase
\def\one{}%
\def\two{}%
\eappto\two{\@@unitstringgerman{8}}%
\edef\one{\noexpand\MakeUppercase\expandonce\two}%
\one%
}
\makeatother
\begin{document}
\zz
\end{document}
- If I uncomment
\usepackage[T1]{fontenc}
, then the compilation still does not finish. - If I write
{\aa}tta
instead ofåtta
, then the compilation crashes. - If I write
{\aa}tta
instead ofåtta
and uncomment\usepackage[T1]{fontenc}
, then the compilation again does not finish.