Copy the content of an environmentHow to define environment in LaTeX which replaces its content?Not display...

Do error bars on probabilities have any meaning?

Is there a technology capable of disabling the whole of Earth's satellitle network?

How to draw these kind of adjacent ovals with arrows in latex?

Would life expectancy increase if we replaced healthy organs with artificial ones?

Tikz - highlight text in an image

Found a major flaw in paper from home university – to which I would like to return

Manager has noticed coworker's excessive breaks. Should I warn him?

Coworker is trying to get me to sign his petition to run for office. How to decline politely?

What is the Guild Die for?

Is it possible to detect 100% of SQLi with a simple regex?

Identical projects by students at two different colleges: still plagiarism?

Why would you use 2 alternate layout buttons instead of 1, when only one can be selected at once

Was Opportunity's last message to Earth "My battery is low and it's getting dark"?

Does the phrase がんばする makes sense?

Why does finding small effects in large studies indicate publication bias?

Publication rates for different areas of mathematics?

Not Developing a Piece in the First Five Moves

Does a star need to be inside a galaxy?

How can a kingdom keep the secret of a missing monarchy from the public?

What happens when the last remaining players refuse to kill each other?

Pictures from Mars

Simple Question About Conservation of Angular Momentum

Why do climate experts from the UN/IPCC rarely mention Grand Solar Minimum?

Why are recumbent bicycles and velomobiles illegal in UCI bicycle racing?



Copy the content of an environment


How to define environment in LaTeX which replaces its content?Not display the content of one environment when its content contains one special macroCopy the abstract environment for acknowledgmentscopy and reuse the content of an environmentHide content of tabular environmentcreate environment that resizes contentHow to rename or “copy” a latex environmentPostponing environment contentCapture the content within an environmentCopy abstract environment and rename its title













6















I would like to copy the content of an environment so that I can use it somewhere else. My main purpose is to print it inside a tooltip note.



My idea was to use the environ package:



NewEnviron{foo}
{
xdefbidule{BODY}
%more stuff
}


But when I use bidule I get an error:



 Undefined control sequence ....
leading text: end{foo}
Undefined control sequence endgroup.
leading text: end{foo}
Missing { inserted.
leading text: bidule
main.tex:19: File ended while scanning text of errhelp.


If my understanding is correct, I cannot use def because BODY won't be defined when I will use foo. Is there a way to achieve my goal?










share|improve this question

























  • You could also use an lrbox, assuming all you want to do is print it.

    – John Kormylo
    1 hour ago
















6















I would like to copy the content of an environment so that I can use it somewhere else. My main purpose is to print it inside a tooltip note.



My idea was to use the environ package:



NewEnviron{foo}
{
xdefbidule{BODY}
%more stuff
}


But when I use bidule I get an error:



 Undefined control sequence ....
leading text: end{foo}
Undefined control sequence endgroup.
leading text: end{foo}
Missing { inserted.
leading text: bidule
main.tex:19: File ended while scanning text of errhelp.


If my understanding is correct, I cannot use def because BODY won't be defined when I will use foo. Is there a way to achieve my goal?










share|improve this question

























  • You could also use an lrbox, assuming all you want to do is print it.

    – John Kormylo
    1 hour ago














6












6








6








I would like to copy the content of an environment so that I can use it somewhere else. My main purpose is to print it inside a tooltip note.



My idea was to use the environ package:



NewEnviron{foo}
{
xdefbidule{BODY}
%more stuff
}


But when I use bidule I get an error:



 Undefined control sequence ....
leading text: end{foo}
Undefined control sequence endgroup.
leading text: end{foo}
Missing { inserted.
leading text: bidule
main.tex:19: File ended while scanning text of errhelp.


If my understanding is correct, I cannot use def because BODY won't be defined when I will use foo. Is there a way to achieve my goal?










share|improve this question
















I would like to copy the content of an environment so that I can use it somewhere else. My main purpose is to print it inside a tooltip note.



My idea was to use the environ package:



NewEnviron{foo}
{
xdefbidule{BODY}
%more stuff
}


But when I use bidule I get an error:



 Undefined control sequence ....
leading text: end{foo}
Undefined control sequence endgroup.
leading text: end{foo}
Missing { inserted.
leading text: bidule
main.tex:19: File ended while scanning text of errhelp.


If my understanding is correct, I cannot use def because BODY won't be defined when I will use foo. Is there a way to achieve my goal?







environments






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited 2 hours ago







Saroupille

















asked 2 hours ago









SaroupilleSaroupille

27328




27328













  • You could also use an lrbox, assuming all you want to do is print it.

    – John Kormylo
    1 hour ago



















  • You could also use an lrbox, assuming all you want to do is print it.

    – John Kormylo
    1 hour ago

















You could also use an lrbox, assuming all you want to do is print it.

– John Kormylo
1 hour ago





You could also use an lrbox, assuming all you want to do is print it.

– John Kormylo
1 hour ago










1 Answer
1






active

oldest

votes


















6














You don't want to do a full expansion of BODY, but just one level:



expandaftergdefexpandafterbiduleexpandafter{BODY}


or



xdefbidule{unexpandedexpandafter{BODY}}





share|improve this answer


























  • No, I made a mistake. However, I don't really understand why I want only one level of expansion. Thanks for you answer ;) .

    – Saroupille
    2 hours ago






  • 2





    @Saroupille Suppose the environment contains textbf: then xdef will die horribly. If it contains mbox{a} you want bidule to contain mbox{a}, not unhbox voidb@xhbox{a}

    – egreg
    2 hours ago













  • I think I got it, thanks!

    – Saroupille
    2 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
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f475744%2fcopy-the-content-of-an-environment%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









6














You don't want to do a full expansion of BODY, but just one level:



expandaftergdefexpandafterbiduleexpandafter{BODY}


or



xdefbidule{unexpandedexpandafter{BODY}}





share|improve this answer


























  • No, I made a mistake. However, I don't really understand why I want only one level of expansion. Thanks for you answer ;) .

    – Saroupille
    2 hours ago






  • 2





    @Saroupille Suppose the environment contains textbf: then xdef will die horribly. If it contains mbox{a} you want bidule to contain mbox{a}, not unhbox voidb@xhbox{a}

    – egreg
    2 hours ago













  • I think I got it, thanks!

    – Saroupille
    2 hours ago
















6














You don't want to do a full expansion of BODY, but just one level:



expandaftergdefexpandafterbiduleexpandafter{BODY}


or



xdefbidule{unexpandedexpandafter{BODY}}





share|improve this answer


























  • No, I made a mistake. However, I don't really understand why I want only one level of expansion. Thanks for you answer ;) .

    – Saroupille
    2 hours ago






  • 2





    @Saroupille Suppose the environment contains textbf: then xdef will die horribly. If it contains mbox{a} you want bidule to contain mbox{a}, not unhbox voidb@xhbox{a}

    – egreg
    2 hours ago













  • I think I got it, thanks!

    – Saroupille
    2 hours ago














6












6








6







You don't want to do a full expansion of BODY, but just one level:



expandaftergdefexpandafterbiduleexpandafter{BODY}


or



xdefbidule{unexpandedexpandafter{BODY}}





share|improve this answer















You don't want to do a full expansion of BODY, but just one level:



expandaftergdefexpandafterbiduleexpandafter{BODY}


or



xdefbidule{unexpandedexpandafter{BODY}}






share|improve this answer














share|improve this answer



share|improve this answer








edited 2 hours ago

























answered 2 hours ago









egregegreg

721k8719093209




721k8719093209













  • No, I made a mistake. However, I don't really understand why I want only one level of expansion. Thanks for you answer ;) .

    – Saroupille
    2 hours ago






  • 2





    @Saroupille Suppose the environment contains textbf: then xdef will die horribly. If it contains mbox{a} you want bidule to contain mbox{a}, not unhbox voidb@xhbox{a}

    – egreg
    2 hours ago













  • I think I got it, thanks!

    – Saroupille
    2 hours ago



















  • No, I made a mistake. However, I don't really understand why I want only one level of expansion. Thanks for you answer ;) .

    – Saroupille
    2 hours ago






  • 2





    @Saroupille Suppose the environment contains textbf: then xdef will die horribly. If it contains mbox{a} you want bidule to contain mbox{a}, not unhbox voidb@xhbox{a}

    – egreg
    2 hours ago













  • I think I got it, thanks!

    – Saroupille
    2 hours ago

















No, I made a mistake. However, I don't really understand why I want only one level of expansion. Thanks for you answer ;) .

– Saroupille
2 hours ago





No, I made a mistake. However, I don't really understand why I want only one level of expansion. Thanks for you answer ;) .

– Saroupille
2 hours ago




2




2





@Saroupille Suppose the environment contains textbf: then xdef will die horribly. If it contains mbox{a} you want bidule to contain mbox{a}, not unhbox voidb@xhbox{a}

– egreg
2 hours ago







@Saroupille Suppose the environment contains textbf: then xdef will die horribly. If it contains mbox{a} you want bidule to contain mbox{a}, not unhbox voidb@xhbox{a}

– egreg
2 hours ago















I think I got it, thanks!

– Saroupille
2 hours ago





I think I got it, thanks!

– Saroupille
2 hours ago


















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%2f475744%2fcopy-the-content-of-an-environment%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

Anexo:Material bélico de la Fuerza Aérea de Chile Índice Aeronaves Defensa...

Always On Availability groups resolving state after failover - Remote harden of transaction...

update json value to null Announcing the arrival of Valued Associate #679: Cesar Manara ...