Latest news 2024-03-02: Ebook sale (3rd–9th March 2024): short story cybercrime fiction Unsocial Media free; short story noir crime fiction I’ve Heard the Mermaid Sing free; crime fiction novel The Private Enemy US$1.99; illustrated children’s story The Foolish Hedgehog US$0.99. For further details, see latest blog post.

Bug Tracker RSS feed

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 186🔗
Submitted by: Nicola Talbot 🦜
Date: 2021-10-19 09:25:32
Status Closed (Fixed)
Category glossaries
Version 4.47
Summary list style with entrycounter has problematic unexpanded content

Sign in to subscribe to notifications about this report.


The glossaries user manual advises against using the list styles with certain classes and packages. This is mostly due to the content of the \item argument being processed in some way.

Each problematic class and package has its own idiosyncratic method, but hyperref is used in many documents. The relevant commands used in hyperref's \item are actually from the gettitlestring package, so some basic support needs to be provided for gettitlestring.

The provided MWE demonstrates a problem that isn't immediately identifiable in the original document but triggers an error in the second document (test-xr.tex) that cross-references an item in the first document's glossary.

! Undefined control sequence.
\r@glsentry-sample ->{1}{1}{\glsentryitem 
                                          {sample}\glstarget {sample}{\gloss...
l.9 ...ternal glossary entry \ref{glsentry-sample}
This is because the entrycounter option has been used which implements \refstepcounter when the entry name is displayed in the glossary. In the case of the list styles this occurs within the optional argument of \item.

This is due to the entry counter labelling information that's written unexpanded to the aux file:

\newlabel{glsentry-sample}{{1}{1}{\glsentryitem {sample}\glstarget {sample}{\glossentryname {sample}}}{glossaryentry.main.1}{}}
The simple solution is to do
before the start of the glossary.

My original plan was to add this patch to glossaries-extra-stylemods.sty but I think in this case it's better to put the patch in glossary-list.sty. The only problem will be the cases where the name contains fragile commands, so some limit on the expansion may be necessary.


Download (518B)

% arara: pdflatex
% arara: makeglossaries
% arara: pdflatex
% arara: pdflatex

Cross-ref external glossary entry \ref{glsentry-sample}.


 description={an example}}



Fixed in v4.48 (2021-10-19).

The gettitlestring commands are now in \glslistinit. There are some modifications to my original:

To help guard against any fragile commands contained in the name field, this uses \glslistexpandedname which expands to the value of the name field but no further. If any adjustments are required, redefine \glslistinit as appropriate.



Add Comment

Name (optional):

Are you human? Please confirm the bug report ID (which can be found at the top of this page) or login if you have an account.


You can use the following markup:


[pre]Displayed verbatim[/pre]
[quote]block quote[/quote]

In line:

[file]file/package/class name[/file]
[em]emphasized text[/em]
[b]bold text[/b]
[url]web address[/url] [sup]superscript[/sup]

Ordered list:
[li]first item[/li]
[li]second item[/li]

Unordered list:
[li]first item[/li]
[li]second item[/li]

You can use the Preview button to review your message formatting before submitting.

Page permalink: