General ⇒ When can \newcommand not replace \def ?
When can \newcommand not replace \def ?
I am wondering about the general equivalence of \newcommand and the TeX primitive \def. The authors of main LaTeX books advise against using \def and for using \newcommand instead. But I distinctly remember reading that in certain instances, \def must be used instead of \newcommand... Could anyone please give some examples of such instances and some general guidelines?
NEW: TikZ book now 40% off at Amazon.com for a short time.

When can \newcommand not replace \def ?
\newcommand and \renewcommand are limited in parsing arguments. For example things likedeniss wrote:Could anyone please give some examples of such instances and some general guidelines?
Code: Select all
\def\@tempb#1=#2\@nil{#1}
are not possible using \newcommand.
As a generic guideline I would say use \newcommand preferred to \def, if possible, so one would not accidently overwrite an already-defined command.