Protected expansion in expl3












3














I am trying to understand whether there is a proper expl3 way to achieve the same result as the latex2e protected@edef, that is expanding a token list while respecting the protect mechanism of latex2e.



Using expl3 functions with an "x" type argument (e.g. tl_gset:Nx) seems to expand everything ignoring the latex2e protection mechanism.



I seem to be able to achieve the desired goal by manually replicating the mechanisms applied by protected@edef, that is by doing a tl_set:Nn protect { noexpandprotectnoexpand } right before the "x" expansion (e.g., before the tl_gset:Nx), but I wonder if this is the preferred method or if there are more elegant alternatives.










share|improve this question



























    3














    I am trying to understand whether there is a proper expl3 way to achieve the same result as the latex2e protected@edef, that is expanding a token list while respecting the protect mechanism of latex2e.



    Using expl3 functions with an "x" type argument (e.g. tl_gset:Nx) seems to expand everything ignoring the latex2e protection mechanism.



    I seem to be able to achieve the desired goal by manually replicating the mechanisms applied by protected@edef, that is by doing a tl_set:Nn protect { noexpandprotectnoexpand } right before the "x" expansion (e.g., before the tl_gset:Nx), but I wonder if this is the preferred method or if there are more elegant alternatives.










    share|improve this question

























      3












      3








      3







      I am trying to understand whether there is a proper expl3 way to achieve the same result as the latex2e protected@edef, that is expanding a token list while respecting the protect mechanism of latex2e.



      Using expl3 functions with an "x" type argument (e.g. tl_gset:Nx) seems to expand everything ignoring the latex2e protection mechanism.



      I seem to be able to achieve the desired goal by manually replicating the mechanisms applied by protected@edef, that is by doing a tl_set:Nn protect { noexpandprotectnoexpand } right before the "x" expansion (e.g., before the tl_gset:Nx), but I wonder if this is the preferred method or if there are more elegant alternatives.










      share|improve this question













      I am trying to understand whether there is a proper expl3 way to achieve the same result as the latex2e protected@edef, that is expanding a token list while respecting the protect mechanism of latex2e.



      Using expl3 functions with an "x" type argument (e.g. tl_gset:Nx) seems to expand everything ignoring the latex2e protection mechanism.



      I seem to be able to achieve the desired goal by manually replicating the mechanisms applied by protected@edef, that is by doing a tl_set:Nn protect { noexpandprotectnoexpand } right before the "x" expansion (e.g., before the tl_gset:Nx), but I wonder if this is the preferred method or if there are more elegant alternatives.







      expl3






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked 54 mins ago









      Callegar

      811




      811






















          1 Answer
          1






          active

          oldest

          votes


















          3














          There is no equivalent of protected@edef in expl3 as 'native' expl3 material is either fully expandable or engine-protected. As such, if you do need to take mixed LaTeX2e input and use it in expl3, you'll need to stick to the LaTeX2e mechanism



          protected@edef l_tmpa_tl { <stuff> }





          share|improve this answer























          • There is a t missing, this is probably a mistake? (I'm not sure since expl3 still looks like alien wizardry to me most of the time...)
            – Marijn
            10 mins ago











          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',
          autoActivateHeartbeat: false,
          convertImagesToLinks: false,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          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%2f467329%2fprotected-expansion-in-expl3%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          3














          There is no equivalent of protected@edef in expl3 as 'native' expl3 material is either fully expandable or engine-protected. As such, if you do need to take mixed LaTeX2e input and use it in expl3, you'll need to stick to the LaTeX2e mechanism



          protected@edef l_tmpa_tl { <stuff> }





          share|improve this answer























          • There is a t missing, this is probably a mistake? (I'm not sure since expl3 still looks like alien wizardry to me most of the time...)
            – Marijn
            10 mins ago
















          3














          There is no equivalent of protected@edef in expl3 as 'native' expl3 material is either fully expandable or engine-protected. As such, if you do need to take mixed LaTeX2e input and use it in expl3, you'll need to stick to the LaTeX2e mechanism



          protected@edef l_tmpa_tl { <stuff> }





          share|improve this answer























          • There is a t missing, this is probably a mistake? (I'm not sure since expl3 still looks like alien wizardry to me most of the time...)
            – Marijn
            10 mins ago














          3












          3








          3






          There is no equivalent of protected@edef in expl3 as 'native' expl3 material is either fully expandable or engine-protected. As such, if you do need to take mixed LaTeX2e input and use it in expl3, you'll need to stick to the LaTeX2e mechanism



          protected@edef l_tmpa_tl { <stuff> }





          share|improve this answer














          There is no equivalent of protected@edef in expl3 as 'native' expl3 material is either fully expandable or engine-protected. As such, if you do need to take mixed LaTeX2e input and use it in expl3, you'll need to stick to the LaTeX2e mechanism



          protected@edef l_tmpa_tl { <stuff> }






          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited 5 mins ago

























          answered 44 mins ago









          Joseph Wright

          202k21554880




          202k21554880












          • There is a t missing, this is probably a mistake? (I'm not sure since expl3 still looks like alien wizardry to me most of the time...)
            – Marijn
            10 mins ago


















          • There is a t missing, this is probably a mistake? (I'm not sure since expl3 still looks like alien wizardry to me most of the time...)
            – Marijn
            10 mins ago
















          There is a t missing, this is probably a mistake? (I'm not sure since expl3 still looks like alien wizardry to me most of the time...)
          – Marijn
          10 mins ago




          There is a t missing, this is probably a mistake? (I'm not sure since expl3 still looks like alien wizardry to me most of the time...)
          – Marijn
          10 mins ago


















          draft saved

          draft discarded




















































          Thanks for contributing an answer to TeX - LaTeX Stack Exchange!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.





          Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


          Please pay close attention to the following guidance:


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f467329%2fprotected-expansion-in-expl3%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          404 Error Contact Form 7 ajax form submitting

          How to know if a Active Directory user can login interactively

          Refactoring coordinates for Minecraft Pi buildings written in Python