Bug Tracker
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 | 271🔗 |
---|---|
Submitted by: | egraff |
Date: | 2024-03-25 00:21:26 |
Last update: | 2024-04-04 21:54:43 |
Status | Closed (Fixed) |
Category | glossaries-extra |
Version | 1.53 |
Summary | Uppercase macros don't work anymore |
Sign in to subscribe to notifications about this report.
Description
Sometime in 2023 (I suspect it was due to a change in this revision: [TUG Link]) the LaTeX kernel case-changing macros used to implement\text_uppercase
and \text_lowercase
seem to have regressed, such that the argument (seemingly) doesn't expand the same way it used to. For the glossaries packages, one of the adverse effects of this is that most or all uses of \glsuppercase
do not work anymore. For example \glsuppercase{\glsentrytext{abc}}
seemingly produces the same result as \glsentrytext{abc}
, without uppercasing like it should. This also transitively affects other macros like \GLS
, \GLStext
, \GLSplural
, etc. in the same way.MWE
Download (398B)
\documentclass{book} \usepackage{glossaries-extra} \setlength{\parindent}{0pt} \newacronym[\glslongpluralkey={dynamic-link Libraries}]{dll}{dLL}{dynamic-link Library} \begin{document} \glsunset{dll} Manual use of glsuppercase: \glsuppercase{\glsentrytext{dll}}\\ GLS: \GLS{dll}, GLSpl: \GLSpl{dll}\\ GLStext: \GLStext{dll}\\ GLSfirst: \GLSfirst{dll}\\ GLSplural: \GLSplural{dll} \end{document}
Evaluation
This should now be fixed in v4.54. (Allow a few days for it to reach your TeX distribution.)
Comments
6 comments.
Date: 2024-03-25 10:25:34
Repying to: egraff 2024-03-25 10:18:02
A better fix is to use \exp_args:Ne
:
\renewcommand\glsuppercase[1]{\exp_args:Ne \text_uppercase:n { #1 } }Similarly for
\glslowercase
. That way they should still be expandable.Thank you.
Date: 2024-03-25 17:15:19
Thanks, Nicola!
I did a little more digging today, and I think I've found out why the expansion logic changed. Initially, I was wondering if this could be a bug in the l3kernel (if the change in behavior was not intended). However, now it looks like the change was very much intended!
Right now, I've been focusing specifically on \glsentrytext
and why \glsuppercase{\glsentrytext{dll}}
did not work anymore. I managed to trace it down to this: \glsmfuaddmap{\glsentrytext}{\Glsentrytext}
which to my understanding (but there is a lot I don't understand) ends up doing something similar to \glsmfuexcl{\glsentrytext}
, which in turn seems to add \glsentrytext
to \l_text_case_exclude_arg_tl
.
Now, consider this change: [TUG Link] which was part of the revision I linked to in the original bug description. I found the corresponding change on the latex3 GitHub: [Link], and it seems it was an intended change to fix another bug.
I don't really understand what \l_text_case_exclude_arg_tl
is, and certainly don't understand enough about your glossaries packages to be able to suggest a fix. But, as a software developer, I understand enough to be able to assess that the change (although intended) has caused a regression in your packages that needs fixing, and I thought I'd share this information because it seems to be important as part of triaging the issue to find the "right" fix.
Date: 2024-03-25 17:30:02
Repying to: egraff 2024-03-25 17:15:19
Hi, thank you for the extra information.
The exclusion list (\l_text_case_exclude_arg_tl
) is to prevent labels or similar arguments from having a case-change. For example, \ref
is automatically added as an exclusion by the L3 kernel to prevent \text_uppercase:n { see ~ \ref{somelabel} }
from being converted to SEE ~ \ref{SOMELABEL}
. The robust commands like \gls
are added as exclusions by the glossaries package. The mapping from \glsentrytext
to \Glsentrytext
ensures that \makefirstuc{\glsentrytext{label}}
is converted to \Glsentrylabel{label}
but this automatically adds the mapped command (\glsentrytext
) as an exclusion.
I think that since \glsentrytext
is expandable the map can probably be removed. It's only needed for the robust commands (such as \gls
which is mapped to \Gls
).
Date: 2024-04-03 14:19:01
I've had another look at the LaTeX3 manual and the case-changing commands in the l3text module are still described as having their argument expanded using \text_expand:n
so I think that the problem is due to the mfirstuc mappings which have the side-effect of adding the \glsentry...
commands as exclusions. The issue seems to resolve itself by changing \glsmfuaddmap{\glsentrytext}{\Glsentrytext}
to \glsmfuexcl{\Glsentrytext}
(and similarly for the other \glsentry...
commands).
Add Comment
Page permalink: https://www.dickimaw-books.com/bugtracker.php?key=271
Date: 2024-03-25 10:18:02
I forgot to mention, but I tried to play around with mitigations, and found that it seems to work again if I do something like:
but I'm guessing this is probably not an appropriate fix :-P