What is it I am doing wrong using `tl_case:Nn …`?

The name of the pictureThe name of the pictureThe name of the pictureClash 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









share|improve this question

























    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









    share|improve this question























      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









      share|improve this question













      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






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked 1 hour ago









      Reinhard Neuwirth

      1,38411320




      1,38411320




















          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.






          share|improve this answer




















            Your Answer







            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "85"
            ;
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function()
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled)
            StackExchange.using("snippets", function()
            createEditor();
            );

            else
            createEditor();

            );

            function createEditor()
            StackExchange.prepareEditor(
            heartbeatType: 'answer',
            convertImagesToLinks: false,
            noModals: false,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: null,
            bindNavPrevention: true,
            postfix: "",
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            );



            );













             

            draft saved


            draft discarded


















            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






























            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.






            share|improve this answer
























              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.






              share|improve this answer






















                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.






                share|improve this answer












                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.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered 1 hour ago









                TeXnician

                22.5k52984




                22.5k52984



























                     

                    draft saved


                    draft discarded















































                     


                    draft saved


                    draft discarded














                    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













































































                    Popular posts from this blog

                    How to check contact read email or not when send email to Individual?

                    Displaying single band from multi-band raster using QGIS

                    How many registers does an x86_64 CPU actually have?