1

The glossaries' (v4.42) User Manual claims (page 48):

Note: the suffixes used to generate the plural forms when the plural hasn’t been specified are given by \glspluralsuffix (for general entries) [...]

This means that the suffix in effect will be for the last loaded language that redefined these commands.

But the following MCE:

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[french,ngerman,dutch,english]{babel}
\usepackage{glossaries}

\newacronym{gnu}{GNU}{GNU's Not Unix}

\begin{document}
\gls{gnu}

\glspl{gnu}
\end{document}

points out that's not the case with since:

  1. its .log file shows the last loaded .ldf file is the one from the 1st loaded language:

    (/usr/local/texlive/2018/texmf-dist/tex/latex/glossaries-english/glossaries-english.ldf)
    (/usr/local/texlive/2018/texmf-dist/tex/latex/glossaries-dutch/glossaries-dutch.ldf)
    (/usr/local/texlive/2018/texmf-dist/tex/latex/glossaries-german/glossaries-german.ldf)
    (/usr/local/texlive/2018/texmf-dist/tex/latex/glossaries-french/glossaries-french.ldf)
    
  2. the suffix is empty, as it is the case for French but not for English, Dutch or German.

Even more odd, if the language list is specified at the document class level:

\documentclass[french,ngerman,dutch,english]{article}
...
\usepackage{babel}
...

the order or the loaded glossaries-*.ldf seems to be random:

(/usr/local/texlive/2018/texmf-dist/tex/latex/glossaries-dutch/glossaries-dutch.ldf)
(/usr/local/texlive/2018/texmf-dist/tex/latex/glossaries-english/glossaries-english.ldf)
(/usr/local/texlive/2018/texmf-dist/tex/latex/glossaries-french/glossaries-french.ldf)
(/usr/local/texlive/2018/texmf-dist/tex/latex/glossaries-german/glossaries-german.ldf)

Do you see what's going on?

3

The loading order is determined by tracklang's list of tracked languages/dialects (that is, the list of identified document languages/dialects).

The tracklang package (which is used by glossaries) tries to determine the document languages as follows:

  1. If tracklang is explicitly loaded with options such as:

    \usepackage[french,ngerman,dutch,english]{tracklang}
    

    or if it picks up document class options, such as:

    \documentclass[french,ngerman,dutch,english]{article}
    \usepackage{tracklang}
    

    then tracklang.sty will track the languages or dialects according to order in which they were defined in tracklang.tex (the complete list of predefined languages and dialects can be found in \@tracklang@declaredoptions).

  2. If tracklang.sty doesn't pick up any package options, it will then check if any known language packages have been loaded. First it checks if \bbl@loaded (provided by babel) is defined. If it is, then tracklang.sty will iterate over the list and will track known dialect labels or warn if an unrecognised label is found. This means that with:

    \usepackage[french,ngerman,dutch,english]{babel}
    \usepackage{tracklang}
    

    then the order will match the order of \bbl@loaded.

For example, document class options:

\documentclass[french,ngerman,dutch,english]{article}
\usepackage{tracklang}

\makeatletter
\show\@tracklang@languages
\show\@tracklang@dialects

\begin{document}
\end{document}

The transcript shows:

> \@tracklang@languages=macro:
->dutch,english,french,german.
l.5 \show\@tracklang@languages

? 
> \@tracklang@dialects=macro:
->dutch,english,french,ngerman.
l.6 \show\@tracklang@dialects

With babel:

\documentclass{article}
\usepackage[french,ngerman,dutch,english]{babel}
\usepackage{tracklang}

\makeatletter
\show\@tracklang@languages
\show\@tracklang@dialects
\show\bbl@loaded

\begin{document}
\end{document}

The transcript now shows:

> \@tracklang@languages=macro:
->english,dutch,german,french.
l.6 \show\@tracklang@languages

? 
> \@tracklang@dialects=macro:
->english,dutch,ngerman,french.
l.7 \show\@tracklang@dialects

? 
> \bbl@loaded=macro:
->english,dutch,ngerman,french.
l.8 \show\bbl@loaded

So this order matches babel's order given in \bbl@loaded.

Explicitly tracking each dialect:

\documentclass{article}
\usepackage{tracklang}
\TrackPredefinedDialect{french}
\TrackPredefinedDialect{ngerman}
\TrackPredefinedDialect{dutch}
\TrackPredefinedDialect{english}

\makeatletter
\show\@tracklang@languages
\show\@tracklang@dialects

\begin{document}
\end{document}

The transcript now shows:

> \@tracklang@languages=macro:
->french,german,dutch,english.
l.9 \show\@tracklang@languages

? 
> \@tracklang@dialects=macro:
->french,ngerman,dutch,english.
l.10 \show\@tracklang@dialects

The order is always according to the order that the language/dialect has been tracked, but this way it's clearer what that order is.

The problem for the glossaries package is that the suffix commands can't be added to the language hooks because there's no way of guaranteeing when the command will be expanded and it can only follow the order provided by the language packages to determine which .ldf files need to be loaded. The suffix does indeed follow the last loaded language, but the order isn't guaranteed to match the order specified in the babel option list.

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.