Latest news 2019-12-05: new blog post "RSS Feeds and Other Notifications."

Bug Tracker

ID44
StatusOpen
Categoryglossaries
Version3.12a
SummaryBookmarks of symbols and numbers glossaries titles are not translated

Report

When using symbols and numbers options, bookmarks (provided by hyperref) of symbols and numbers glossaries titles are not translated.

The joined MWE shows that, for instance in French, the titles of these glossaries are translated ("Symboles" and "Nombres") but the corresponding bookmarks are not ("Symbols (glossaries)" and "Numbers (glossaries)").

Denis Bitouzé

MWE

\listfiles
%
\documentclass[french]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{babel}
\usepackage[bookmarksopen]{hyperref}
\usepackage[symbols,numbers,toc]{glossaries}
%
\makeglossaries
%
\newglossaryentry{angstrom}{type=symbols,name={\aa}ngstr\"om,
  symbol={\AA},sort=angstrom, description={non-SI unit of length}}
%
\newglossaryentry{one}{type=numbers,name=one,description=A number}
%
\begin{document}
\glsaddall
\printglossaries
\end{document}

Evaluation

Date: 2013-11-05 18:50 GMT

This is caused by Token not allowed in PDFDocEncoded string. The log file shows this warning:

Package hyperref Warning: Token not allowed in a PDF string (PDFDocEncoding):
(hyperref)                removing `\translate ' on input line 1.
This is because \glssymbolsgroupname is defined as \translate {Symbols (glossaries)} and \glsnumbersgroupname is defined as \translate {Numbers (glossaries)}.

I recommend you suppress loading the translator package and instead load glossaries-babel:

\usepackage[symbols,numbers,toc,translate=false]{glossaries}
\usepackage{glossaries-babel}

Update 2014-03-12

I'm sorry I forgot to add a check for the new symbols, numbers and index glossary types to \glssettoctitle. This checks for translations of known glossary types and sets the toc title using \translatelet, which is why the bookmarks work fine for main and acronym. Since \glssettoctitle is used by \printglossary (and \printnoidxglossary) the toc title translations fit with the language currently in use at that point in the document. The other language dependent commands, such as \entryname, are set once to use \translate which ensures they are correctly translated if there's a language change during the document. For example, if one glossary is in one language and another glossary is in a different language. This is illustrated with the following example:

\documentclass[french,german]{article}

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{babel}
\usepackage{glossaries}

\begin{document}
\translatelet{\glossaryname}{Glossary}%
\translatelet{\acronymname}{Acronyms}%
\translatelet{\entryname}{Notation (glossaries)}%
\translatelet{\descriptionname}{Description (glossaries)}%
\translatelet{\symbolname}{Symbol (glossaries)}%
\translatelet{\pagelistname}{Page List (glossaries)}%
\translatelet{\glssymbolsgroupname}{Symbols (glossaries)}%
\translatelet{\glsnumbersgroupname}{Numbers (glossaries)}%

\section{German}
\selectlanguage{german}


Glossary name: \glossaryname.

Acronym name: \acronymname.

Entry name: \entryname.

Description name: \descriptionname.

Symbol name: \symbolname.

Page list name: \pagelistname.

symbols group name: \glssymbolsgroupname.

numbers group name: \glsnumbersgroupname.

\section{French}
\selectlanguage{french}

Glossary name: \glossaryname.

Acronym name: \acronymname.

Entry name: \entryname.

Description name: \descriptionname.

Symbol name: \symbolname.

Page list name: \pagelistname.

symbols group name: \glssymbolsgroupname.

numbers group name: \glsnumbersgroupname.

\end{document}
Here, the commands in the second section still use the German versions instead of the French versions because having been defined with \translatelet instead of using \translate, they're fixed with the language that was in use when they were redefined. Therefore, when using translator, the language dependent commands need to be defined using \translate rather that \translatelet to accommodate documents that are written in more than one language. It should be sufficient to solve this problem if I just modify \glssettoctitle to check for the new predefined glossary types.

Update 2014-03-12 (15:25 GMT)

This bug has now been fixed in version 4.06.

Comments

Comment from Denis Bitouzé
Date: 2013-11-06 12:53:14 CST

> This is because \glssymbolsgroupname is defined as \translate {Symbols (glossaries)} and \glsnumbersgroupname is defined as \translate {Numbers (glossaries)}.

In fact, it would probably work if \glsnumbersgroupname would be defined in terms of \translatelet instead of \translate:

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\documentclass[french]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{babel}
\usepackage{translator}
\usepackage{hyperref}
%
\deftranslation[to=French]{foo}{Bar}
\translatelet\trfoo{foo}%
%
\begin{document}
\section{Bar 1}
\section{\translate{foo} 2}
\section{\trfoo{} 3}
\end{document}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

Comment from Denis Bitouzé
Date: 2014-03-11 14:32:22 CDT

What is strange is that, if ordinary glossary entry and acronym are added to the initial MWE above, the bookmarks of the corresponding glossaries are translated ("Glossaire" and "Acronymes"), and still not the ones corresponding to symbols and numbers:

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\documentclass[french]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{babel}
\usepackage[bookmarksopen]{hyperref}
\usepackage[acronyms,symbols,numbers,toc]{glossaries}
%
\makeglossaries
%
\newglossaryentry{bar}{name=bar,description=bar}
\newacronym{at}{at}{Acronym test}
\newglossaryentry{angstrom}{type=symbols,name={\aa}ngstr\"om,
  symbol={\AA},sort=angstrom, description={non-SI unit of length}}
%
\newglossaryentry{one}{type=numbers,name=one,description=A number}
%
\begin{document}
\glsaddall
\printglossaries
\end{document}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

Comment from Denis Bitouzé
Date: 2014-03-11 15:39:15 CDT

Investigating a bit more this bug, I noticed that the .aux file corresponding to the previous .tex file contains:

\@writefile{toc}{\contentsline {section}{Glossaire}{1}{section*.1}}
\@writefile{toc}{\contentsline {section}{Acronymes}{1}{section*.3}}
\@writefile{toc}{\contentsline {section}{\translate  {Symbols (glossaries)}}{1}{section*.5}}
\@writefile{toc}{\contentsline {section}{\translate  {Numbers (glossaries)}}{1}{section*.7}}

And, indeed, the glossaries' code shows (lines 775 to 792) that captions' translations are defined in terms of (1) \translatelet (with \glossarytoctitle and \glossarytoctitle macros) for "Glossary" and "Acronyms", (2) \translate for "Glossary" and "Acronyms" (\glssymbolsgroupname and \glsnumbersgroupname).

Comment from Denis Bitouzé
Date: 2014-03-16 15:39:35 CDT

The bug has indeed been fixed in version 4.06, except in case of redefinition of sections macros. In the following MCE, the glossary bookmark isn't translated, with warning: "Package hyperref Warning: Token not allowed in a PDF string (PDFDocEncoding): removing `\translate ' on input line".

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\documentclass[french]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{babel}
\usepackage{hyperref}%
\usepackage{glossaries}
%
\makeglossaries
%
\let\ORIsection\section%
\makeatletter%
\renewcommand\section{%
  \@ifstar\ORIsection\ORIsection%
}%
\makeatother%
%
\newglossaryentry{bar}{%
  name={bar},
  description={bar}
}
\glsaddall
%
\begin{document}
\tableofcontents
\printglossary
\end{document}

Comment from Nicola Talbot
Date: 2013-03-17 08:57 GMT

Your redefinition means that when the glossary uses:

\section*{title}
this is now equivalent to
\section[title]{title}
not
\section[toc title]{title}
so it's using \glossaryname in the TOC (and therefore the bookmark) instead of \glossarytoctitle. So you need to redefine \glossarysection:
\documentclass[french]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{babel}
\usepackage{hyperref}%
\usepackage{glossaries}
%
\makeglossaries
%
\let\ORIsection\section%
\makeatletter%
\renewcommand\section{%
  \@ifstar\ORIsection\ORIsection%
}%
\makeatother%

\let\glossarysection\ORIsection
%
\newglossaryentry{bar}{%
  name={bar},
  description={bar}
}
\glsaddall
%
\begin{document}
\tableofcontents
\printglossary
\end{document}
So it's not a bug, however it has made me realise that the numberedsection=nolabel and numberedsection=autolabel package options should use the optional argument of the unstarred sectioning commands, otherwise a similar problem may occur. This will be fixed in the next version.

Comment from Denis Bitouzé
Date: 2014-03-17 04:33:37 CDT

My MWE maybe was too extreme! ;) In my real use case, I have different definitions for the starred and the non starred versions of \section but I'm not sure it will be enough w.r.t to what you mentioned:

\section*{title}

is equivalent to
\section[title]{title}

not
\section[toc title]{title}

Comment from Denis Bitouzé
Date: 2014-03-17 05:44:12 CDT

> the numberedsection=nolabel and
> numberedsection=autolabel package options should
> use the optional argument of the unstarred sectioning
> commands, otherwise a similar problem may occur.

Is this related to the trouble that, in the following MCE, the glossary is in the table of contents even if no toc option is passed to glossaries?

\documentclass{article}
\usepackage{glossaries}
%
\makeglossaries
%
\let\ORIsection\section%
\makeatletter%
\renewcommand\section{%
  \@ifstar\ORIsection\ORIsection%
}%
\makeatother%

\let\glossarysection\ORIsection
%
\newglossaryentry{bar}{%
  name={bar},
  description={bar}
}
\glsaddall
%
\begin{document}
\tableofcontents
\printglossary
\end{document}

Comment from Nicola Talbot
Date: 2014-03-17 12:25 GMT

No. It's in the TOC because \glossarysection is now using the original unstarred \section, which by default puts its argument in the TOC. The toc option is ignored because \glossarysection has been redefined to ignore it. If you modify the behaviour of the sectioning commands, it's best to redefine \glossarysection[toc title]{title} in whatever manner fits in with your new sectioning style. You can test for the toc option within your new definition of \glossarysection with \ifglstoc. For example:

\renewcommand*{\glossarysection}[2][]{%
  \ORIsection*{#2}%
  \ifglstoc
    \addcontentsline{toc}{section}{#1}%
  \fi
}
or to also check for the numberline option:
\renewcommand*{\glossarysection}[2][]{%
  \ORIsection*{#2}%
  \ifglstoc
    \ifglsnumberline
      \addcontentsline{toc}{section}{\numberline{}#1}%
    \else
      \addcontentsline{toc}{section}{#1}%
    \fi
  \fi
}
If you change \ORIsection* to a command that automatically adds its argument to the TOC, then toc option will cause a duplicate TOC (and bookmark) entry to appear.

Comment from Denis Bitouzé
Date: 2014-03-17 07:00:54 CDT

Thanks, the first code currently does the trick. I'll look to the next version to see if something has to be changed afterwards.

Add comment.

Watch This Report

If you would like to be notified whenever updates are made to this report, please fill in your email address in the box below and click on "Notify Me of Changes" button. (Please ensure the address is valid.) Your details won't be passed on to third parties in line with this site's Privacy Policy.

If you supply your name, it will be used in the email greeting, which provides a more personal message, otherwise you'll just get a generic greeting. If you have previously supplied your name when signing up for notifications, you don't need to resupply it unless you want to change it.

If you have previously subscribed to notifications for this report, you can unsubscribe by clicking on the "Stop Notification" button.

The "Confirm Bug ID" field helps to protect against spambots. Please enter the bug ID (which you can find at the top of this page).

(Optional.)
E mail:
Confirm E mail:
Confirm Bug ID:

To unsubscribe from all notifications use the notifications page.

Comment

You can append a comment to the report using the form below. Comments are checked first before being added. Any spam or offensive content will be removed first according to this site's Terms of Website Use. Please bear in mind that I develop and maintain free software in my spare time. If you want commerical level support then you can hire a TeX consultant.

The "Confirm Bug ID" field helps to protect against spambots. Please enter the bug ID (which you can find at the top of this page).

(Optional. If provided, it will be shown with the comment.)
Confirm Bug ID:

You can use the following markup:

[pre]Displayed verbatim[/pre]
[tt]monospace text[/tt]
[em]emphasized text[/em]
[b]bold text[/b]
[url]web address[/url]

Ordered list:
[ol]
[li]first item[/li]
[li]second item[/li]
[/ol]

Unordered list:
[ul]
[li]first item[/li]
[li]second item[/li]
[/ul]

Click on the Preview button to preview the message.

Return to list.

© 2019 Dickimaw Books. "Dickimaw", "Dickimaw Books" and the Dickimaw parrot logo are trademarks. The Dickimaw parrot was painted by Magdalene Pritchett.

Terms of Use Privacy Policy Cookies Site Map FAQs