LaTeX commands are either robust or fragile. Fragile commands need special care if they are part of a moving argument.
Arguments to some LaTeX commands are called moving arguments because they may be "moved" to other places in the document. For example, the argument of Sectioning comands may be moved to the Table of Contents. Other examples of moving arguments include:
\caption commands
\typeout
and \typein
\thanks command
@ expression in the Array or
Tabular environment
A fragile command that appears in a moving argument must be preceded by a
\protect command. The \protect applies only to the
immediately following command; if arguments of this command also contain
fragile commands, the latter must be protected with their own \protect.
The following list is not exhaustive, but illustrates the kind of commands which are fragile
\begin ... \end are fragile.
\[ ... \]
\( ... \)
$ ... $ is robust\\
\item commands
\footnote commands
In general, commands which change Type face or Type style are robust.
Length commands are robust and should
not be preceded by a \protect command. Nor
should a \protect command be used in the argument to
\addtocounter or
\setcounter command.