Bug Tracker RSS feed

ID 292🔗
Submitted by: Nicola Talbot 🦜
Date: 2025-03-10 15:43:17
Last update: 2025-03-16 13:47:11
Status Open
Sign in if you want to bump this report.
Category glossaries
Version 4.56
Summary \printnoidxglossary error with \ensuremath in sort and no locale

Return to Search Results

Sign in to subscribe to notifications about this report.

Description

If a command such as \ensuremath is in the name field with no sort field and the \printnoidxglossary is used with expansion on for the sort value, then the following error is caused:
! Bad character code (281).
\char_value_catcode:n ..._eval:n {#1}\exp_stop_f: 

This error doesn't occur if datatool-english has been loaded:

\usepackage[locales=en]{glossaries}

MWE

Download (197B)

\documentclass{article}

\usepackage{glossaries}
\makenoidxglossaries
\newglossaryentry{pi}{name={\ensuremath{\pi}},description={pi}}

\begin{document}
\gls{pi}.
\printnoidxglossary
\end{document}

Evaluation

Ideally the sort key should be set in this situation but I will try to provide a fix. (The problem may actually lie in datatool-base rather than glossaries.)

Update: it looks like the problem is caused by expansion. The error can be replicated with:

\ExplSyntaxOn
\tl_set:Ne \l_tmpa_tl { \ensuremath{\pi} }
\tl_set:Ne \l_tmpa_tl { \text_purify:n { \l_tmpa_tl } }
\ExplSyntaxOff
The first expansion simulates the effect of the sanitizesort=false option, which is automatically enabled with \makenoidxglossaries. The second expansion emulates the effect of the datatool-base sort handler.

Note that the problem specifically occurs with \ensuremath{...} and not with math shift $...$.

The best solution is to set the sort key.

Update 2025-03-16: it looks like the problem is the test for the existence of \datatool_sort_preprocess:Nn is occurring too soon (before datatool-base has been loaded). Version v4.58 will defer the test which should fix this problem.

Comments

0 comments.


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. All guest comments have to be manually checked before they appear on the page. There are too many bots trying to spam the site to allow unauthenticated users to post without verification.

Comment:


You can use the following markup:

Block:

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

In line:

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

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

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

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

Page permalink: https://www.dickimaw-books.com/bugtracker.php?key=292

Return to Search Results