0

I write a document, whose primary language is English. But I have some glossary entries whose names (aka label) are in German, but the description, etc. is in English again. I use the packages glossaries and babel.

So, some of my glossary definitions look like this:

\newglossaryentry{foo}{%
    name={\foreignlanguage{ngerman}{Foo}},%
    description={(ger.) German word for Bar.}%
}

Additionally, I want every entry in the glossary to start with a capital letter. Hence, I redefined

\renewcommand*{\glsnamefont}[1]{\makefirstuc{#1}}

in the preamble. This results into a compilation error.

! Illegal parameter number in definition of \languagename

Instead, if I protected the argument with an addition {}, i.e.

\renewcommand*{\glsnamefont}[1]{\makefirstuc{{#1}}}

the compilation is successful, but then the whole entry is capitalized not only the first letter. But that's not what I want.

2

The simple solution is to define a new command to switch the language

\newcommand*{\ngerman}[1]{\foreignlanguage{ngerman}{#1}}

and then define the glossary entry as

\newglossaryentry{foo}{%
    name={\ngerman{Foo}},%
    description={(ger.) German word for Bar.}%
}

instead. This way, the first argument of \foreignlanguage is hidden from \makefirstuc. Of course, a more general solution that could deal with arbitrary bi-parametric macros would be nice, but it is OK, because German is the only second languange that I need in my document.

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.