\let\newCommand\oldCommand \renewcommand\oldCommand}{\doThat\newCommand\doThis}now you can use \newCommand and \oldCommand
Example: an article-layout starts a new section always on the same page. Starting on a new page is possible with
\let\mySection\section \renewcommand\section{\newpage\mySection}in this definition \mySection is always the same as the old \section-command.
A \renewcommand
inside a new environment looks like
\newenvironment{booglewog}{%
\renewcommand{\bog}[2]{##1 ##2}%
}{%
}
Otherwise the two Parameters do not belong to \bog
.
Especially the definitions for the parts/chapters/sections/... have a star definition, too. If this one should be redefined too, then do it in this way:
Possible Syntax for \foo (\part, \chapter, \section, ...):\foo*{...} \foo[...]{...} \foo{...}The star is catched by
\@ifstar
:
\newcommand*{\oldfoo}{}% check, if \oldfoo is free \let\oldfoo\foo \renewcommand*{\foo}{% \@ifstar{% \starfoo }{% \@dblarg\nostarfoo }% } \newcommand*{\starfoo}[1]{% \dosomethingbefore{#1}% \oldfoo*{#1}% \dosomethingafter{#1}% } \newcommand{\nostarfoo}{} \def\nostarfoo[#1]#2{% % #1: toc entry % #2: main entry \dosomethingbefore{#2}% \oldfoo[{#1}]{#2}% \dosomethingafter{#2}% }