Glossaries links with non-latin labels in LuaLaTeX refer to wrong place
Not a solution but an explanation. The problem is hyperref. hyperref uses with lualatex \pdf@escapestring
to convert the name to something that can be safely used as a destination in the pdf. But the current implementation of \pdf@escapestring
handles only ascii, everything else is simply dropped. And this means that glossaries creates for the two entries the same destination glo:
On the terminal you can see the warning
warning (pdf backend): ignoring duplicate destination with the name 'glo:'
when trying this document:
\documentclass{article}
\usepackage{hyperref}
\begin{document}
\makeatletter
\pdf@escapestring {glo:компьютер}
\pdf@escapestring {glo:язык}
\hypertarget{glo:компьютер}{blub}
\hypertarget{glo:язык}{bla}
\end{document}
As Ulrike Fischer described the problem is that non-ASCII characters are dropped by \pdf@escapestring
. To avoid this, you can change \pdf@escapestring
to encode Unicode characters in UTF-8:
\documentclass{article}
\usepackage{polyglossia}
\setmainfont{Liberation Serif}
\usepackage{hyperref}
\usepackage[nonumberlist]{glossaries-extra}
\newglossaryentry{язык}{ name={язык},
sort=\lowercase{язык},
description={Система общения людей.}}
\newglossaryentry{компьютер}{ name={компьютер},
sort=\lowercase{компьютер},
description={Вычислительная машина.}}
\makeglossaries[main]
\makeatletter
\long\def\pdf@escapestring#1{%
\directlua0{%
oberdiek.pdftexcmds.escapestring("\luaescapestring{#1}")% Almost like the original one, just omit "byte" to keep all characters.
}%
}
\makeatother
\begin{document}
\section*{Словарь}
\printglossary[style=list,title={}]
\forallglossaries{\thistype}{\section{Glossary `\thistype'}
\forglsentries[\thistype]{\thislabel}{\gls{\thislabel}. }}
\end{document}