TeX - LaTeX Asked on July 11, 2021
Looking at the code below, what would the setup in 6. have to be to return F? Also, why does 2. return F in other words how are group_begin:
and c_group_begin_token
different?
begin{enumerate}
item tl_if_head_is_N_type:nTF{{foo}}{T}{F} % 1. F
item tl_if_head_eq_catcode:nNTF{{foo}}group_begin:{T}{F} % 2. F
item tl_if_head_eq_catcode:nNTF{{foo}}c_group_begin_token{T}{F} % 3. T
item token_if_group_begin:NTFc_group_begin_token{T}{F} % 4. T
item tl_if_head_is_N_type:nTF{[foo]}{T}{F} % 5. T
item tl_if_head_is_N_type:nTF % 6. T
{tl_rescan:nn
{char_set_catcode_group_begin:N [
char_set_catcode_group_end:N ]}
{[foo]}}{T}{F}
end{enumerate}
UPDATE:
What was lost on me the first time around is that using predicates such as tl_if_head_eq_catcode:nNTF
as second argument totl_rescan
is a bad idea to detect any change to catcode specified in the setup as they are affected by the change themselves. That said, perhaps this new MWE explains better what I was trying to lead to.
Also, [I’m now clear ongroup_begin:
vs c_group_begin_token
].
char91 % [
char93 % ]
cctab_const:Nn c__erw_setup_cctab
{
cctab_select:N c_code_cctab
char_set_catcode:nn {91}{1}
char_set_catcode:nn {93}{2}
}
tl_rescan:nn{c__erw_setup_cctab}
{tl_if_head_eq_catcode:nNTF {{foo}}
c_group_begin_token{T}{F}} % T
exp_args:Nnx
tl_rescan:nn{c__erw_setup_cctab}
{tl_if_head_eq_catcode:nNTF {[foo]}
c_group_begin_token{T}{F}} % F
PS: feel free to delete the question if it’s still not clear.
TeX has two ways we can make a group: using begingroup
/endgroup
and using {
/}
. The latter can be achieved using a pair of tokens let
to {
/}
. In expl3
terms, begingroup
is group_begin:
and {
is c_group_begin_token
. These are distinct ideas so come out differently when tested.
When you do tl_if_head_is_N_type:nTF { tl_rescan:nn ...
, the argument is not expanded: you are asking if tl_rescan:nn
itself is N
-type. It is, so the test is true: it does not matter what the output of the rescanning would be.
Answered by Joseph Wright on July 11, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP