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
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
add a comment |
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
add a comment |
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
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
tex-core conditionals expansion
asked May 11 at 13:28
Phelype OleinikPhelype Oleinik
27.5k54793
27.5k54793
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
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
.
Hm, cool, it's a type of safety. It's easy to see therelax
es appearing withunravelexpandafteriffi
(I actually saw it earlier, but it didn't make sense). Thanks :-)
– Phelype Oleinik
May 11 at 13:48
add a comment |
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
);
);
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
Required, but never shown
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
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
.
Hm, cool, it's a type of safety. It's easy to see therelax
es appearing withunravelexpandafteriffi
(I actually saw it earlier, but it didn't make sense). Thanks :-)
– Phelype Oleinik
May 11 at 13:48
add a comment |
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
.
Hm, cool, it's a type of safety. It's easy to see therelax
es appearing withunravelexpandafteriffi
(I actually saw it earlier, but it didn't make sense). Thanks :-)
– Phelype Oleinik
May 11 at 13:48
add a comment |
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
.
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
.
answered May 11 at 13:36
egregegreg
741k8919423274
741k8919423274
Hm, cool, it's a type of safety. It's easy to see therelax
es appearing withunravelexpandafteriffi
(I actually saw it earlier, but it didn't make sense). Thanks :-)
– Phelype Oleinik
May 11 at 13:48
add a comment |
Hm, cool, it's a type of safety. It's easy to see therelax
es appearing withunravelexpandafteriffi
(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
relax
es 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
relax
es appearing with unravelexpandafteriffi
(I actually saw it earlier, but it didn't make sense). Thanks :-)– Phelype Oleinik
May 11 at 13:48
add a comment |
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.
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
Required, but never shown
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
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
Required, but never shown
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
Required, but never shown
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
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