Go to page:

Search help:

Navigation

Groups

LyX documentation

Edit

Shared groups

Links

TheLetTrick

Categories: Tips
<< DebuggingLayoutFiles | Page list | ModifyChapterEtc >>

Redefining a Command While Keeping the Old One

It is very common for people to want to redefine a LaTeX command while keeping the old one around, perhaps because they want to use the old one in the definition of the new one. Thus, for example, you might want to redefine the \footnote command so that it printed something in the margin, but you still want it to make a footnote, too. It turns out that this is very easy to do:

\let\oldfoot=\footnote

Now \oldfoot is whatever macro \footnote was at the time this command was given. So now you can say:

\renewcommand\footnote[1]{\newstuff\oldfoot{#1}}

Note that this is different from:

\newcommand\oldfoot{\footnote}

That will not do what you want, because \oldfoot will simply be replaced by \footnote, and then you have a circular definition.

Tips

Edit - History - Print - Recent Changes - All Recent Changes - Search
Page last modified on 2007-03-01 18:33 CET