Expansion of ifnum creates a weird relax tokenExpansion of first token in a tabular cellExpansion in numexpr…relax versus pdfstrcmpNormal relax vs. frozen relaxWhat is wrong with ifnum#1=0.09relax?Use of relax after ifnum … fi constructionIs implicit `relax` in conditionals explained anywhere in the TeXbook?Understanding token expansionweird ifnum with compact syntaxifnum and expansion of macro argumentifx doesn't treat noexpand as relax

How can I safely determine the output voltage and current of a transformer?

301 Redirects what does ([a-z]+)-(.*) and ([0-9]+)-(.*) mean

"Counterexample" for the Inverse function theorem

Is there any deeper thematic meaning to the white horse that Arya finds in The Bells (S08E05)?

Do high-wing aircraft represent more difficult engineering challenges than low-wing aircraft?

Can a person still be an Orthodox Jew and believe that the Torah contains narratives that are not scientifically correct?

Usage of the relative pronoun "dont"

​Cuban​ ​Primes

Failing students when it might cause them economic ruin

Why can't I share a one use code with anyone else?

How does the Heat Metal spell interact with a follow-up Frostbite spell?

What would a Dragon have to exhale to cause rain?

Pedaling at different gear ratios on flat terrain: what's the point?

SHAKE-128/256 or SHA3-256/512

Do we see some Unsullied doing this in S08E05?

Have there been any examples of re-usable rockets in the past?

Resistor Selection to retain same brightness in LED PWM circuit

Given 0s on Assignments with suspected and dismissed cheating?

Is it standard for US-based universities to consider the ethnicity of an applicant during PhD admissions?

Single word that parallels "Recent" when discussing the near future

What kind of action are dodge and disengage?

Why is the A380’s with-reversers stopping distance the same as its no-reversers stopping distance?

Why does the U.S military use mercenaries?

Polynomial division: Is this trick obvious?



Expansion of ifnum creates a weird relax token


Expansion of first token in a tabular cellExpansion in numexpr…relax versus pdfstrcmpNormal relax vs. frozen relaxWhat is wrong with ifnum#1=0.09relax?Use of relax after ifnum … fi constructionIs implicit `relax` in conditionals explained anywhere in the TeXbook?Understanding token expansionweird ifnum with compact syntaxifnum and expansion of macro argumentifx doesn't treat noexpand as relax













5















There was I, procrastinating over some TeX code while I should have been writing my dissertation. The code was working more or less fine (better than the writing, at least), until a mysterious relax popped up from nowhere!



At first I though it was something stupid from my end, but when I reduced the code to a bare minimum I realised I had no idea what was going on. I reduced the code to use basically only primitives, so it shouldn't be any coding problem. Here's the guilty code:



defuseIInnn#1#2#3#2
defuseIInn#1#2#2
detokenizeexpandafterifnum0=0expandafteruseIInnnfiuseIInn1BOOM
bye


and its output is (surprisingly, for me):



relax fi 1BOOM 


Where did that relax come from?




I realise that the test wouldn't result in 0=0 because ifnum would continue expanding tokens (as far as I understand, it would make 0=01 and result false; I corrected this in the code :). However the relax remains a mystery for me.










share|improve this question


























    5















    There was I, procrastinating over some TeX code while I should have been writing my dissertation. The code was working more or less fine (better than the writing, at least), until a mysterious relax popped up from nowhere!



    At first I though it was something stupid from my end, but when I reduced the code to a bare minimum I realised I had no idea what was going on. I reduced the code to use basically only primitives, so it shouldn't be any coding problem. Here's the guilty code:



    defuseIInnn#1#2#3#2
    defuseIInn#1#2#2
    detokenizeexpandafterifnum0=0expandafteruseIInnnfiuseIInn1BOOM
    bye


    and its output is (surprisingly, for me):



    relax fi 1BOOM 


    Where did that relax come from?




    I realise that the test wouldn't result in 0=0 because ifnum would continue expanding tokens (as far as I understand, it would make 0=01 and result false; I corrected this in the code :). However the relax remains a mystery for me.










    share|improve this question
























      5












      5








      5








      There was I, procrastinating over some TeX code while I should have been writing my dissertation. The code was working more or less fine (better than the writing, at least), until a mysterious relax popped up from nowhere!



      At first I though it was something stupid from my end, but when I reduced the code to a bare minimum I realised I had no idea what was going on. I reduced the code to use basically only primitives, so it shouldn't be any coding problem. Here's the guilty code:



      defuseIInnn#1#2#3#2
      defuseIInn#1#2#2
      detokenizeexpandafterifnum0=0expandafteruseIInnnfiuseIInn1BOOM
      bye


      and its output is (surprisingly, for me):



      relax fi 1BOOM 


      Where did that relax come from?




      I realise that the test wouldn't result in 0=0 because ifnum would continue expanding tokens (as far as I understand, it would make 0=01 and result false; I corrected this in the code :). However the relax remains a mystery for me.










      share|improve this question














      There was I, procrastinating over some TeX code while I should have been writing my dissertation. The code was working more or less fine (better than the writing, at least), until a mysterious relax popped up from nowhere!



      At first I though it was something stupid from my end, but when I reduced the code to a bare minimum I realised I had no idea what was going on. I reduced the code to use basically only primitives, so it shouldn't be any coding problem. Here's the guilty code:



      defuseIInnn#1#2#3#2
      defuseIInn#1#2#2
      detokenizeexpandafterifnum0=0expandafteruseIInnnfiuseIInn1BOOM
      bye


      and its output is (surprisingly, for me):



      relax fi 1BOOM 


      Where did that relax come from?




      I realise that the test wouldn't result in 0=0 because ifnum would continue expanding tokens (as far as I understand, it would make 0=01 and result false; I corrected this in the code :). However the relax remains a mystery for me.







      tex-core conditionals expansion






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked May 11 at 13:28









      Phelype OleinikPhelype Oleinik

      27.5k54793




      27.5k54793




















          1 Answer
          1






          active

          oldest

          votes


















          5














          Let's see what happens. The tokens ifnum0=0 are not a full test, because by rule TeX expands tokens until either finding an unexpandable token that cannot be interpreted as a digit; if this token is a space, it will be swallowed.



          The token following 0 is expandafter, which expands the fi: oh, this means that the conditional has to be evaluated! In such cases, that is, whenever a conditional text is unfinished at the time else or fi appear and have to be expanded, TeX inserts a special relax token, called frozen relax.



          You get a frozen relax also in cases such as if xfi; two in the case of iffi.



          This is module 379 in tex.web.






          share|improve this answer























          • Hm, cool, it's a type of safety. It's easy to see the relaxes appearing with unravelexpandafteriffi (I actually saw it earlier, but it didn't make sense). Thanks :-)

            – Phelype Oleinik
            May 11 at 13:48











          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%2f490324%2fexpansion-of-ifnum-creates-a-weird-relax-token%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









          5














          Let's see what happens. The tokens ifnum0=0 are not a full test, because by rule TeX expands tokens until either finding an unexpandable token that cannot be interpreted as a digit; if this token is a space, it will be swallowed.



          The token following 0 is expandafter, which expands the fi: oh, this means that the conditional has to be evaluated! In such cases, that is, whenever a conditional text is unfinished at the time else or fi appear and have to be expanded, TeX inserts a special relax token, called frozen relax.



          You get a frozen relax also in cases such as if xfi; two in the case of iffi.



          This is module 379 in tex.web.






          share|improve this answer























          • Hm, cool, it's a type of safety. It's easy to see the relaxes appearing with unravelexpandafteriffi (I actually saw it earlier, but it didn't make sense). Thanks :-)

            – Phelype Oleinik
            May 11 at 13:48















          5














          Let's see what happens. The tokens ifnum0=0 are not a full test, because by rule TeX expands tokens until either finding an unexpandable token that cannot be interpreted as a digit; if this token is a space, it will be swallowed.



          The token following 0 is expandafter, which expands the fi: oh, this means that the conditional has to be evaluated! In such cases, that is, whenever a conditional text is unfinished at the time else or fi appear and have to be expanded, TeX inserts a special relax token, called frozen relax.



          You get a frozen relax also in cases such as if xfi; two in the case of iffi.



          This is module 379 in tex.web.






          share|improve this answer























          • Hm, cool, it's a type of safety. It's easy to see the relaxes appearing with unravelexpandafteriffi (I actually saw it earlier, but it didn't make sense). Thanks :-)

            – Phelype Oleinik
            May 11 at 13:48













          5












          5








          5







          Let's see what happens. The tokens ifnum0=0 are not a full test, because by rule TeX expands tokens until either finding an unexpandable token that cannot be interpreted as a digit; if this token is a space, it will be swallowed.



          The token following 0 is expandafter, which expands the fi: oh, this means that the conditional has to be evaluated! In such cases, that is, whenever a conditional text is unfinished at the time else or fi appear and have to be expanded, TeX inserts a special relax token, called frozen relax.



          You get a frozen relax also in cases such as if xfi; two in the case of iffi.



          This is module 379 in tex.web.






          share|improve this answer













          Let's see what happens. The tokens ifnum0=0 are not a full test, because by rule TeX expands tokens until either finding an unexpandable token that cannot be interpreted as a digit; if this token is a space, it will be swallowed.



          The token following 0 is expandafter, which expands the fi: oh, this means that the conditional has to be evaluated! In such cases, that is, whenever a conditional text is unfinished at the time else or fi appear and have to be expanded, TeX inserts a special relax token, called frozen relax.



          You get a frozen relax also in cases such as if xfi; two in the case of iffi.



          This is module 379 in tex.web.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered May 11 at 13:36









          egregegreg

          741k8919423274




          741k8919423274












          • Hm, cool, it's a type of safety. It's easy to see the relaxes appearing with unravelexpandafteriffi (I actually saw it earlier, but it didn't make sense). Thanks :-)

            – Phelype Oleinik
            May 11 at 13:48

















          • Hm, cool, it's a type of safety. It's easy to see the relaxes appearing with unravelexpandafteriffi (I actually saw it earlier, but it didn't make sense). Thanks :-)

            – Phelype Oleinik
            May 11 at 13:48
















          Hm, cool, it's a type of safety. It's easy to see the relaxes appearing with unravelexpandafteriffi (I actually saw it earlier, but it didn't make sense). Thanks :-)

          – Phelype Oleinik
          May 11 at 13:48





          Hm, cool, it's a type of safety. It's easy to see the relaxes appearing with unravelexpandafteriffi (I actually saw it earlier, but it didn't make sense). Thanks :-)

          – Phelype Oleinik
          May 11 at 13:48

















          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.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f490324%2fexpansion-of-ifnum-creates-a-weird-relax-token%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

          Get product attribute by attribute group code in magento 2get product attribute by product attribute group in magento 2Magento 2 Log Bundle Product Data in List Page?How to get all product attribute of a attribute group of Default attribute set?Magento 2.1 Create a filter in the product grid by new attributeMagento 2 : Get Product Attribute values By GroupMagento 2 How to get all existing values for one attributeMagento 2 get custom attribute of a single product inside a pluginMagento 2.3 How to get all the Multi Source Inventory (MSI) locations collection in custom module?Magento2: how to develop rest API to get new productsGet product attribute by attribute group code ( [attribute_group_code] ) in magento 2

          Category:9 (number) SubcategoriesMedia in category "9 (number)"Navigation menuUpload mediaGND ID: 4485639-8Library of Congress authority ID: sh85091979ReasonatorScholiaStatistics

          Magento 2.3: How do i solve this, Not registered handle, on custom form?How can i rewrite TierPrice Block in Magento2magento 2 captcha not rendering if I override layout xmlmain.CRITICAL: Plugin class doesn't existMagento 2 : Problem while adding custom button order view page?Magento 2.2.5: Overriding Admin Controller sales/orderMagento 2.2.5: Add, Update and Delete existing products Custom OptionsMagento 2.3 : File Upload issue in UI Component FormMagento2 Not registered handleHow to configured Form Builder Js in my custom magento 2.3.0 module?Magento 2.3. How to create image upload field in an admin form