# Redefine macro in terms of old one [duplicate]

Possible Duplicate:
Can I redefine a command to contain itself?

How can I redefine the same macro that uses the original macro?

\newcommand{\macro}{zzz}
\renewcommand{\macro}{xyz\macro}


(this results in an endless loop)

calling \macro should print xyzzzz. (I want to redefine some symbols)

-

## marked as duplicate by diabonas, Thorsten, lockstep, Peter Grill, Roelof SpijkerApr 10 '12 at 16:17

Assuming that the macros don't have optional parameters you can use:

\newcommand{\macro}{zzz}
\let\OldMacro\macro
\renewcommand{\macro}{xyz\OldMacro}


If you wish to redefine a macro that has optional parameters, you have to use \LetLtxMacro from the letltxmacro package . A detailed description of \LetLtxMacro can be found at this question at closed square root symbol.

The MWE below yields:

\documentclass{article}

\newcommand{\macro}{zzz}
\let\OldMacro\macro
\renewcommand{\macro}{xyz\OldMacro}

\begin{document}
\verb|\OldMacro:| \OldMacro

\verb|\macro:| \macro
\end{document}

-