Apart from the funny
\renewcommand{\fi}{Firenze} % a handy abbreviation
that will produce the amazing error message
! LaTeX Error: Missing \begin{document}.
See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...
l.8 \begin{document}
or something like
\renewcommand{\box}[1]{\colorbox{red}{#1}}
that makes TeX suffer until giving up the ghost with
! TeX capacity exceeded, sorry [grouping levels=255].
\rlap #1->\hb@xt@ \z@
{#1\hss }
there are many other commands that should not be redefined under any circumstances. Note that \fi
and \box
are TeX primitives, so problems are expected if one changes their meaning. However also “handy” abbreviations such as
\renewcommand{\a}{\alpha}
\renewcommand{\b}{\beta}
\renewcommand{\c}{\gamma}
a colleague of mine was fond of are likely to produce mysterious effects. In a frantic email he asked me for help because his paper with a Turkish coauthor refused to typeset. Guess what? The coauthor's surname started with “Ş”, which is quite common a letter in Turkish. Typesetting “Ş” relies on \c
being unchanged even if direct UTF-8 input is used. By the way, also \a
and \b
should not be redefined.
In some cases \renewcommand
is however mandatory: if you want to change the interline skip in tables or arrays, you should indeed use
\renewcommand{\arraystretch}{<new factor>}
(the default definition assigns the value 1
).
There are cases when \renewcommand
is safe, I usually mention
\renewcommand{\phi}{\varphi}
\renewcommand{\epsilon}{\varepsilon}
in order to be sure to use the letterforms which are more common in continental Europe.
In other cases one must use the same care an elephant should in a glassware shop: move very carefully.
\renewcommand
or change the number of arguments of an existing macro, i.e. a former\newcommand{\foo}[1]{...}
would become\renewcommand{\foo}[2]{...}
-- this will potentially lead to problems as well as\renewcommand{\foo}{...}
, leaving\foo{Some stuff}
being\foo
and then some textSome stuff
that at best is typeset, at worst it appears in the preamble, breaking compilation\renewcommand{\foo}
you should know the old meaning of\foo
first, then act wisely ;-)\usepackage{color}\renewcommand{\box}[1]{\colorbox{red}{#1}}
\renewcommand{\box}
is a sledge-hammer in order to show the wrong use, isn't it? ;-)\ifdefined
or\ifcsname
before "renew" the command that could be just a "new" command (if a package haven't be loaded and we didn't thought of that possibility... etc)