# Why use \DeclareTextFontCommand vs. just \newcommand?

Why should I use \DeclareTextFontCommand vs. just \newcommand?

In the answer to my previous question, @egreg said:

With \DeclareTextFontCommand you get a robust command that will remain untouched when found in a moving argument such as a section title or a caption.

but I still don't understand what "moving argument" is, and how will \newcommand fail at this - just curious.

-
A moving argument is an argument which is written into an auxiliary file (like .aux, but also .toc and others) which is then read on some other position at the next run. Things like sectioning titles and labels are moving arguments. While written into the auxiliary file the macro is fully expanded into its replacement text, while the underlying primitives (e.g. boxing commands) are not executed but will be written as such into the auxiliary file. This can cause trouble. Instead you want the macro name be written instead. This is achieved by making the macro robust. –  Martin Scharrer Mar 8 '12 at 15:39
Robust means the macro either expands to simple text (e.g. \newcommand{\foo}{The main file is called \jobname}, where \jobname expands in turn to text only) or expands (in this mode) to it's own macro name (maybe followed by a space) using some TeX trickery. E.g.: \foo would expand to \foo . Macros like \DeclareRobustCommand do this for you. e-TeX allows to do this using the new \protected primitive added before a \def or friends. –  Martin Scharrer Mar 8 '12 at 15:44