\newcommand vs \DeclareRobustCommand

A simple rule of thumb is that if you're creating commands that contain data that LaTeX will reread later, you should be using a robust command that is defined using \DeclareRobustCommand.

Such data is contained in arguments that typically go into table of contents, list of figures, list of tables etc.; namely, data that are written to an auxiliary file and read in later. Other places are those data that might appear in headers or footers.


In my opinion, it is better to use \newcommand if there are no obvious expansion issues. There are two drawbacks of \DeclareRobustCommand:

  1. \DeclareRobustCommand does not check if the macro is predefined.

  2. Macros defined by \DeclareRobustCommand are less efficient.


Section 2.6 of LaTeX 2ε for class and package writers states:

Because LaTeX 2ε supports different encodings, definitions of commands for producing symbols, accents, composite glyphs, etc. must be defined using the commands provided for this purpose and described in LaTeX 2ε Font Selection. [...]

Also, \DeclareRobustCommand should be used for encoding-independent commands of this type.