# glossary with diacritic marks

This example in English

\documentclass{article}
\usepackage{glossaries}
\newglossaryentry{tea}
{
name=tea,
description={a drink}
}
\makeglossaries
\begin{document}
Drink \gls{tea}.
\printglossaries
\end{document}


works fine.

A problem appears when I use diacritic marks for glossary entries:

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{glossaries}
\newglossaryentry{tēju}
{
name=tēja,
description={a drink}
}
\makeglossaries
\begin{document}
Dzert \gls{tēju}.
\printglossaries
\end{document}


The error is:

! Missing \endcsname inserted.
\unhbox


How to make the glossary friendly to other languages?

• As stated in the manual: "Note that although an extended Latin character or other non-Latin character, such as é or ß, looks like a plain character in your .tex file, it’s actually a macro (an active character) and therefore can’t be used in the label. (This applies to LaTeX rather than XeLaTeX.)" So if you want to use non-ASCII characters in the label you need to use XeLaTeX or LuaLaTeX. – Nicola Talbot Nov 23 '18 at 16:35
• @NicolaTalbot, using xelatex solved the problem. – Viesturs Nov 23 '18 at 21:09
• @NicolaTalbot, will you provide and answer in case someone else has this problem? – Viesturs Nov 23 '18 at 21:27

With PDFLaTeX, a UTF-8 character, such as é, is actually seen as two octets. The first octet is made active (by inputenc) and becomes an accent command and the second octet is the argument for that command. So, if you are restricted to using PDFLaTeX then you can't use non-ASCII characters in the labels and you'd need to determine a suitable ASCII-only naming scheme. See, for example, section 1.1 "Labels" of glossaries-extra and bib2gls: an introductory guide (PDF).