Why should I use \DeclareTextFontCommand vs. just \newcommand?
In the answer to my previous question, @egreg said:
With
\DeclareTextFontCommandyou 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.
.aux, but also.tocand 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 08 '12 at 15:39\newcommand{\foo}{The main file is called \jobname}, where\jobnameexpands 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.:\foowould expand to\foo. Macros like\DeclareRobustCommanddo this for you. e-TeX allows to do this using the new\protectedprimitive added before a\defor friends. – Martin Scharrer Mar 08 '12 at 15:44