Use of noexpand in the implementation of TextOrMath for eTeX
In latexrelease
2015/01/01, there are two implementations of TextOrMath
: one for regular
TeX, the other one for eTeX-like engines (more precisely: those which support protected
). My question concerns the latter:
protectedexpandafterdefcsname TextOrMathspaceendcsname{%
(...) } % no problem here
edefTextOrMath#1#2{% from latex.ltx
expandafternoexpandcsname TextOrMathspaceendcsname
{#1}{#2}}
I think I understand well these definitions, however I can't figure out why the edef
isn't simply written this way:
edefTextOrMath#1#2{% from me
csname TextOrMathspaceendcsname
{#1}{#2}}
Since the internal TextOrMath<space>
macro is protected
, what is the point of preceding it with noexpand
inside the edef
? Is it because the author feared that protected
might be deficient?..
I made a test like this (ran with pdfTeX):
% From latex.ltx (or p. 153 of source2e.pdf)
protectedexpandafterdefcsname TextOrMathspaceendcsname{%
ifmmode expandafter@secondoftwo
else expandafter@firstoftwo fi}
edefTextOrMath#1#2{%
expandafternoexpandcsname TextOrMathspaceendcsname
{#1}{#2}}
% My simpler way of doing the same (?)
edefaltTextOrMath#1#2{%
csname TextOrMathspaceendcsname
{#1}{#2}}
showTextOrMath % TextOrMath=macro:#1#2->TextOrMath {#1}{#2}.
showaltTextOrMath % altTextOrMath=ditto
ifxTextOrMathaltTextOrMath
identical
else
different
fi
vfill
eject
bye
This test prints 'identical' and seems to indicate that my definition is equivalent to the one in latex.ltx (but slightly simpler). Did I miss something?
Thanks!
macros expansion definition protected-macro
add a comment |
In latexrelease
2015/01/01, there are two implementations of TextOrMath
: one for regular
TeX, the other one for eTeX-like engines (more precisely: those which support protected
). My question concerns the latter:
protectedexpandafterdefcsname TextOrMathspaceendcsname{%
(...) } % no problem here
edefTextOrMath#1#2{% from latex.ltx
expandafternoexpandcsname TextOrMathspaceendcsname
{#1}{#2}}
I think I understand well these definitions, however I can't figure out why the edef
isn't simply written this way:
edefTextOrMath#1#2{% from me
csname TextOrMathspaceendcsname
{#1}{#2}}
Since the internal TextOrMath<space>
macro is protected
, what is the point of preceding it with noexpand
inside the edef
? Is it because the author feared that protected
might be deficient?..
I made a test like this (ran with pdfTeX):
% From latex.ltx (or p. 153 of source2e.pdf)
protectedexpandafterdefcsname TextOrMathspaceendcsname{%
ifmmode expandafter@secondoftwo
else expandafter@firstoftwo fi}
edefTextOrMath#1#2{%
expandafternoexpandcsname TextOrMathspaceendcsname
{#1}{#2}}
% My simpler way of doing the same (?)
edefaltTextOrMath#1#2{%
csname TextOrMathspaceendcsname
{#1}{#2}}
showTextOrMath % TextOrMath=macro:#1#2->TextOrMath {#1}{#2}.
showaltTextOrMath % altTextOrMath=ditto
ifxTextOrMathaltTextOrMath
identical
else
different
fi
vfill
eject
bye
This test prints 'identical' and seems to indicate that my definition is equivalent to the one in latex.ltx (but slightly simpler). Did I miss something?
Thanks!
macros expansion definition protected-macro
thanks I suppose we could change that:-)
– David Carlisle
2 hours ago
Many thanks for your insight into this, I was really puzzled!
– frougon
2 hours ago
add a comment |
In latexrelease
2015/01/01, there are two implementations of TextOrMath
: one for regular
TeX, the other one for eTeX-like engines (more precisely: those which support protected
). My question concerns the latter:
protectedexpandafterdefcsname TextOrMathspaceendcsname{%
(...) } % no problem here
edefTextOrMath#1#2{% from latex.ltx
expandafternoexpandcsname TextOrMathspaceendcsname
{#1}{#2}}
I think I understand well these definitions, however I can't figure out why the edef
isn't simply written this way:
edefTextOrMath#1#2{% from me
csname TextOrMathspaceendcsname
{#1}{#2}}
Since the internal TextOrMath<space>
macro is protected
, what is the point of preceding it with noexpand
inside the edef
? Is it because the author feared that protected
might be deficient?..
I made a test like this (ran with pdfTeX):
% From latex.ltx (or p. 153 of source2e.pdf)
protectedexpandafterdefcsname TextOrMathspaceendcsname{%
ifmmode expandafter@secondoftwo
else expandafter@firstoftwo fi}
edefTextOrMath#1#2{%
expandafternoexpandcsname TextOrMathspaceendcsname
{#1}{#2}}
% My simpler way of doing the same (?)
edefaltTextOrMath#1#2{%
csname TextOrMathspaceendcsname
{#1}{#2}}
showTextOrMath % TextOrMath=macro:#1#2->TextOrMath {#1}{#2}.
showaltTextOrMath % altTextOrMath=ditto
ifxTextOrMathaltTextOrMath
identical
else
different
fi
vfill
eject
bye
This test prints 'identical' and seems to indicate that my definition is equivalent to the one in latex.ltx (but slightly simpler). Did I miss something?
Thanks!
macros expansion definition protected-macro
In latexrelease
2015/01/01, there are two implementations of TextOrMath
: one for regular
TeX, the other one for eTeX-like engines (more precisely: those which support protected
). My question concerns the latter:
protectedexpandafterdefcsname TextOrMathspaceendcsname{%
(...) } % no problem here
edefTextOrMath#1#2{% from latex.ltx
expandafternoexpandcsname TextOrMathspaceendcsname
{#1}{#2}}
I think I understand well these definitions, however I can't figure out why the edef
isn't simply written this way:
edefTextOrMath#1#2{% from me
csname TextOrMathspaceendcsname
{#1}{#2}}
Since the internal TextOrMath<space>
macro is protected
, what is the point of preceding it with noexpand
inside the edef
? Is it because the author feared that protected
might be deficient?..
I made a test like this (ran with pdfTeX):
% From latex.ltx (or p. 153 of source2e.pdf)
protectedexpandafterdefcsname TextOrMathspaceendcsname{%
ifmmode expandafter@secondoftwo
else expandafter@firstoftwo fi}
edefTextOrMath#1#2{%
expandafternoexpandcsname TextOrMathspaceendcsname
{#1}{#2}}
% My simpler way of doing the same (?)
edefaltTextOrMath#1#2{%
csname TextOrMathspaceendcsname
{#1}{#2}}
showTextOrMath % TextOrMath=macro:#1#2->TextOrMath {#1}{#2}.
showaltTextOrMath % altTextOrMath=ditto
ifxTextOrMathaltTextOrMath
identical
else
different
fi
vfill
eject
bye
This test prints 'identical' and seems to indicate that my definition is equivalent to the one in latex.ltx (but slightly simpler). Did I miss something?
Thanks!
macros expansion definition protected-macro
macros expansion definition protected-macro
asked 4 hours ago
frougonfrougon
641611
641611
thanks I suppose we could change that:-)
– David Carlisle
2 hours ago
Many thanks for your insight into this, I was really puzzled!
– frougon
2 hours ago
add a comment |
thanks I suppose we could change that:-)
– David Carlisle
2 hours ago
Many thanks for your insight into this, I was really puzzled!
– frougon
2 hours ago
thanks I suppose we could change that:-)
– David Carlisle
2 hours ago
thanks I suppose we could change that:-)
– David Carlisle
2 hours ago
Many thanks for your insight into this, I was really puzzled!
– frougon
2 hours ago
Many thanks for your insight into this, I was really puzzled!
– frougon
2 hours ago
add a comment |
1 Answer
1
active
oldest
votes
No you didn't miss anything, just old habits die hard as we gradually add these modern post 1992 features into the sources....
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%2f482829%2fuse-of-noexpand-in-the-implementation-of-textormath-for-etex%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
No you didn't miss anything, just old habits die hard as we gradually add these modern post 1992 features into the sources....
add a comment |
No you didn't miss anything, just old habits die hard as we gradually add these modern post 1992 features into the sources....
add a comment |
No you didn't miss anything, just old habits die hard as we gradually add these modern post 1992 features into the sources....
No you didn't miss anything, just old habits die hard as we gradually add these modern post 1992 features into the sources....
answered 2 hours ago
David CarlisleDavid Carlisle
497k4111441891
497k4111441891
add a comment |
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%2f482829%2fuse-of-noexpand-in-the-implementation-of-textormath-for-etex%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
thanks I suppose we could change that:-)
– David Carlisle
2 hours ago
Many thanks for your insight into this, I was really puzzled!
– frougon
2 hours ago