Let's say I have an environment myenvironment and I have the following code :


I want to create an environment foo that would do the same but simply with


I know how to pass \length to foo. The problem is the command makebox (or any command that would delimit myenvironment). I attempted this naive approach :


which of course doesn't work because you can't have { and } by themselves in a block.

I found this similar question but I am not sure it applies to my problem: How to define an environment that begins with a node? . And I don't really understand the validated answer.

So how would I go about to create the environment foo ? I would prefer a solution without using the package environ. If useful for a solution, I am using the xparse and etoolbox packages.


The trick is using lrbox:


 {% start
 {% end
  • Thanks, this works and now I know how to save stuff inside boxes. Mar 5 '16 at 13:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.