What do newcommand, renewcommand, and providecommand do, and how do they differ?
I think \newcommand
overwrites any previously existing command, while \providecommand
creates the command only if it does not already exists. Does \renewcommand
only work on already extant commands?
Best Answer
No, it is not correct.
\newcommand
defines a new command, and makes an error if it is already defined.\renewcommand
redefines a predefined command, and makes an error if it is not yet defined.\providecommand
defines a new command if it isn't already defined.If you want to define a command whether it is new or predefined, you can use
\def
or