Idle question for the TeXperts here, in an answer just now I wanted to add a little extra code at the end of an already-defined macro (which took arguments). If doing so at the beginning, I would do \let\origcmd=\cmd \def\cmd{New Code\cmd}. For the end, I was reduced to \let\origcmd=\cmd \def\cmd#all#original#parameter#stuff{\cmd{#1}{#2}...{#n}New Code}. Is there a neater way to do that?
@AndrewStacey: The \apptocmd macro from the etoolbox packages allows you to append material to macros with arguments.
There is also the possibility to to use the similar technique of \g@addto@macro where you expand (using \expandafter) the original definition and use #1 etc. as arguments. Then the original #1 is replaced by the new #1, i.e. stays the same, and you can add material afterwards.
@MartinScharrer Phew, this version with \expandafters is even worse that having to put #all#original#parameter#stuff, isn't it? But \apptocmd sounds good.
@MartinScharrer Errrrmmm ... in that \expandafter version you also have the #all#original#parameter#stuff, so I'm not sure what you mean. And what do you mean by "that the original macro can be redefined"? That it can be redefined without the use of any temporary macros?
@HendrikVogt Exactly. And I'm aware the the original parameters must be replicated. I only use it in one occasion with a macro with one argument. The \expandafters can also be replaced by \edef and \unexpanded\expandafter{\oldmacro{#1}...}. But just use \apptocmd. I just posted the code to demonstrate the possibility.