6

I'm trying to move to a modern LaTeX setup, by using LuaLaTex, polyglossia, glossaries + xindy.

When I create a German document with a glossary, the title of the glossary correctly changes to "Glossar", the German translation of glossary.

If I add \usepackage{siunitx} to load siunitx, translation will break - the title of the glossary will change back to "Glossary". Example (compile with lualatex + makeglossaries + lualatex):

\documentclass{article}

\usepackage{fontspec}
\usepackage{polyglossia}
\setdefaultlanguage{german}

\usepackage{siunitx}

\usepackage[xindy]{glossaries}
\makeglossaries

\newglossaryentry{a}{name = ä, description = A Umlaut}

\begin{document}
\printglossaries
Testing the entry: \gls{a}.
\end{document}

Removing the line to load siunitx will fix this problem, as will loading translator explicity (before loading siunitx) with \usepackage[german]{translator}.

I believe this happens because siunitx.sty loads translator without any language options with \RequirePackage { translator }.

I'm not an expert, so I'm not sure if this behaviour is to be expected. But from a user's perspective, it seems siunitx breaks translation. Is this a bug? If so, in which package, and who should I report this to?


One other thing: xindy will report Cannot locate xindy module for language german in codepage utf8, and will switch to language general, unless I add \GlsSetXdyCodePage{duden-utf8}. Is this a bug?

  • Have you tried loading the siunitx package with the option locale=DE? – Mico Sep 13 '14 at 18:21
  • In my actual document, I use the locale=DE option - I just removed it for the minimal example. It doesn't affect this translation issue, it only changes things like commas as decimal separators. – tdlrali Sep 13 '14 at 19:15
  • I had the same problem but hadn't noticed it was siunitx's fault, nice catch! I'm using XeLaTeX, not LuaLaTeX, but the problem seems to be fixed if siunitx is loaded after glossaries, without needing to explicitly load translator. Can you confirm? – Zé Loff Sep 14 '14 at 2:30
  • You're right, it's fixed if I load siunitx after glossaries. But I hate all these load order dependencies, especially since hyperref's manual states Make sure it comes last of your loaded packages, and the glossaries manual states you should load the hyperref package before the glossaries package. From a user's perspective, it shouldn't matter when I load siunitx... I believe this problem occurs because siunitx doesn't use polyglossia correctly, or uses translator incorrectly. I'll try to get siunitx's author to notice this post. – tdlrali Sep 14 '14 at 8:28
6

The glossaries package will use translator if loaded for translating strings. The translator package requires that the language name is given as a global (class) option (which is usual babel 'best practice'). Unfortunately, polyglossia doesn't use this method as standard, but it will work happily. Try

\documentclass[german]{article}

\usepackage{polyglossia}
\setdefaultlanguage{german}
\usepackage{translator}
\usepackage[xindy]{glossaries}
\makeglossaries
\usedictionary{german}
\newglossaryentry{a}{name = ä, description = A Umlaut}

\begin{document}
\printglossaries
Testing the entry: \gls{a}.
\end{document}

Note that this is really not the fault of siunitx beyond the fact it loads translator if available: you'd see the same with any package loading translator or indeed if like in my demo you load it directly.

  • You're right, it does happen with other packages that load translator. I just didn't/don't understand the interaction between polyglossia, translator, and other packages like siunix enough to assess whether this behaviour is to be expected or not. Loading translator explicitly and setting the language works, thanks for the help! – tdlrali Sep 15 '14 at 12:55
6

You can explicitly load the glossaries-polyglossia package to fix the problem:

\documentclass{article}

\usepackage{fontspec}
\usepackage{polyglossia}
\setdefaultlanguage{german}

\usepackage{siunitx}

\usepackage[xindy]{glossaries}
\usepackage{glossaries-polyglossia}
\makeglossaries

\newglossaryentry{a}{name = ä, description = A Umlaut}

\begin{document}
\printglossaries
Testing the entry: \gls{a}.
\end{document}

Image of glossary

In some cases, you may also need to use the translate=false package option:

\documentclass{article}

\usepackage{fontspec}
\usepackage{polyglossia}
\setdefaultlanguage{german}

\usepackage{siunitx}

\usepackage[xindy,translate=false]{glossaries}
\usepackage{glossaries-polyglossia}
\makeglossaries

\newglossaryentry{a}{name = ä, description = A Umlaut}

\begin{document}
\printglossaries
Testing the entry: \gls{a}.
\end{document}

Although this particular example seems to work without it.

  • This works, but I think it only fixes the issue for the glossaries package. A translation issue will still occur when another packages that translates strings with translator is loaded, because translator doesn't seem to recognize the language set by polyglossia. (Thanks for the excellent glossaries package!) – tdlrali Sep 15 '14 at 13:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.