What is it I am doing wrong using `tl_case:Nn â¦`?
Clash Royale CLAN TAG#URR8PPP
up vote
1
down vote
favorite
When using document command arguments for case distinctions I routinely have been using the str_case:nn
function, which works fine as is evident from the output of the myStrCase
command. When attempting to use the tl_case:Nn
function instead, by loading the argument into a _tl
type variable, things go miserably wrong. The variable seems to be loaded with the correct value, and is then flagged as correct as far as the tl_case:Nn
function is concerned, but the corresponding code is not executed. Why?
documentclassarticle
%=======================
usepackage[check-declarations,log-functions]expl3
usepackagexparse
%-----------------------
ExplSyntaxOn
tl_new:N l_rn_Aux_tl
NewDocumentCommandmyStrCaseOemphm
str_case:nnTF #1
emphtextit#2
Emphtextbftextit#2
ulineunderline#2
!~ERROR:~parameter~#1~=~#1~invalid
% myStrCase
NewDocumentCommandmyTlCaseOemphm
tl_set:Nx l_rn_Aux_tl #1
checking~what~was~passed:~l_rn_Aux_tl \
tl_case:NnTF l_rn_Aux_tl
emph textit#2
Emph textbftextit#2
uline underline#2
parameter~#1~=~#1~valid
!~ERROR:~parameter~#1~=~#1~invalid
% myTlCase
ExplSyntaxOff
%-----------------------
begindocument
subsectionusing str_case:
myStrCaseHi There\
myStrCase[emph]Hi There\
myStrCase[Emph]Hi There\
myStrCase[uline]Hi There\
myStrCase[xxx]Hi There
subsectionusing tl_case:
myTlCase[emph]Hi There\
myTlCase[xxx]Hi There
enddocument
expl3
add a comment |Â
up vote
1
down vote
favorite
When using document command arguments for case distinctions I routinely have been using the str_case:nn
function, which works fine as is evident from the output of the myStrCase
command. When attempting to use the tl_case:Nn
function instead, by loading the argument into a _tl
type variable, things go miserably wrong. The variable seems to be loaded with the correct value, and is then flagged as correct as far as the tl_case:Nn
function is concerned, but the corresponding code is not executed. Why?
documentclassarticle
%=======================
usepackage[check-declarations,log-functions]expl3
usepackagexparse
%-----------------------
ExplSyntaxOn
tl_new:N l_rn_Aux_tl
NewDocumentCommandmyStrCaseOemphm
str_case:nnTF #1
emphtextit#2
Emphtextbftextit#2
ulineunderline#2
!~ERROR:~parameter~#1~=~#1~invalid
% myStrCase
NewDocumentCommandmyTlCaseOemphm
tl_set:Nx l_rn_Aux_tl #1
checking~what~was~passed:~l_rn_Aux_tl \
tl_case:NnTF l_rn_Aux_tl
emph textit#2
Emph textbftextit#2
uline underline#2
parameter~#1~=~#1~valid
!~ERROR:~parameter~#1~=~#1~invalid
% myTlCase
ExplSyntaxOff
%-----------------------
begindocument
subsectionusing str_case:
myStrCaseHi There\
myStrCase[emph]Hi There\
myStrCase[Emph]Hi There\
myStrCase[uline]Hi There\
myStrCase[xxx]Hi There
subsectionusing tl_case:
myTlCase[emph]Hi There\
myTlCase[xxx]Hi There
enddocument
expl3
add a comment |Â
up vote
1
down vote
favorite
up vote
1
down vote
favorite
When using document command arguments for case distinctions I routinely have been using the str_case:nn
function, which works fine as is evident from the output of the myStrCase
command. When attempting to use the tl_case:Nn
function instead, by loading the argument into a _tl
type variable, things go miserably wrong. The variable seems to be loaded with the correct value, and is then flagged as correct as far as the tl_case:Nn
function is concerned, but the corresponding code is not executed. Why?
documentclassarticle
%=======================
usepackage[check-declarations,log-functions]expl3
usepackagexparse
%-----------------------
ExplSyntaxOn
tl_new:N l_rn_Aux_tl
NewDocumentCommandmyStrCaseOemphm
str_case:nnTF #1
emphtextit#2
Emphtextbftextit#2
ulineunderline#2
!~ERROR:~parameter~#1~=~#1~invalid
% myStrCase
NewDocumentCommandmyTlCaseOemphm
tl_set:Nx l_rn_Aux_tl #1
checking~what~was~passed:~l_rn_Aux_tl \
tl_case:NnTF l_rn_Aux_tl
emph textit#2
Emph textbftextit#2
uline underline#2
parameter~#1~=~#1~valid
!~ERROR:~parameter~#1~=~#1~invalid
% myTlCase
ExplSyntaxOff
%-----------------------
begindocument
subsectionusing str_case:
myStrCaseHi There\
myStrCase[emph]Hi There\
myStrCase[Emph]Hi There\
myStrCase[uline]Hi There\
myStrCase[xxx]Hi There
subsectionusing tl_case:
myTlCase[emph]Hi There\
myTlCase[xxx]Hi There
enddocument
expl3
When using document command arguments for case distinctions I routinely have been using the str_case:nn
function, which works fine as is evident from the output of the myStrCase
command. When attempting to use the tl_case:Nn
function instead, by loading the argument into a _tl
type variable, things go miserably wrong. The variable seems to be loaded with the correct value, and is then flagged as correct as far as the tl_case:Nn
function is concerned, but the corresponding code is not executed. Why?
documentclassarticle
%=======================
usepackage[check-declarations,log-functions]expl3
usepackagexparse
%-----------------------
ExplSyntaxOn
tl_new:N l_rn_Aux_tl
NewDocumentCommandmyStrCaseOemphm
str_case:nnTF #1
emphtextit#2
Emphtextbftextit#2
ulineunderline#2
!~ERROR:~parameter~#1~=~#1~invalid
% myStrCase
NewDocumentCommandmyTlCaseOemphm
tl_set:Nx l_rn_Aux_tl #1
checking~what~was~passed:~l_rn_Aux_tl \
tl_case:NnTF l_rn_Aux_tl
emph textit#2
Emph textbftextit#2
uline underline#2
parameter~#1~=~#1~valid
!~ERROR:~parameter~#1~=~#1~invalid
% myTlCase
ExplSyntaxOff
%-----------------------
begindocument
subsectionusing str_case:
myStrCaseHi There\
myStrCase[emph]Hi There\
myStrCase[Emph]Hi There\
myStrCase[uline]Hi There\
myStrCase[xxx]Hi There
subsectionusing tl_case:
myTlCase[emph]Hi There\
myTlCase[xxx]Hi There
enddocument
expl3
expl3
asked 1 hour ago
Reinhard Neuwirth
1,38411320
1,38411320
add a comment |Â
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
4
down vote
accepted
The documentation (interface3) already contains your answer:
tl_case:NnTF <test token list variable>
<token list variable case1> <code case1>
<token list variable case2> <code case2>
...
<token list variable casen> <code casen>
<true code>
<false code>
You will find "token list variable" and not "token list" therein. Hence you are asked to provide one token (a variable/N-type argument). So to use this construction you would need to save your options into variables and use these within tl_case
.
add a comment |Â
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
4
down vote
accepted
The documentation (interface3) already contains your answer:
tl_case:NnTF <test token list variable>
<token list variable case1> <code case1>
<token list variable case2> <code case2>
...
<token list variable casen> <code casen>
<true code>
<false code>
You will find "token list variable" and not "token list" therein. Hence you are asked to provide one token (a variable/N-type argument). So to use this construction you would need to save your options into variables and use these within tl_case
.
add a comment |Â
up vote
4
down vote
accepted
The documentation (interface3) already contains your answer:
tl_case:NnTF <test token list variable>
<token list variable case1> <code case1>
<token list variable case2> <code case2>
...
<token list variable casen> <code casen>
<true code>
<false code>
You will find "token list variable" and not "token list" therein. Hence you are asked to provide one token (a variable/N-type argument). So to use this construction you would need to save your options into variables and use these within tl_case
.
add a comment |Â
up vote
4
down vote
accepted
up vote
4
down vote
accepted
The documentation (interface3) already contains your answer:
tl_case:NnTF <test token list variable>
<token list variable case1> <code case1>
<token list variable case2> <code case2>
...
<token list variable casen> <code casen>
<true code>
<false code>
You will find "token list variable" and not "token list" therein. Hence you are asked to provide one token (a variable/N-type argument). So to use this construction you would need to save your options into variables and use these within tl_case
.
The documentation (interface3) already contains your answer:
tl_case:NnTF <test token list variable>
<token list variable case1> <code case1>
<token list variable case2> <code case2>
...
<token list variable casen> <code casen>
<true code>
<false code>
You will find "token list variable" and not "token list" therein. Hence you are asked to provide one token (a variable/N-type argument). So to use this construction you would need to save your options into variables and use these within tl_case
.
answered 1 hour ago
TeXnician
22.5k52984
22.5k52984
add a comment |Â
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f456332%2fwhat-is-it-i-am-doing-wrong-using-tl-casenn%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password