Bug Tracker 
| ID | 292🔗 |
|---|---|
| Submitted by: | Nicola Talbot 🦜 |
| Date: | 2025-03-10 15:43:17 |
| Last update: | 2025-03-26 16:36:23 |
| Status | Closed (Fixed) |
| Category | glossaries |
| Version | 4.56 |
| Summary | \printnoidxglossary error with \ensuremath in sort and no locale |
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
Page permalink: https://www.dickimaw-books.com/bugtracker.php?key=292
