-
-
Notifications
You must be signed in to change notification settings - Fork 251
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Premature expansion in June 2022 MakeUpper/Lowercase #881
Comments
Remind me why we need the |
Mostly I think to handle legacy encoded input expanding to LICR which gets changed via the origial uclc list. |
Do we have a test for that? I'd like to see if I can just fix in the |
Ah, found one: |
That seems to be the only one ... and I'm not really sure I get what it's up to. Doesn't exactly seem to test what I am trying to verify! |
Since the \cs_gset:Npn \__text_expand_explicit:N #1
{
\token_if_cs:NTF #1
{\__text_expand_exclude:N #1}
{
\bool_lazy_and:nnTF
{ \token_if_active_p:N #1 }
{
! \bool_lazy_or_p:nn
{ \token_if_protected_macro_p:N #1 }
{ \token_if_protected_long_macro_p:N #1 }
}
{ \exp_after:wN \__text_expand_loop:w #1 }
{ \__text_expand_store:n {#1} \__text_expand_loop:w }
}
} How does that look? |
@josephwright if we go that way, MakeUppercase simplifies a lot but presumably a bit slower with legacy input encodings. From this PR we could still keep |
@davidcarlisle I think the name is fine - certainly I don't have a better one and it's clear what it does. On the change of speed, supporting in the |
I can change the |
I think @josephwright 's suggestion would be good. This test file shows several issues with the existing edef. test3 shows
|
I've loaded PL4 and tested the code. The issues with eqref and label are fixed. I noticed an issue with footnotes in section headings if the titlesec package is loaded. Without loading titlesec, a footnote in a section heading does not require \protect; if titlesec is loaded, it does. (In both cases, I found it necessary to robustify the footnote.) The need to protect is new (was not present before June 2022). The following illustrates.
|
@John02139 from
to
|
@davidcarlisle -- I've made that change in a local copy of titlesec.sty and tried it with both the small file posted here and my production files. The change fully resolves the issue. |
@John02139 thanks for the report, I'll close here, as you may have seen I opened an issue at titlesec to track your final issue. |
Brief outline of the bug
Originally reported at https://tex.stackexchange.com/a/649023
The new
\MakeUpperCase
is documented as obsoleting thetextcase
package but while the underlying l3 case change code does have support for protecting the arguments of\label
and\ref
etc from case changes, the outer\protected@edef
added for legacy LICR handling pre-expands these commands and things go badly wrong.The example below shows the error and if the first line is changed to
\iftrue
a suggested fix is enabled.The fix re-instates the protection of
\cite
fromtextcase
but re-implemented to use\unexpanded
and as a loop over the same list of commands made safe in the l3 code.A 2e command
\AddToNoCaseChangeList
is also provided to make it easy to add to that list without explicit l3 code syntax.An example would be
\AddToNoCaseChangeList{\eqref}
to add\eqref
to the list.amsmath
could be updated to execute this (if it is defined) to add its cross reference commands automaticallyMinimal example showing the bug
Log file (required) and possibly PDF file
log errors muliple spurious errors starting
The text was updated successfully, but these errors were encountered: