-
Notifications
You must be signed in to change notification settings - Fork 178
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
l3text: improve the handling of \exp_not:n in \text_expand:n #875
Comments
Can you take a look at 30d827a please? I opted for f-expanding what follows |
@blefloch looks good to me. But considering |
The following implements This is just an MWE, so the code would need some refactoring to be merged into
|
Actually that still misses some aspects, this would break if the
|
This still fails for the very unlikely case that someone uses an implicit opening group like in |
Remember that the input is meant to be 'text' in general. I think we probably do want to worry about |
@josephwright I don't think we should support the |
I've gone for a simplification of your second variant. |
Currently,
\text_expand:n
makes a few assumptions on the usage of\exp_not:n
, namely:\exp_after:wN
follows\exp_not:n
(and only the correct number of\exp_after:wN
s)\exp_not:n
acts on (breaking with non-standard category codes; or code that only forms the group for\exp_not:n
upon further expansion)As a result, a usage such as
\exp_not:n \exp_after:wN \exp_after:wN { <stuff> }
(which might be wrong from a programmers point of view, but don't throw an error) will throw an error inside of\text_expand:n
. Also macros like\tl_head:n
and\tl_tail:n
don't work inside of\text_expanded:n
.While getting everything right with
\exp_not:n
would require much code to basically do a part of TeX's parsing, we could at least fix the errors being thrown on a wrong number of\exp_after:wN
s and fix the usage of\tl_head:n
inside\text_expanded:n
with a simple change:Unfortunately, this doesn't solve everything, e.g.,
\tl_tail:n
will still throw low level TeX errors.The text was updated successfully, but these errors were encountered: