1

The following example:

\documentclass{memoir}
\usepackage{polyglossia}
\setdefaultlanguage{english}
\setotherlanguage{german}

\usepackage{glossaries-extra}

\makeglossaries
\makeindex

\glssetcategoryattribute{abbreviation}{dualindex}{true}
\newabbreviation{html}{html}{hypertext markup language}

\begin{document}
\gls{html}
\printglossaries
\printindex
\end{document}

gives me this error message:

Runaway argument?
html\@empty "\@nnil "\@empty \@glsxtr@endescspch \let \@glo@sort \@gls@checkedm
kidx \ETC.
! File ended while scanning use of \@glsxtr@autoindex@escquote.

If I comment out either the three lines for the polyglossia setup or the line adding the dual index for the abbreviations it compiles fine.

1

The double-quote character " is makeindex's default escape character. The glossaries and glossaries-extra package tries to search the sort and actual values for instances of this character to escape it, otherwise it will be misinterpreted by makeindex. Ulrike's answer has already explained that " is made active with the german language setting, which breaks this mechanism.

In this case, the simplest solution is to choose a different character (which should be one that isn't active). The base glossaries package provides \GlsSetQuote for the makeindex escape character used with the glossaries interface. The glossaries-extra package provides \GlsXtrSetEscChar for the dualindex setting. It's best to set them both to the same character:

\documentclass{memoir}
\usepackage{polyglossia}
\setdefaultlanguage{english}
\setotherlanguage{german}

\usepackage{glossaries-extra}

\GlsSetQuote{+}
\GlsXtrSetEscChar{+}

\makeglossaries
\makeindex

\glssetcategoryattribute{abbreviation}{dualindex}{true}
\newabbreviation{html}{html}{hypertext markup language}

\begin{document}
\gls{html}
\printglossaries
\printindex
\end{document}

If you use the makeglossaries script (or makeglossaries-lite), this will automatically invoke makeindex with the -g switch, which deals with the glossary files.

The normal index needs to have a custom style that sets the quote character:

\documentclass{memoir}
\usepackage{polyglossia}
\setdefaultlanguage{english}
\setotherlanguage{german}

\usepackage{glossaries-extra}

\begin{filecontents*}{dualindex.ist}
quote '+'
\end{filecontents*}

\GlsSetQuote{+}
\GlsXtrSetEscChar{+}

\makeglossaries
\makeindex

\glssetcategoryattribute{abbreviation}{dualindex}{true}
\newabbreviation{html}{html}{hypertext markup language}

\begin{document}
\gls{html}
\printglossaries
\printindex
\end{document}

If the file is called test.tex, then the document build is:

xelatex test
makeglossaries test
makeindex -s dualindex.ist test
xelatex test

If you're using xindy instead of makeindex for the normal index, the indexing is still performed using \index with @ indicating the actual value, | indicating the encap (format) and ! indicating the level. This means that \GlsXtrSetEscChar is still needed to change the character used to escape these characters if their literal use is needed from the default " to a non active character:

\documentclass{memoir}
\usepackage{polyglossia}
\setdefaultlanguage{english}
\setotherlanguage{german}

\usepackage[xindy]{glossaries-extra}

\GlsXtrSetEscChar{+}

\makeglossaries
\makeindex

\glssetcategoryattribute{abbreviation}{dualindex}{true}
\newabbreviation{html}{html}{hypertext markup language}

\begin{document}
\gls{html}
\printglossaries
\printindex
\end{document}

According to the texindy manual (man texindy), the makeindex emulation isn't completely compatible:

The MakeIndex compatibility definitions support only the default raw index syntax and markup definition. It is not possible to configure raw index parsing or use a MakeIndex style file to describe output markup.

So it might not be possible to instruct texindy that the escape character has changed, but if none of those special characters occur literally in the contents of \index, then it hopefully shouldn't matter.

  • I should have mentioned that I am using xindy (taken care of by latexmk) to build the index. – muk.li Jun 8 '18 at 11:28
  • Actually this solution seems to work out of the box with latexmk and xindy, or rather texindy, apparently the dualindex.ist file is not necessary even. But, on my real file, it still doesn't work, I get the same error message as mentioned in my comment to Ulrike's answer, apparently yet another problem I will need to isolate. – muk.li Jun 8 '18 at 12:01
  • @muk.li Once you can get a MWE that demonstrates it, you can ask a new follow-up question with a link back to this one. – Nicola Talbot Jun 8 '18 at 12:21
  • I will. I'm afraid it might get more than one follow-up question, in another version of my original file I now get strange things happening with footnotes, and an index entry added by glossaries-extra which was supposed to be sorted under Y appearing under P. – muk.li Jun 9 '18 at 4:04
  • @muk.li That's okay as long as it's one question per problem with a MWE illustrating the particular error. Regarding inappropriate sorting, check the indexing file to make sure that the sort value is correct. – Nicola Talbot Jun 9 '18 at 11:11
1

Polyglossia (or more precisely gloss-german) makes the " active directly. And this then breaks following packages which uses ". Move the \setotherlanguage{german} to \begin{document}

\documentclass{memoir}
\usepackage{polyglossia}
\setdefaultlanguage{english}

\usepackage{glossaries-extra}

\makeglossaries
\makeindex

\glssetcategoryattribute{abbreviation}{dualindex}{true}
\newabbreviation{html}{html}{hypertext markup language}

\setotherlanguage{german}
\begin{document}
\gls{html}
\printglossaries
\printindex
\end{document}

Or use babel which doesn't have this problem and works fine with xelatex and lualatex too:

\documentclass{memoir}
\usepackage[ngerman,english]{babel}
\usepackage{glossaries-extra}

\makeglossaries
\makeindex

\glssetcategoryattribute{abbreviation}{dualindex}{true}
\newabbreviation{html}{html}{hypertext markup language}


\begin{document}
\gls{html}
\printglossaries
\printindex
\end{document}
  • Shifting the language definitions to after the loading of glossaries-extra solves it for my example above, but in my real file unfortunately not, the first call to gls produces ABD: EverySelectfont initializing macros ! Undefined control sequence. \in@ #1#2->\begingroup \def \in@@ ##1#1{}\toks@ \expandafter {\in@@ #2{}{}#1... l.94 \gls{yh} I'll try to change my example to reproduce this behaviour. – muk.li Jun 8 '18 at 9:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.