Comments (4)
from latex-unravel.
I didn't put too much effort in minimising the code, sorry.
I tried changing
\tl_put_left:Nn \l__unravel_head_tl { \reverse_if:N }
into
\gtl_put_left:Nn \l__unravel_head_gtl { \reverse_if:N }
as you suggested and got a You can't use `\unless' before `\noexpand'.
Looking at \__unravel_test_two_chars:nn
I discovered that the \l__unravel_head_tl
at the end contained \reverse_if:N \exp_not:N \if \exp_not:N -
, thus raising the error above. That stray \exp_not:N
is added by \__unravel_test_two_chars_gtl:N
. However removing the \exp_not:N
from there makes \l__unravel_head_tl
contain only \reverse_if:N \if -
, which doesn't error but I think is not good either. Plus, there is a -
missing from \l__unravel_head_tl
so the test won't work. My brain didn't let me go any further. I couldn't unravel \unravel
:(
Oh, wait, brain's back :D
I don't know about the correctness of this, but it seems to work:
First change \tl_put_left:Nn \l__unravel_head_tl { \reverse_if:N }
into \gtl_put_left:Nn \l__unravel_head_gtl { \reverse_if:N }
in \__unravel_unless:
, as you said, then change \__unravel_test_two_chars:nn
into (changes commented):
\cs_new_protected:Npn \__unravel_test_two_chars:nn #1
{
\__unravel_prev_input_gpush_gtl:N \l__unravel_head_gtl
\__unravel_print_expansion:
\__unravel_test_two_chars_get:n {#1}
\__unravel_test_two_chars_get:n {#1}
\__unravel_prev_input_gpop_gtl:N \l__unravel_head_gtl
\__unravel_set_action_text:x { \gtl_to_str:N \l__unravel_head_gtl }
\gtl_pop_left_item:NNTF \l__unravel_head_gtl \l__unravel_head_tl { } { }
% First check if the token removed from \l__unravel_head_gtl is a \reverse_if:N
\exp_after:wN
\token_if_eq_meaning:NNT \l__unravel_head_tl \reverse_if:N
{% If it is, pop the actual conditional and prepend it with \reverse_if:N
\gtl_pop_left_item:NNTF \l__unravel_head_gtl \l__unravel_head_tl { } { }
\tl_put_left:Nn \l__unravel_head_tl { \reverse_if:N }
}
\gtl_pop_left:NN \l__unravel_head_gtl \l__unravel_tmpb_gtl
\__unravel_test_two_chars_gtl:N \l__unravel_tmpb_gtl
\__unravel_test_two_chars_gtl:N \l__unravel_head_gtl
\l__unravel_head_tl \scan_stop:
\exp_after:wN \__unravel_cond_true:n
\else:
\exp_after:wN \__unravel_cond_false:n
\fi:
}
then the \l__unravel_head_tl
will contain \reverse_if:N \if \exp_not:N -\exp_not:N -
as it should :D
Both \if
and \unless\if
(and \ifcat
) work with this change.
from latex-unravel.
Hm... Another issue that comes from this same part of the code is:
\RequirePackage{unravel}
\unravel{\if##\fi}
\stop
which also worked in TL 2018.
I tracked the issue down to the \tl_put_right:Nx
in \__unravel_test_two_chars_gtl:N
, which tries to expand the #
after \gtl_head_do:NN
does its thing. Since \gtl_head_do:NN
is f
-expandable I changed (in the definition of \__unravel_test_two_chars_gtl:N
):
{ \exp_not:N \exp_not:N \gtl_head_do:NN #1 \exp_not:N }
to
{
\exp_not:N \exp_not:N
\exp_not:f { \gtl_head_do:NN #1 \exp_not:N }
}
and it seems to be working again :-)
If you'd like I can open a new issue for this.
Hm... Actually no. It makes this test:
\RequirePackage{unravel}
\def\test#1{\if\noexpand#1 \T\else\F\fi}
\unravel{\test{\test}}
\stop
take the true
branch because the f
expansion consumes the space and then the actual test done is \if \exp_not:N \test \exp_not:N \scan_stop:
. Perhaps now that we have \expanded
, \exp_not:e
could be used...
from latex-unravel.
I had fixed the second issue with a variant of your fix, and now the first issue is fixed as well.
from latex-unravel.
Related Issues (20)
- Space terminated dimen assignment doesn't work HOT 9
- Dimen assignment with factor in front of an implicit `<number>` fails HOT 1
- \meaning{ and \meaning} show internal unravel token
- Unravel until a quark
- \__unravel_begin_insert_or_adjust: is undefined
- LuaTeX primitive \lastnamedcs not implemented HOT 1
- Macro in that grabs \fi causes 'the-last-unravel-finished-badly' HOT 2
- e-TeX's \if-related integer parameters are zero
- LuaTeX expandable luacall HOT 1
- Calls to the prepare_mag procedure
- Support input (and other primitives) with braces
- `\unless` became `\reverse_if:N` in action part HOT 1
- \unless\ifcsname throws low level error HOT 1
- Improve coverage of non-pdfTeX primitives HOT 1
- u<text> at the macro prompt can affect another \unravel call
- Support luacall
- parshape not correctly supported
- `\scantokens` leaves extra pair of braces HOT 1
- `\unless\ifcsname ...\endcsname` fails with "Missing `\endcsname`" HOT 2
- Temp token `\notexpanded:<token>` is not properly restored HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from latex-unravel.