Seemingly unused edef prior to an ifx mysteriously affects the outcome of the ifx. Why?Why does this simple ifx test fail?How to display some text based on a condition inside a tabular environment?Macro to do nothing via a defPreserving (and Controlling) ExpandednessWhy does this use of `expandafter` not work?Pre-expansion of moving macro argumentUsing MakeUppercase on expanded macro with argumentDefining an anaphoric macro to define multiple commands based on a templatestoring snapshot of a rapidly changing commandThe laws of expansion (chardeffoo=<number>foo)Why can I not use string to prevent the expansion of csname?

What is monoid homomorphism exactly?

Antivirus for Ubuntu 18.04

Can a player choose to add detail and flavor to their character's spells and abilities?

Is there a reason why Turkey took the Balkan territories of the Ottoman Empire, instead of Greece or another of the Balkan states?

Why does blending blueberries, milk, banana and vanilla extract cause the mixture to have a yogurty consistency?

Which version of the Squat Nimbleness feat is correct?

Copper as an adjective to refer to something made of copper

What detail can Hubble see on Mars?

What happens if I accidentally leave an app running and click "Install Now" in Software Updater?

Do Jedi mind tricks work on Ewoks?

Problem with estimating a sequence with intuition

What does the coin flipping before dying mean?

When did England stop being a Papal fief?

Can an earth elemental drag a tiny creature underground with Earth Glide?

Can an Iranian citizen enter the USA on a Dutch passport?

Why is the blank symbol not considered part of the input alphabet of a Turing machine?

Can a good but unremarkable PhD student become an accomplished professor?

Is it normal for gliders not to have attitude indicators?

Determine if a grid contains another grid

In "Avengers: Endgame", what does this name refer to?

As a GM, is it bad form to ask for a moment to think when improvising?

Is throwing dice a stochastic or a deterministic process?

Emergency stop in plain TeX, pdfTeX, XeTeX and LuaTeX?

What is a common way to tell if an academic is "above average," or outstanding in their field? Is their h-index (Hirsh index) one of them?



Seemingly unused edef prior to an ifx mysteriously affects the outcome of the ifx. Why?


Why does this simple ifx test fail?How to display some text based on a condition inside a tabular environment?Macro to do nothing via a defPreserving (and Controlling) ExpandednessWhy does this use of `expandafter` not work?Pre-expansion of moving macro argumentUsing MakeUppercase on expanded macro with argumentDefining an anaphoric macro to define multiple commands based on a templatestoring snapshot of a rapidly changing commandThe laws of expansion (chardeffoo=<number>foo)Why can I not use string to prevent the expansion of csname?













4















It is my understanding that in ifxxy xx else yy fi, ifx does NOT expand its arguments. If you want ifx to compare the expanded values of x and y, then we need to do the expansion ourselves before feeding them to ifx:



edefxpndXx
edefxpndYy
ifxxpndXxpndY xx else yy fi


asedef does this expansion for us. This is frequently the case when x and y are the arguments in a macro so we really have no idea what kind of quantity they represent.



I was adapting a code snippet I found in user2478's answer to the TeX-SE question Why does this simple ifx test fail? and came up with the following MWE:



documentclassarticle
usepackage[svgnames]xcolor % to get named colors

begindocument

chardefmysteryletter=`H
% loop through A-Z to find out the mystery letter
newcountcurrentchar

currentchar=`A
loop
chardeftemp=thecurrentchar
edeftmptemp%
ifxmysterylettertemp colorRedbftempelsetempfi
advance currentchar by 1
unlessifnum currentchar>90
repeat

enddocument


which, when compiled, generated the output:



enter image description here



which actually is the desired output, but it should NOT have been! I added the statement edeftmptemp to get the 'expanded' version of temp intending to change the temp argument to the ifx command to tmp but had not when this document was compiled. Lo and behold, the desired result was printed out! This lead me to believe that the expansion performed by the edeftmptemp statement was not required, so it was commented out and the document recompiled. This gave the wrong result; the letter H was not bold or red



enter image description here



I note that removing the comment character from the end of the edef command had the expected affect of adding a space between each letter, but did not prevent the 'H' from being found and highlighted.



So my question is this: How does the unused expansion of temp by the edef statement change the comparison performed by the ifx command? What am I missing here?










share|improve this question
























  • "Lo and behold", not "low and behold"

    – Hammerite
    Apr 27 at 22:25











  • @Hammerite: Thanks, I stand corrected.

    – OneMug
    Apr 28 at 4:20






  • 1





    chardeftemp=thecurrentchar should always be chardeftemp=currentchar. There's no point in using the (besides the desire of seeing your code break loose).

    – egreg
    Apr 28 at 11:14











  • @egreg: Very true, but such things are not always bad things when it leads to new insight. Thanks for the comment.

    – OneMug
    Apr 28 at 14:48















4















It is my understanding that in ifxxy xx else yy fi, ifx does NOT expand its arguments. If you want ifx to compare the expanded values of x and y, then we need to do the expansion ourselves before feeding them to ifx:



edefxpndXx
edefxpndYy
ifxxpndXxpndY xx else yy fi


asedef does this expansion for us. This is frequently the case when x and y are the arguments in a macro so we really have no idea what kind of quantity they represent.



I was adapting a code snippet I found in user2478's answer to the TeX-SE question Why does this simple ifx test fail? and came up with the following MWE:



documentclassarticle
usepackage[svgnames]xcolor % to get named colors

begindocument

chardefmysteryletter=`H
% loop through A-Z to find out the mystery letter
newcountcurrentchar

currentchar=`A
loop
chardeftemp=thecurrentchar
edeftmptemp%
ifxmysterylettertemp colorRedbftempelsetempfi
advance currentchar by 1
unlessifnum currentchar>90
repeat

enddocument


which, when compiled, generated the output:



enter image description here



which actually is the desired output, but it should NOT have been! I added the statement edeftmptemp to get the 'expanded' version of temp intending to change the temp argument to the ifx command to tmp but had not when this document was compiled. Lo and behold, the desired result was printed out! This lead me to believe that the expansion performed by the edeftmptemp statement was not required, so it was commented out and the document recompiled. This gave the wrong result; the letter H was not bold or red



enter image description here



I note that removing the comment character from the end of the edef command had the expected affect of adding a space between each letter, but did not prevent the 'H' from being found and highlighted.



So my question is this: How does the unused expansion of temp by the edef statement change the comparison performed by the ifx command? What am I missing here?










share|improve this question
























  • "Lo and behold", not "low and behold"

    – Hammerite
    Apr 27 at 22:25











  • @Hammerite: Thanks, I stand corrected.

    – OneMug
    Apr 28 at 4:20






  • 1





    chardeftemp=thecurrentchar should always be chardeftemp=currentchar. There's no point in using the (besides the desire of seeing your code break loose).

    – egreg
    Apr 28 at 11:14











  • @egreg: Very true, but such things are not always bad things when it leads to new insight. Thanks for the comment.

    – OneMug
    Apr 28 at 14:48













4












4








4


1






It is my understanding that in ifxxy xx else yy fi, ifx does NOT expand its arguments. If you want ifx to compare the expanded values of x and y, then we need to do the expansion ourselves before feeding them to ifx:



edefxpndXx
edefxpndYy
ifxxpndXxpndY xx else yy fi


asedef does this expansion for us. This is frequently the case when x and y are the arguments in a macro so we really have no idea what kind of quantity they represent.



I was adapting a code snippet I found in user2478's answer to the TeX-SE question Why does this simple ifx test fail? and came up with the following MWE:



documentclassarticle
usepackage[svgnames]xcolor % to get named colors

begindocument

chardefmysteryletter=`H
% loop through A-Z to find out the mystery letter
newcountcurrentchar

currentchar=`A
loop
chardeftemp=thecurrentchar
edeftmptemp%
ifxmysterylettertemp colorRedbftempelsetempfi
advance currentchar by 1
unlessifnum currentchar>90
repeat

enddocument


which, when compiled, generated the output:



enter image description here



which actually is the desired output, but it should NOT have been! I added the statement edeftmptemp to get the 'expanded' version of temp intending to change the temp argument to the ifx command to tmp but had not when this document was compiled. Lo and behold, the desired result was printed out! This lead me to believe that the expansion performed by the edeftmptemp statement was not required, so it was commented out and the document recompiled. This gave the wrong result; the letter H was not bold or red



enter image description here



I note that removing the comment character from the end of the edef command had the expected affect of adding a space between each letter, but did not prevent the 'H' from being found and highlighted.



So my question is this: How does the unused expansion of temp by the edef statement change the comparison performed by the ifx command? What am I missing here?










share|improve this question
















It is my understanding that in ifxxy xx else yy fi, ifx does NOT expand its arguments. If you want ifx to compare the expanded values of x and y, then we need to do the expansion ourselves before feeding them to ifx:



edefxpndXx
edefxpndYy
ifxxpndXxpndY xx else yy fi


asedef does this expansion for us. This is frequently the case when x and y are the arguments in a macro so we really have no idea what kind of quantity they represent.



I was adapting a code snippet I found in user2478's answer to the TeX-SE question Why does this simple ifx test fail? and came up with the following MWE:



documentclassarticle
usepackage[svgnames]xcolor % to get named colors

begindocument

chardefmysteryletter=`H
% loop through A-Z to find out the mystery letter
newcountcurrentchar

currentchar=`A
loop
chardeftemp=thecurrentchar
edeftmptemp%
ifxmysterylettertemp colorRedbftempelsetempfi
advance currentchar by 1
unlessifnum currentchar>90
repeat

enddocument


which, when compiled, generated the output:



enter image description here



which actually is the desired output, but it should NOT have been! I added the statement edeftmptemp to get the 'expanded' version of temp intending to change the temp argument to the ifx command to tmp but had not when this document was compiled. Lo and behold, the desired result was printed out! This lead me to believe that the expansion performed by the edeftmptemp statement was not required, so it was commented out and the document recompiled. This gave the wrong result; the letter H was not bold or red



enter image description here



I note that removing the comment character from the end of the edef command had the expected affect of adding a space between each letter, but did not prevent the 'H' from being found and highlighted.



So my question is this: How does the unused expansion of temp by the edef statement change the comparison performed by the ifx command? What am I missing here?







macros conditionals expansion






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Apr 28 at 4:20







OneMug

















asked Apr 27 at 16:22









OneMugOneMug

236




236












  • "Lo and behold", not "low and behold"

    – Hammerite
    Apr 27 at 22:25











  • @Hammerite: Thanks, I stand corrected.

    – OneMug
    Apr 28 at 4:20






  • 1





    chardeftemp=thecurrentchar should always be chardeftemp=currentchar. There's no point in using the (besides the desire of seeing your code break loose).

    – egreg
    Apr 28 at 11:14











  • @egreg: Very true, but such things are not always bad things when it leads to new insight. Thanks for the comment.

    – OneMug
    Apr 28 at 14:48

















  • "Lo and behold", not "low and behold"

    – Hammerite
    Apr 27 at 22:25











  • @Hammerite: Thanks, I stand corrected.

    – OneMug
    Apr 28 at 4:20






  • 1





    chardeftemp=thecurrentchar should always be chardeftemp=currentchar. There's no point in using the (besides the desire of seeing your code break loose).

    – egreg
    Apr 28 at 11:14











  • @egreg: Very true, but such things are not always bad things when it leads to new insight. Thanks for the comment.

    – OneMug
    Apr 28 at 14:48
















"Lo and behold", not "low and behold"

– Hammerite
Apr 27 at 22:25





"Lo and behold", not "low and behold"

– Hammerite
Apr 27 at 22:25













@Hammerite: Thanks, I stand corrected.

– OneMug
Apr 28 at 4:20





@Hammerite: Thanks, I stand corrected.

– OneMug
Apr 28 at 4:20




1




1





chardeftemp=thecurrentchar should always be chardeftemp=currentchar. There's no point in using the (besides the desire of seeing your code break loose).

– egreg
Apr 28 at 11:14





chardeftemp=thecurrentchar should always be chardeftemp=currentchar. There's no point in using the (besides the desire of seeing your code break loose).

– egreg
Apr 28 at 11:14













@egreg: Very true, but such things are not always bad things when it leads to new insight. Thanks for the comment.

– OneMug
Apr 28 at 14:48





@egreg: Very true, but such things are not always bad things when it leads to new insight. Thanks for the comment.

– OneMug
Apr 28 at 14:48










1 Answer
1






active

oldest

votes


















8














 chardeftemp=thecurrentchar
edeftmptemp%


tokens defined via chardef are not expandable, so edeftmptemp is the same as deftmptemp



It is not clear why you do not expect ifxmysterylettertemp not to be true if the two tokens are both defined via chardef with the same number?



I guess your modified version was equivalent to



 chardeftemp=thecurrentchar
ifxmysterylettertemp


There the ifx test happens before the assignment while looking to end the number, you need



 chardeftemp=thecurrentcharrelax
ifxmysterylettertemp


or



 chardeftemp=currentchar
ifxmysterylettertemp


So your edef was just acting like relax terminating the chardef assignment.






share|improve this answer

























  • Thanks for the fast response. Still trying to figure out how to use the TeX-SE question and comment editors, please be patient. I had planned on converting this snippet into a defscanAlpha#1{... so I coded it the way I did expecting the macro argument to be used in the ifx to be somewhat unknown at execution time, say be using scanAlphaX which would make the argument to the ifx different from using the chardef as in the snippet.

    – OneMug
    Apr 27 at 16:58











  • As stated, removing the edef and using either chardeftemp=thecurrentcharrelax or chardeftemp=currentchar works just fine. Aah, such are the mysteries of relaxing. Not sure if I will ever figure out how to relax. Thanks again for this answer.

    – OneMug
    Apr 27 at 17:19







  • 3





    @OneMugit'its not really the relax just that expansion happens when looking for a number, count0=1ifx ab 2else 3fi sets count0 to 13 with the ifx test happening before the assignment, but count0=1 ifx ab 2else 3fi sets count0 to 1

    – David Carlisle
    Apr 27 at 17:32












  • Thanks for this illustration. I had not realized that a numeric assignment was so 'aggressive'. I take it that this expansion would continue even farther if that expansion kept producing more numbers, that is, continue until a non-number token was encountered, right? One other issue here, the assignment in your example generates a decimal number. Is it possible to generate numbers in other bases, hexadecimal for instance?

    – OneMug
    Apr 28 at 14:24











  • After some reflection about how ifx expands its arguments, it seems that the statement I made in my question that `` ifx does NOT expand its arguments'' is not strictly correct, as it must surely expand them at least once if that argument is a control sequence. Is that correct?

    – OneMug
    Apr 28 at 14:41











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%2f487937%2fseemingly-unused-edef-prior-to-an-ifx-mysteriously-affects-the-outcome-of-the%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









8














 chardeftemp=thecurrentchar
edeftmptemp%


tokens defined via chardef are not expandable, so edeftmptemp is the same as deftmptemp



It is not clear why you do not expect ifxmysterylettertemp not to be true if the two tokens are both defined via chardef with the same number?



I guess your modified version was equivalent to



 chardeftemp=thecurrentchar
ifxmysterylettertemp


There the ifx test happens before the assignment while looking to end the number, you need



 chardeftemp=thecurrentcharrelax
ifxmysterylettertemp


or



 chardeftemp=currentchar
ifxmysterylettertemp


So your edef was just acting like relax terminating the chardef assignment.






share|improve this answer

























  • Thanks for the fast response. Still trying to figure out how to use the TeX-SE question and comment editors, please be patient. I had planned on converting this snippet into a defscanAlpha#1{... so I coded it the way I did expecting the macro argument to be used in the ifx to be somewhat unknown at execution time, say be using scanAlphaX which would make the argument to the ifx different from using the chardef as in the snippet.

    – OneMug
    Apr 27 at 16:58











  • As stated, removing the edef and using either chardeftemp=thecurrentcharrelax or chardeftemp=currentchar works just fine. Aah, such are the mysteries of relaxing. Not sure if I will ever figure out how to relax. Thanks again for this answer.

    – OneMug
    Apr 27 at 17:19







  • 3





    @OneMugit'its not really the relax just that expansion happens when looking for a number, count0=1ifx ab 2else 3fi sets count0 to 13 with the ifx test happening before the assignment, but count0=1 ifx ab 2else 3fi sets count0 to 1

    – David Carlisle
    Apr 27 at 17:32












  • Thanks for this illustration. I had not realized that a numeric assignment was so 'aggressive'. I take it that this expansion would continue even farther if that expansion kept producing more numbers, that is, continue until a non-number token was encountered, right? One other issue here, the assignment in your example generates a decimal number. Is it possible to generate numbers in other bases, hexadecimal for instance?

    – OneMug
    Apr 28 at 14:24











  • After some reflection about how ifx expands its arguments, it seems that the statement I made in my question that `` ifx does NOT expand its arguments'' is not strictly correct, as it must surely expand them at least once if that argument is a control sequence. Is that correct?

    – OneMug
    Apr 28 at 14:41















8














 chardeftemp=thecurrentchar
edeftmptemp%


tokens defined via chardef are not expandable, so edeftmptemp is the same as deftmptemp



It is not clear why you do not expect ifxmysterylettertemp not to be true if the two tokens are both defined via chardef with the same number?



I guess your modified version was equivalent to



 chardeftemp=thecurrentchar
ifxmysterylettertemp


There the ifx test happens before the assignment while looking to end the number, you need



 chardeftemp=thecurrentcharrelax
ifxmysterylettertemp


or



 chardeftemp=currentchar
ifxmysterylettertemp


So your edef was just acting like relax terminating the chardef assignment.






share|improve this answer

























  • Thanks for the fast response. Still trying to figure out how to use the TeX-SE question and comment editors, please be patient. I had planned on converting this snippet into a defscanAlpha#1{... so I coded it the way I did expecting the macro argument to be used in the ifx to be somewhat unknown at execution time, say be using scanAlphaX which would make the argument to the ifx different from using the chardef as in the snippet.

    – OneMug
    Apr 27 at 16:58











  • As stated, removing the edef and using either chardeftemp=thecurrentcharrelax or chardeftemp=currentchar works just fine. Aah, such are the mysteries of relaxing. Not sure if I will ever figure out how to relax. Thanks again for this answer.

    – OneMug
    Apr 27 at 17:19







  • 3





    @OneMugit'its not really the relax just that expansion happens when looking for a number, count0=1ifx ab 2else 3fi sets count0 to 13 with the ifx test happening before the assignment, but count0=1 ifx ab 2else 3fi sets count0 to 1

    – David Carlisle
    Apr 27 at 17:32












  • Thanks for this illustration. I had not realized that a numeric assignment was so 'aggressive'. I take it that this expansion would continue even farther if that expansion kept producing more numbers, that is, continue until a non-number token was encountered, right? One other issue here, the assignment in your example generates a decimal number. Is it possible to generate numbers in other bases, hexadecimal for instance?

    – OneMug
    Apr 28 at 14:24











  • After some reflection about how ifx expands its arguments, it seems that the statement I made in my question that `` ifx does NOT expand its arguments'' is not strictly correct, as it must surely expand them at least once if that argument is a control sequence. Is that correct?

    – OneMug
    Apr 28 at 14:41













8












8








8







 chardeftemp=thecurrentchar
edeftmptemp%


tokens defined via chardef are not expandable, so edeftmptemp is the same as deftmptemp



It is not clear why you do not expect ifxmysterylettertemp not to be true if the two tokens are both defined via chardef with the same number?



I guess your modified version was equivalent to



 chardeftemp=thecurrentchar
ifxmysterylettertemp


There the ifx test happens before the assignment while looking to end the number, you need



 chardeftemp=thecurrentcharrelax
ifxmysterylettertemp


or



 chardeftemp=currentchar
ifxmysterylettertemp


So your edef was just acting like relax terminating the chardef assignment.






share|improve this answer















 chardeftemp=thecurrentchar
edeftmptemp%


tokens defined via chardef are not expandable, so edeftmptemp is the same as deftmptemp



It is not clear why you do not expect ifxmysterylettertemp not to be true if the two tokens are both defined via chardef with the same number?



I guess your modified version was equivalent to



 chardeftemp=thecurrentchar
ifxmysterylettertemp


There the ifx test happens before the assignment while looking to end the number, you need



 chardeftemp=thecurrentcharrelax
ifxmysterylettertemp


or



 chardeftemp=currentchar
ifxmysterylettertemp


So your edef was just acting like relax terminating the chardef assignment.







share|improve this answer














share|improve this answer



share|improve this answer








edited Apr 27 at 16:33

























answered Apr 27 at 16:25









David CarlisleDavid Carlisle

503k4211501901




503k4211501901












  • Thanks for the fast response. Still trying to figure out how to use the TeX-SE question and comment editors, please be patient. I had planned on converting this snippet into a defscanAlpha#1{... so I coded it the way I did expecting the macro argument to be used in the ifx to be somewhat unknown at execution time, say be using scanAlphaX which would make the argument to the ifx different from using the chardef as in the snippet.

    – OneMug
    Apr 27 at 16:58











  • As stated, removing the edef and using either chardeftemp=thecurrentcharrelax or chardeftemp=currentchar works just fine. Aah, such are the mysteries of relaxing. Not sure if I will ever figure out how to relax. Thanks again for this answer.

    – OneMug
    Apr 27 at 17:19







  • 3





    @OneMugit'its not really the relax just that expansion happens when looking for a number, count0=1ifx ab 2else 3fi sets count0 to 13 with the ifx test happening before the assignment, but count0=1 ifx ab 2else 3fi sets count0 to 1

    – David Carlisle
    Apr 27 at 17:32












  • Thanks for this illustration. I had not realized that a numeric assignment was so 'aggressive'. I take it that this expansion would continue even farther if that expansion kept producing more numbers, that is, continue until a non-number token was encountered, right? One other issue here, the assignment in your example generates a decimal number. Is it possible to generate numbers in other bases, hexadecimal for instance?

    – OneMug
    Apr 28 at 14:24











  • After some reflection about how ifx expands its arguments, it seems that the statement I made in my question that `` ifx does NOT expand its arguments'' is not strictly correct, as it must surely expand them at least once if that argument is a control sequence. Is that correct?

    – OneMug
    Apr 28 at 14:41

















  • Thanks for the fast response. Still trying to figure out how to use the TeX-SE question and comment editors, please be patient. I had planned on converting this snippet into a defscanAlpha#1{... so I coded it the way I did expecting the macro argument to be used in the ifx to be somewhat unknown at execution time, say be using scanAlphaX which would make the argument to the ifx different from using the chardef as in the snippet.

    – OneMug
    Apr 27 at 16:58











  • As stated, removing the edef and using either chardeftemp=thecurrentcharrelax or chardeftemp=currentchar works just fine. Aah, such are the mysteries of relaxing. Not sure if I will ever figure out how to relax. Thanks again for this answer.

    – OneMug
    Apr 27 at 17:19







  • 3





    @OneMugit'its not really the relax just that expansion happens when looking for a number, count0=1ifx ab 2else 3fi sets count0 to 13 with the ifx test happening before the assignment, but count0=1 ifx ab 2else 3fi sets count0 to 1

    – David Carlisle
    Apr 27 at 17:32












  • Thanks for this illustration. I had not realized that a numeric assignment was so 'aggressive'. I take it that this expansion would continue even farther if that expansion kept producing more numbers, that is, continue until a non-number token was encountered, right? One other issue here, the assignment in your example generates a decimal number. Is it possible to generate numbers in other bases, hexadecimal for instance?

    – OneMug
    Apr 28 at 14:24











  • After some reflection about how ifx expands its arguments, it seems that the statement I made in my question that `` ifx does NOT expand its arguments'' is not strictly correct, as it must surely expand them at least once if that argument is a control sequence. Is that correct?

    – OneMug
    Apr 28 at 14:41
















Thanks for the fast response. Still trying to figure out how to use the TeX-SE question and comment editors, please be patient. I had planned on converting this snippet into a defscanAlpha#1{... so I coded it the way I did expecting the macro argument to be used in the ifx to be somewhat unknown at execution time, say be using scanAlphaX which would make the argument to the ifx different from using the chardef as in the snippet.

– OneMug
Apr 27 at 16:58





Thanks for the fast response. Still trying to figure out how to use the TeX-SE question and comment editors, please be patient. I had planned on converting this snippet into a defscanAlpha#1{... so I coded it the way I did expecting the macro argument to be used in the ifx to be somewhat unknown at execution time, say be using scanAlphaX which would make the argument to the ifx different from using the chardef as in the snippet.

– OneMug
Apr 27 at 16:58













As stated, removing the edef and using either chardeftemp=thecurrentcharrelax or chardeftemp=currentchar works just fine. Aah, such are the mysteries of relaxing. Not sure if I will ever figure out how to relax. Thanks again for this answer.

– OneMug
Apr 27 at 17:19






As stated, removing the edef and using either chardeftemp=thecurrentcharrelax or chardeftemp=currentchar works just fine. Aah, such are the mysteries of relaxing. Not sure if I will ever figure out how to relax. Thanks again for this answer.

– OneMug
Apr 27 at 17:19





3




3





@OneMugit'its not really the relax just that expansion happens when looking for a number, count0=1ifx ab 2else 3fi sets count0 to 13 with the ifx test happening before the assignment, but count0=1 ifx ab 2else 3fi sets count0 to 1

– David Carlisle
Apr 27 at 17:32






@OneMugit'its not really the relax just that expansion happens when looking for a number, count0=1ifx ab 2else 3fi sets count0 to 13 with the ifx test happening before the assignment, but count0=1 ifx ab 2else 3fi sets count0 to 1

– David Carlisle
Apr 27 at 17:32














Thanks for this illustration. I had not realized that a numeric assignment was so 'aggressive'. I take it that this expansion would continue even farther if that expansion kept producing more numbers, that is, continue until a non-number token was encountered, right? One other issue here, the assignment in your example generates a decimal number. Is it possible to generate numbers in other bases, hexadecimal for instance?

– OneMug
Apr 28 at 14:24





Thanks for this illustration. I had not realized that a numeric assignment was so 'aggressive'. I take it that this expansion would continue even farther if that expansion kept producing more numbers, that is, continue until a non-number token was encountered, right? One other issue here, the assignment in your example generates a decimal number. Is it possible to generate numbers in other bases, hexadecimal for instance?

– OneMug
Apr 28 at 14:24













After some reflection about how ifx expands its arguments, it seems that the statement I made in my question that `` ifx does NOT expand its arguments'' is not strictly correct, as it must surely expand them at least once if that argument is a control sequence. Is that correct?

– OneMug
Apr 28 at 14:41





After some reflection about how ifx expands its arguments, it seems that the statement I made in my question that `` ifx does NOT expand its arguments'' is not strictly correct, as it must surely expand them at least once if that argument is a control sequence. Is that correct?

– OneMug
Apr 28 at 14:41

















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%2f487937%2fseemingly-unused-edef-prior-to-an-ifx-mysteriously-affects-the-outcome-of-the%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

Club Baloncesto Breogán Índice Historia | Pavillón | Nome | O Breogán na cultura popular | Xogadores | Adestradores | Presidentes | Palmarés | Historial | Líderes | Notas | Véxase tamén | Menú de navegacióncbbreogan.galCadroGuía oficial da ACB 2009-10, páxina 201Guía oficial ACB 1992, páxina 183. Editorial DB.É de 6.500 espectadores sentados axeitándose á última normativa"Estudiantes Junior, entre as mellores canteiras"o orixinalHemeroteca El Mundo Deportivo, 16 setembro de 1970, páxina 12Historia do BreogánAlfredo Pérez, o último canoneiroHistoria C.B. BreogánHemeroteca de El Mundo DeportivoJimmy Wright, norteamericano do Breogán deixará Lugo por ameazas de morteResultados de Breogán en 1986-87Resultados de Breogán en 1990-91Ficha de Velimir Perasović en acb.comResultados de Breogán en 1994-95Breogán arrasa al Barça. "El Mundo Deportivo", 27 de setembro de 1999, páxina 58CB Breogán - FC BarcelonaA FEB invita a participar nunha nova Liga EuropeaCharlie Bell na prensa estatalMáximos anotadores 2005Tempada 2005-06 : Tódolos Xogadores da Xornada""Non quero pensar nunha man negra, mais pregúntome que está a pasar""o orixinalRaúl López, orgulloso dos xogadores, presume da boa saúde económica do BreogánJulio González confirma que cesa como presidente del BreogánHomenaxe a Lisardo GómezA tempada do rexurdimento celesteEntrevista a Lisardo GómezEl COB dinamita el Pazo para forzar el quinto (69-73)Cafés Candelas, patrocinador del CB Breogán"Suso Lázare, novo presidente do Breogán"o orixinalCafés Candelas Breogán firma el mayor triunfo de la historiaEl Breogán realizará 17 homenajes por su cincuenta aniversario"O Breogán honra ao seu fundador e primeiro presidente"o orixinalMiguel Giao recibiu a homenaxe do PazoHomenaxe aos primeiros gladiadores celestesO home que nos amosa como ver o Breo co corazónTita Franco será homenaxeada polos #50anosdeBreoJulio Vila recibirá unha homenaxe in memoriam polos #50anosdeBreo"O Breogán homenaxeará aos seus aboados máis veteráns"Pechada ovación a «Capi» Sanmartín e Ricardo «Corazón de González»Homenaxe por décadas de informaciónPaco García volve ao Pazo con motivo do 50 aniversario"Resultados y clasificaciones""O Cafés Candelas Breogán, campión da Copa Princesa""O Cafés Candelas Breogán, equipo ACB"C.B. Breogán"Proxecto social"o orixinal"Centros asociados"o orixinalFicha en imdb.comMario Camus trata la recuperación del amor en 'La vieja música', su última película"Páxina web oficial""Club Baloncesto Breogán""C. B. Breogán S.A.D."eehttp://www.fegaba.com

Vilaño, A Laracha Índice Patrimonio | Lugares e parroquias | Véxase tamén | Menú de navegación43°14′52″N 8°36′03″O / 43.24775, -8.60070

Cegueira Índice Epidemioloxía | Deficiencia visual | Tipos de cegueira | Principais causas de cegueira | Tratamento | Técnicas de adaptación e axudas | Vida dos cegos | Primeiros auxilios | Crenzas respecto das persoas cegas | Crenzas das persoas cegas | O neno deficiente visual | Aspectos psicolóxicos da cegueira | Notas | Véxase tamén | Menú de navegación54.054.154.436928256blindnessDicionario da Real Academia GalegaPortal das Palabras"International Standards: Visual Standards — Aspects and Ranges of Vision Loss with Emphasis on Population Surveys.""Visual impairment and blindness""Presentan un plan para previr a cegueira"o orixinalACCDV Associació Catalana de Cecs i Disminuïts Visuals - PMFTrachoma"Effect of gene therapy on visual function in Leber's congenital amaurosis"1844137110.1056/NEJMoa0802268Cans guía - os mellores amigos dos cegosArquivadoEscola de cans guía para cegos en Mortágua, PortugalArquivado"Tecnología para ciegos y deficientes visuales. Recopilación de recursos gratuitos en la Red""Colorino""‘COL.diesis’, escuchar los sonidos del color""COL.diesis: Transforming Colour into Melody and Implementing the Result in a Colour Sensor Device"o orixinal"Sistema de desarrollo de sinestesia color-sonido para invidentes utilizando un protocolo de audio""Enseñanza táctil - geometría y color. Juegos didácticos para niños ciegos y videntes""Sistema Constanz"L'ocupació laboral dels cecs a l'Estat espanyol està pràcticament equiparada a la de les persones amb visió, entrevista amb Pedro ZuritaONCE (Organización Nacional de Cegos de España)Prevención da cegueiraDescrición de deficiencias visuais (Disc@pnet)Braillín, un boneco atractivo para calquera neno, con ou sen discapacidade, que permite familiarizarse co sistema de escritura e lectura brailleAxudas Técnicas36838ID00897494007150-90057129528256DOID:1432HP:0000618D001766C10.597.751.941.162C97109C0155020