5

I was trying to make an article in french with a glossary (glossaire in our weird tongue), and I noticed that, even if I did manage to set the translation right for the body, the \leftmark (or \rightmark) used by fancyhdr is still in english.

Here's my code:

\documentclass{article}

\usepackage{fontspec}
\usepackage[francais]{babel}

\usepackage{fancyhdr}

\usepackage[acronym,xindy,toc]{glossaries}
\makeglossaries
    \addto{\captionsfrancais}{
      \renewcommand{\glossaryname}{Glossaire}
    }

\newglossaryentry{thingy}
{
  name=thingy,
  description={something}
}

\pagestyle{fancy}
\fancyhf{}
\fancyhead[RE]{\small\sc\nouppercase{\leftmark}}
\fancyhead[LO]{\small\sc\nouppercase{\rightmark}}
\fancyhead[LE,RO]{\thepage}

\begin{document}

\gls{thingy}

\newpage

\printglossaries

\end{document}

translationproblem

Any idea how to get the correct translation in the header too?

Edit: and if I want a different translation altogether ("termes techniques", for example)?

Thanks!

1
  • You should be using \captionsfrench and not \captionsfrancais, but the right word is already set.
    – egreg
    Oct 4, 2013 at 21:24

1 Answer 1

7

The glossaries package uses translator, but this package seems not to be aware of the current language and the language to be used must be passed to it.

So you need either to set the language option in \documentclass or load the translator package with the correct option.

In the two codes below I mention only the relevant packages.

Choice 1

\documentclass[francais]{article}

\usepackage{babel}

\usepackage[acronym,xindy,toc]{glossaries}
\makeglossaries

Choice 2

\documentclass{article}

\usepackage[francais]{babel}

\usepackage{fancyhdr}
\usepackage[francais]{translator}
\usepackage[acronym,xindy,toc]{glossaries}
\makeglossaries

enter image description here


Note: the fixed words for French (at least those that are not managed by translator in this case) should be modified with

\addto\captionsfrench

and not with \addto\captionsfrancais.


If you want to change the generic title for glossaries, say for using Termes instead of Glossaire, the translator facility is needed:

\AtBeginDocument{%
  \renewtranslation[to=French]{Glossary}{Termes}%
}

(sorry for the clumsiness of this approach, but it's not my fault).

Alternatively, if you have a single glossary, use the title option and type

\printglossary[title=Termes]

instead of \printglossaries.

5
  • That works. Thanks for the tip, since \renewcommand is not even needed anymore. But if I may be a little more demanding, the header word is the translation of glossary in french. If I want to change the name of the glossary (to something like "termes" for examples), how do I get to have "termes" in the header too?
    – user37673
    Oct 5, 2013 at 6:45
  • @user37673 I added some directions.
    – egreg
    Oct 5, 2013 at 9:44
  • Hum. the second solution works, but I need acronyms too (which I use to introduce translated terms, hence my question --- I need to "translate" acronyms by "Termes traduits"). For the first solution, though, I get a translation of ``Glossary'' not defined Error, though (which is quite weird, since it is translated just fine). If I switch to \newtranslation[to=French]{Glossary}{Termes}, the message goes away (duh!), but the translation doesn't work.
    – user37673
    Oct 6, 2013 at 19:47
  • @user37673 \renewtranslation[to=French]{Acronyms}{Termes traduits} in the same place as the other one should do.
    – egreg
    Oct 6, 2013 at 20:54
  • Ok, that works... Apparently I can't use \AtBeginDocument. And in my case, the translation is not defined, so I need to write \newtranslation[to=French]{Acronyms}{Termes traduits} (and not \renewtranslation), after my \begin{document}. I guess that'll do. (Though I'll have to understand why \AtBeginDocument doesn't work.) Thanks!
    – user37673
    Oct 6, 2013 at 21:07

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.