0

I want to create a new environment without using the environ package, which conflicts with other packages that I have. I can create the command like this when using environ package.

\NewEnviron{MyCommand}{\foo{\BODY}}

and then envoke \foo{content} using

\begin{MyCommand} content \end{MyCommand}

Instead of

\foo{content}

Is there a way to create the same environment without using the environ package? Thanks

closed as unclear what you're asking by egreg, user156344, Raaja, Stefan Pinnow, Mensch Apr 22 at 19:09

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • What conflict? I know of none. – egreg Apr 21 at 23:38
  • Welcome to TeX.SX! Can you please expand the code snippet that you have posted to a full minimal working example. It is much easier to help you if we can start with some compilable code that illustrates your problem. A MWE should start with a \documentclass command, include any necessary packages and be as small as possible to demonstrate your problem. At the moment we have to reverse engineer what you can doing based on incomplete information. – Andrew Apr 21 at 23:46
  • LaTeX defines a command \newenvironment{<env. name>}{<code at begin>}{<code at end>}. Is that sufficient for your use case? – siracusa Apr 22 at 0:51
1

It seems unlikely that NewEnviron clashes with any other definition as it has a very self contained definition, however there are several alternatives, for example if you have a recent release of the xparse package then the b argument type is available to capture an environment body.

enter image description here

\documentclass{article}

\usepackage{xparse}

\NewDocumentEnvironment{MyCommand}{b}{\fbox{#1}}{}

\begin{document}

\begin{MyCommand}content\end{MyCommand}


\end{document}
  • Thank you. This worked. Also package \newenviron worked as well. I am sorry if my question was less than clear. I am somewhat new to Latex. – GeorgeK Apr 23 at 3:07

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