I'm trying to redefine an environment in order to add a command after the \begin without having to add this command in manually everywhere.
For example, I'd like to replace every instance of \begin{figure} with \begin{figure}\foo where \foo is a function I've defined earlier:
\newcommand{foo}{This is foobar}
If I simply do:
\renewenvironment{figure}{\begin{figure}\foo}{\end{figure}}
then this creates a recursive definition of the figure environment.
This answer suggests using an intermediate command to get past the recursion problem when using \renewcommand.
But how can I get past the recursion problem when using \renewenvironment?
