I have a glossary defined with the glossaries package, and I use the hyperref package to control aspects of the generated PDF file. When I set the document's language with polygossia's \setmainlanguage command, I get the following warning near the end of compilation (whether with lualatex or xelatex):
(./test.toc) (./test.gls
Package hyperref Warning: Token not allowed in a PDF string (PDFDocEncoding):
(hyperref) removing `\textenglish' on input line 1.
)
It evidently doesn't like the \textenglish command that appears in the table of contents:
\contentsline {section}{\textenglish {Glossary}}{1}{section*.2}
If I don't set the language, then the warning doesn't appear.
\documentclass{article}
\usepackage{polyglossia}
% Removing the following line makes the warning go away,
% but it introduces a biblatex error instead
\setmainlanguage{english}
\usepackage[backend=biber]{biblatex}
\usepackage{hyperref}
\usepackage[toc]{glossaries}
\makeglossaries
\newglossaryentry{foo}{
name=foo,
description={is foo}
}
\begin{document}
\tableofcontents
\section{foobar}
\gls{foo}
\printglossary
\end{document}
I've read related questions that all recommend using \texorpdfstring to separate the text that goes into the PDF table of contents, but I'm not sure where I'm supposed to do that in this case since I'm not the one generating the table-of-contents code in the first place.
I'm not sure what effect \textenglish really has on my document, especially considering all the text is already in English anyway. I can see that it comes from glossaries-english.ldf when polyglossia has been loaded, but I'm unsure what other effects the loading order has. Besides, if I remove the \setmainlanguage command, then compilation fails at \begin{document}, apparently because biblatex lacks some language information:
! Undefined control sequence.
<argument> blx@lng@\bbl@main@language
l.16 \begin{document}
How do I quell the hyperref warning?
\textenglishfrom the pdf string:\texorpdfstring{\textenglish}{}; that would go into the\sectionentry that is in turn used for the contents and the bookmarks. (not tested.) – barbara beeton Jan 02 '15 at 19:48\sectionanywhere. It's generated on my behalf somewhere inside of\printglossary. – Rob Kennedy Jan 02 '15 at 19:50glossaries-englishpackage, it looks like you may be able to get around the problem with a simple definition:\renewcommand{\glossaryname}{\texorpdfstring{\textenglish}{}{Glossary}}. again, not tested (don't have latest version of this package installed locally). if this fails, it's a question for @NicolaTalbot, the author of theglossariespackage. – barbara beeton Jan 02 '15 at 20:03