practical use of `noexpand` outside`edef`(`xdef`) and `write`(`messge`)?How to do scantokens inside edef...

Is there any use for defining additional entity types in a SOQL FROM clause?

Does a dangling wire really electrocute me if I'm standing in water?

Can I legally use front facing blue light in the UK?

Copycat chess is back

What is the meaning of "of trouble" in the following sentence?

Does bootstrapped regression allow for inference?

What happens when a metallic dragon and a chromatic dragon mate?

Patience, young "Padovan"

Could Giant Ground Sloths have been a good pack animal for the ancient Mayans?

What is it called when one voice type sings a 'solo'?

Email Account under attack (really) - anything I can do?

How to deal with fear of taking dependencies

What are the advantages and disadvantages of running one shots compared to campaigns?

Is Social Media Science Fiction?

I see my dog run

Crop image to path created in TikZ?

Is every set a filtered colimit of finite sets?

Manga about a female worker who got dragged into another world together with this high school girl and she was just told she's not needed anymore

Can I find out the caloric content of bread by dehydrating it?

What does 'script /dev/null' do?

How to make payment on the internet without leaving a money trail?

What to wear for invited talk in Canada

"listening to me about as much as you're listening to this pole here"

Creating a loop after a break using Markov Chain in Tikz



practical use of `noexpand` outside`edef`(`xdef`) and `write`(`messge`)?


How to do scantokens inside edef without triggering “Runaway definition”When to use edef, noexpand, and expandafter?Problem with nested noexpand and edefForce the expansion of a macro parameter without edef or xdefHow to use noexpand in an edef?Explain this macro: double hash with no number, ialignedef, xdef and ifmmodexdef and cedilleLaTeX for plain TeX users?Protecting blocks of text and commands, not just one command, from expansion`def`, `edef` math and commands













0















After reading (and searching through) TeXbyTopic.pdf I have the impression that practical use of noexpand falls into one of the following three cases,





  1. Inside edef or xdef, including the cases where macros are defined so that they are used in the context of edef, such as



    defprotect{noexpandprotectnoexpand}



  2. Inside write and message, including the case of movable texts in LaTeX


  3. In the special construction ifnoexpand#1relax


Are there any other practical uses of noexpand? Are there any practical use of noexpand that is not in the expansion-only context, except for #3 listed above? I am new to plain and hope to understand plain better (especailly, the expansion-only context) by understanding various usages of noexpand.










share|improve this question









New contributor




Weijun Zhou is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





















  • Thank you for your quick reply. I am just wondering whether there are more cases like #3 in the question. Basically I am trying to summarize the usages of noexpand and if you think you can rephrase the question so that it does not seem so "no"-leading, feel free to edit.

    – Weijun Zhou
    19 hours ago


















0















After reading (and searching through) TeXbyTopic.pdf I have the impression that practical use of noexpand falls into one of the following three cases,





  1. Inside edef or xdef, including the cases where macros are defined so that they are used in the context of edef, such as



    defprotect{noexpandprotectnoexpand}



  2. Inside write and message, including the case of movable texts in LaTeX


  3. In the special construction ifnoexpand#1relax


Are there any other practical uses of noexpand? Are there any practical use of noexpand that is not in the expansion-only context, except for #3 listed above? I am new to plain and hope to understand plain better (especailly, the expansion-only context) by understanding various usages of noexpand.










share|improve this question









New contributor




Weijun Zhou is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





















  • Thank you for your quick reply. I am just wondering whether there are more cases like #3 in the question. Basically I am trying to summarize the usages of noexpand and if you think you can rephrase the question so that it does not seem so "no"-leading, feel free to edit.

    – Weijun Zhou
    19 hours ago
















0












0








0


1






After reading (and searching through) TeXbyTopic.pdf I have the impression that practical use of noexpand falls into one of the following three cases,





  1. Inside edef or xdef, including the cases where macros are defined so that they are used in the context of edef, such as



    defprotect{noexpandprotectnoexpand}



  2. Inside write and message, including the case of movable texts in LaTeX


  3. In the special construction ifnoexpand#1relax


Are there any other practical uses of noexpand? Are there any practical use of noexpand that is not in the expansion-only context, except for #3 listed above? I am new to plain and hope to understand plain better (especailly, the expansion-only context) by understanding various usages of noexpand.










share|improve this question









New contributor




Weijun Zhou is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.












After reading (and searching through) TeXbyTopic.pdf I have the impression that practical use of noexpand falls into one of the following three cases,





  1. Inside edef or xdef, including the cases where macros are defined so that they are used in the context of edef, such as



    defprotect{noexpandprotectnoexpand}



  2. Inside write and message, including the case of movable texts in LaTeX


  3. In the special construction ifnoexpand#1relax


Are there any other practical uses of noexpand? Are there any practical use of noexpand that is not in the expansion-only context, except for #3 listed above? I am new to plain and hope to understand plain better (especailly, the expansion-only context) by understanding various usages of noexpand.







expansion plain-tex






share|improve this question









New contributor




Weijun Zhou is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











share|improve this question









New contributor




Weijun Zhou is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|improve this question




share|improve this question








edited 19 hours ago







Weijun Zhou













New contributor




Weijun Zhou is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









asked 20 hours ago









Weijun ZhouWeijun Zhou

1405




1405




New contributor




Weijun Zhou is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





Weijun Zhou is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






Weijun Zhou is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.













  • Thank you for your quick reply. I am just wondering whether there are more cases like #3 in the question. Basically I am trying to summarize the usages of noexpand and if you think you can rephrase the question so that it does not seem so "no"-leading, feel free to edit.

    – Weijun Zhou
    19 hours ago





















  • Thank you for your quick reply. I am just wondering whether there are more cases like #3 in the question. Basically I am trying to summarize the usages of noexpand and if you think you can rephrase the question so that it does not seem so "no"-leading, feel free to edit.

    – Weijun Zhou
    19 hours ago



















Thank you for your quick reply. I am just wondering whether there are more cases like #3 in the question. Basically I am trying to summarize the usages of noexpand and if you think you can rephrase the question so that it does not seem so "no"-leading, feel free to edit.

– Weijun Zhou
19 hours ago







Thank you for your quick reply. I am just wondering whether there are more cases like #3 in the question. Basically I am trying to summarize the usages of noexpand and if you think you can rephrase the question so that it does not seem so "no"-leading, feel free to edit.

– Weijun Zhou
19 hours ago












1 Answer
1






active

oldest

votes


















4














There are lots of tex primitives that expand tokens looking for arguments like if and ifcat. noexpand would have a similar effect with any of them but whether or not that is useful is harder to say.



for example



defzz{hello}

input snoexpandzz

bye


inputs the file s.tex and then typesets hello whereas



defzz{hello}

input szz

bye


produces



! I can't find file `shello'.


But you could more easily have used a space after s than noexpand to stop the scan for a filename.



As indicated by Henri in comments there is also the use to nullify the end of file token in input or scantokens



edefzz{scantokens{z}}


is the error



! File ended while scanning definition of zz.


but



edefzz{scantokens{znoexpand}}


or



everyeof{noexpand}
edefzz{scantokens{z}}


are error free.






share|improve this answer


























  • I think this one may be useful under some cases. Glad to learn about it.

    – Weijun Zhou
    19 hours ago






  • 3





    ascantokens{b}c vs. ascantokens{bnoexpand}c

    – Henri Menke
    19 hours ago






  • 1





    @HenriMenke thanks I extended the answer.

    – David Carlisle
    18 hours ago






  • 1





    Related: How to do scantokens inside edef without triggering runaway definition. The link can be added to the answer if you wish.

    – Weijun Zhou
    18 hours ago













  • You can use noexpand for tricking TeX's reading apparatus into state S when having things re-tokenized by scantokens and thus prevent the coming into being of a trailing space token. This is what is shown in the comment of Henri Menke. You can also use noexpand for neutralizing the circumstance that TeX takes ends of files for something that is similar to outer tokens. You might be interested in the discussion How does TeX handle EOF which took place in the usenet-newsgroup comp.text.tex in March 2008.

    – Ulrich Diez
    18 hours 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
});


}
});






Weijun Zhou is a new contributor. Be nice, and check out our Code of Conduct.










draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f483766%2fpractical-use-of-noexpand-outside-edef-xdef-and-write-messge%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









4














There are lots of tex primitives that expand tokens looking for arguments like if and ifcat. noexpand would have a similar effect with any of them but whether or not that is useful is harder to say.



for example



defzz{hello}

input snoexpandzz

bye


inputs the file s.tex and then typesets hello whereas



defzz{hello}

input szz

bye


produces



! I can't find file `shello'.


But you could more easily have used a space after s than noexpand to stop the scan for a filename.



As indicated by Henri in comments there is also the use to nullify the end of file token in input or scantokens



edefzz{scantokens{z}}


is the error



! File ended while scanning definition of zz.


but



edefzz{scantokens{znoexpand}}


or



everyeof{noexpand}
edefzz{scantokens{z}}


are error free.






share|improve this answer


























  • I think this one may be useful under some cases. Glad to learn about it.

    – Weijun Zhou
    19 hours ago






  • 3





    ascantokens{b}c vs. ascantokens{bnoexpand}c

    – Henri Menke
    19 hours ago






  • 1





    @HenriMenke thanks I extended the answer.

    – David Carlisle
    18 hours ago






  • 1





    Related: How to do scantokens inside edef without triggering runaway definition. The link can be added to the answer if you wish.

    – Weijun Zhou
    18 hours ago













  • You can use noexpand for tricking TeX's reading apparatus into state S when having things re-tokenized by scantokens and thus prevent the coming into being of a trailing space token. This is what is shown in the comment of Henri Menke. You can also use noexpand for neutralizing the circumstance that TeX takes ends of files for something that is similar to outer tokens. You might be interested in the discussion How does TeX handle EOF which took place in the usenet-newsgroup comp.text.tex in March 2008.

    – Ulrich Diez
    18 hours ago
















4














There are lots of tex primitives that expand tokens looking for arguments like if and ifcat. noexpand would have a similar effect with any of them but whether or not that is useful is harder to say.



for example



defzz{hello}

input snoexpandzz

bye


inputs the file s.tex and then typesets hello whereas



defzz{hello}

input szz

bye


produces



! I can't find file `shello'.


But you could more easily have used a space after s than noexpand to stop the scan for a filename.



As indicated by Henri in comments there is also the use to nullify the end of file token in input or scantokens



edefzz{scantokens{z}}


is the error



! File ended while scanning definition of zz.


but



edefzz{scantokens{znoexpand}}


or



everyeof{noexpand}
edefzz{scantokens{z}}


are error free.






share|improve this answer


























  • I think this one may be useful under some cases. Glad to learn about it.

    – Weijun Zhou
    19 hours ago






  • 3





    ascantokens{b}c vs. ascantokens{bnoexpand}c

    – Henri Menke
    19 hours ago






  • 1





    @HenriMenke thanks I extended the answer.

    – David Carlisle
    18 hours ago






  • 1





    Related: How to do scantokens inside edef without triggering runaway definition. The link can be added to the answer if you wish.

    – Weijun Zhou
    18 hours ago













  • You can use noexpand for tricking TeX's reading apparatus into state S when having things re-tokenized by scantokens and thus prevent the coming into being of a trailing space token. This is what is shown in the comment of Henri Menke. You can also use noexpand for neutralizing the circumstance that TeX takes ends of files for something that is similar to outer tokens. You might be interested in the discussion How does TeX handle EOF which took place in the usenet-newsgroup comp.text.tex in March 2008.

    – Ulrich Diez
    18 hours ago














4












4








4







There are lots of tex primitives that expand tokens looking for arguments like if and ifcat. noexpand would have a similar effect with any of them but whether or not that is useful is harder to say.



for example



defzz{hello}

input snoexpandzz

bye


inputs the file s.tex and then typesets hello whereas



defzz{hello}

input szz

bye


produces



! I can't find file `shello'.


But you could more easily have used a space after s than noexpand to stop the scan for a filename.



As indicated by Henri in comments there is also the use to nullify the end of file token in input or scantokens



edefzz{scantokens{z}}


is the error



! File ended while scanning definition of zz.


but



edefzz{scantokens{znoexpand}}


or



everyeof{noexpand}
edefzz{scantokens{z}}


are error free.






share|improve this answer















There are lots of tex primitives that expand tokens looking for arguments like if and ifcat. noexpand would have a similar effect with any of them but whether or not that is useful is harder to say.



for example



defzz{hello}

input snoexpandzz

bye


inputs the file s.tex and then typesets hello whereas



defzz{hello}

input szz

bye


produces



! I can't find file `shello'.


But you could more easily have used a space after s than noexpand to stop the scan for a filename.



As indicated by Henri in comments there is also the use to nullify the end of file token in input or scantokens



edefzz{scantokens{z}}


is the error



! File ended while scanning definition of zz.


but



edefzz{scantokens{znoexpand}}


or



everyeof{noexpand}
edefzz{scantokens{z}}


are error free.







share|improve this answer














share|improve this answer



share|improve this answer








edited 18 hours ago

























answered 19 hours ago









David CarlisleDavid Carlisle

498k4111441893




498k4111441893













  • I think this one may be useful under some cases. Glad to learn about it.

    – Weijun Zhou
    19 hours ago






  • 3





    ascantokens{b}c vs. ascantokens{bnoexpand}c

    – Henri Menke
    19 hours ago






  • 1





    @HenriMenke thanks I extended the answer.

    – David Carlisle
    18 hours ago






  • 1





    Related: How to do scantokens inside edef without triggering runaway definition. The link can be added to the answer if you wish.

    – Weijun Zhou
    18 hours ago













  • You can use noexpand for tricking TeX's reading apparatus into state S when having things re-tokenized by scantokens and thus prevent the coming into being of a trailing space token. This is what is shown in the comment of Henri Menke. You can also use noexpand for neutralizing the circumstance that TeX takes ends of files for something that is similar to outer tokens. You might be interested in the discussion How does TeX handle EOF which took place in the usenet-newsgroup comp.text.tex in March 2008.

    – Ulrich Diez
    18 hours ago



















  • I think this one may be useful under some cases. Glad to learn about it.

    – Weijun Zhou
    19 hours ago






  • 3





    ascantokens{b}c vs. ascantokens{bnoexpand}c

    – Henri Menke
    19 hours ago






  • 1





    @HenriMenke thanks I extended the answer.

    – David Carlisle
    18 hours ago






  • 1





    Related: How to do scantokens inside edef without triggering runaway definition. The link can be added to the answer if you wish.

    – Weijun Zhou
    18 hours ago













  • You can use noexpand for tricking TeX's reading apparatus into state S when having things re-tokenized by scantokens and thus prevent the coming into being of a trailing space token. This is what is shown in the comment of Henri Menke. You can also use noexpand for neutralizing the circumstance that TeX takes ends of files for something that is similar to outer tokens. You might be interested in the discussion How does TeX handle EOF which took place in the usenet-newsgroup comp.text.tex in March 2008.

    – Ulrich Diez
    18 hours ago

















I think this one may be useful under some cases. Glad to learn about it.

– Weijun Zhou
19 hours ago





I think this one may be useful under some cases. Glad to learn about it.

– Weijun Zhou
19 hours ago




3




3





ascantokens{b}c vs. ascantokens{bnoexpand}c

– Henri Menke
19 hours ago





ascantokens{b}c vs. ascantokens{bnoexpand}c

– Henri Menke
19 hours ago




1




1





@HenriMenke thanks I extended the answer.

– David Carlisle
18 hours ago





@HenriMenke thanks I extended the answer.

– David Carlisle
18 hours ago




1




1





Related: How to do scantokens inside edef without triggering runaway definition. The link can be added to the answer if you wish.

– Weijun Zhou
18 hours ago







Related: How to do scantokens inside edef without triggering runaway definition. The link can be added to the answer if you wish.

– Weijun Zhou
18 hours ago















You can use noexpand for tricking TeX's reading apparatus into state S when having things re-tokenized by scantokens and thus prevent the coming into being of a trailing space token. This is what is shown in the comment of Henri Menke. You can also use noexpand for neutralizing the circumstance that TeX takes ends of files for something that is similar to outer tokens. You might be interested in the discussion How does TeX handle EOF which took place in the usenet-newsgroup comp.text.tex in March 2008.

– Ulrich Diez
18 hours ago





You can use noexpand for tricking TeX's reading apparatus into state S when having things re-tokenized by scantokens and thus prevent the coming into being of a trailing space token. This is what is shown in the comment of Henri Menke. You can also use noexpand for neutralizing the circumstance that TeX takes ends of files for something that is similar to outer tokens. You might be interested in the discussion How does TeX handle EOF which took place in the usenet-newsgroup comp.text.tex in March 2008.

– Ulrich Diez
18 hours ago










Weijun Zhou is a new contributor. Be nice, and check out our Code of Conduct.










draft saved

draft discarded


















Weijun Zhou is a new contributor. Be nice, and check out our Code of Conduct.













Weijun Zhou is a new contributor. Be nice, and check out our Code of Conduct.












Weijun Zhou is a new contributor. Be nice, and check out our Code of Conduct.
















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%2f483766%2fpractical-use-of-noexpand-outside-edef-xdef-and-write-messge%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

Paper upload error, “Upload failed: The top margin is 0.715 in on page 3, which is below the required...

Emraan Hashmi Filmografia | Linki zewnętrzne | Menu nawigacyjneGulshan GroverGulshan...

How can I write this formula?newline and italics added with leqWhy does widehat behave differently if I...