# Replicating an environment to another and making changes to original

I would like to define a new environment with the name oldproof which is basically the proof environment and then make changes to the proof environment. I would still like to be able to access the original proof environment using oldproof. How do I go about doing this?

• What kind of changes would you make to the proof environment? There might be different ways than maintaining two different environments that could give much more flexibility. Jun 6, 2013 at 8:59

An environment <name> will basically translate into two commands: \<name> and \end<name> and the former will deal with eventual argument for the environment. One option then would be to \let the original commands to some other ones; however, since proof has an optional argument, one cannot simply use \let for \proof; additional precautions must be taken and one can use \LetLtxMacro from the letltxmacro package.

\usepackage{amsthm}
\usepackage{letltxmacro}

\LetLtxMacro\oldproof\proof
\let\endoldproof\endproof


A complete example (I introduced two font changes to the original environment, just for illustration purposes):

\documentclass{article}
\usepackage{letltxmacro}
\usepackage{amsthm}

\LetLtxMacro\oldproof\proof
\let\endoldproof\endproof

\makeatletter
\renewenvironment{proof}[1][\proofname]{\par
\pushQED{\qed}%
\normalfont\sffamily% NEW
\topsep6\p@\@plus6\p@\relax
\trivlist
\item[\hskip\labelsep
\bfseries% NEW
}{%
\popQED\endtrivlist\@endpefalse
}
\makeatother

\begin{document}

\begin{proof}
This is a modified proof environment.
\end{proof}

\begin{oldproof}
This is the original proof environment.
\end{oldproof}

\end{document}


Regarding commands with an optional argument and \LetLtxMacro valuable information is provided in egreg's answer to When to use \LetLtxMacro? and, in more detail, in this other answer of his to "Closed" (square) root symbol.

• Thanks. Can you explain why you prefer to use \LetLtxMacro in the first line instead of simply using \let. Jun 6, 2013 at 2:58
• @set_kwr I was just adding the explanation; the problem is that proof has an optional argument which will be an optional argument for \proof; for commands with optional arguments, \let is not a safe option. Jun 6, 2013 at 3:00