Bug Tracker
I’m currently working on a major new version of the datatool package. This may take a while. Please be patient. (Experimental version available for testing.)
ID | 44🔗 |
---|---|
Date: | 2013-10-23 04:25:37 |
Status | Closed (Fixed) |
Category | glossaries |
Version | 3.12a |
Summary | Bookmarks of symbols and numbers glossaries titles are not translated |
Sign in to subscribe to notifications about this report.
Description
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)").
MWE
Download (479B)
\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.
Update 2022-02-28 (12:04 GMT)
I noticed this issue was still marked as 'open'. I've now closed it as fixed.
Comments
9 comments.
Date: 2014-03-11 20:32:22
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} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Date: 2014-03-11 21:39:15
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
).
Date: 2014-03-16 21:39:35
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}
Date: 2014-03-17 08:57:00
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.Date: 2014-03-17 10:33:37
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}
Date: 2014-03-17 11:44:12
> thenumberedsection=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}
Date: 2014-03-17 12:25:00
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.
Date: 2014-03-17 13:00:54
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
Page permalink: https://www.dickimaw-books.com/bugtracker.php?key=44
Date: 2013-11-06 18:53:14
In fact, it would probably work if
\glsnumbersgroupname
would be defined in terms of\translatelet
instead of\translate
: