Under certain conditions (triggered by selection of a package option) I would like to change specific environments into margin notes. However marginnote
is not itself an environment, but a command that takes its contents as an argument. So what I want to do is replace
\begin{someenvironment}
...
\end{someenvironment}
with
\marginnote{
...
}
but I clearly cannot do this with something like
\renewenvironment{someenvironment}
{\marginnote{ }
{ }}
What is the correct way to replace an environment with a command that takes the environment's contents as an argument?