When working in latex I can do an environment like


and stuff happen and I can define my own environments, I am working on something and what I want to do is essentially to grab everything that was "stuff" in the example and do something to it during the end part of the definition, how would I go about that?

  • Without more details of what you really want to do it is difficult to say for sure but I think that you want the environ package.
    – user30471
    Jun 12, 2018 at 17:00
  • You can use the environ package then do \NewEnviron{some}{Do things with \BODY}. Then when you call \begin{some} stuff \end{some} you get Do things with stuff. Jun 12, 2018 at 17:00
  • currently I am experimentating I just need a way to access the "stuff" part and by the sound, environ is it, imma try Jun 12, 2018 at 17:01
  • works dandy, thanks guys! :D anyone wanting the rep just write the answer and I'll accept it Jun 12, 2018 at 17:04

1 Answer 1


For this you can use the environ package's \NewEnviron{<env>} definition. The environment contents is captured inside \BODY that you can set as-is, or manipulate however you want.

enter image description here



  \BODY% Print the body of the some environment

  \renewcommand{\thisorthat}{that}% Update
  \BODY% Print the body of the some environment



  It's either \thisorthat, or \thisorthat.


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.