Go to the first, previous, next, last question, table of contents.

What's the reason for `protection'?

Sometimes LaTeX saves data it will reread later. These data are often the argument of some command; they are the so-called moving arguments. (`Moving' because data are moved around.) Places to look for are all arguments that may go into table of contents, list of figures, etc.; namely, data that are written to an auxiliary file and read in later. Other places are those data that might appear in head- or footlines. Section headers and figure captions are the most prominent examples; there's a complete list in Lamport's book (see TeX-related books).

What's going on really, behind the scenes? The commands in the moving arguments are already expanded to their internal structure during the process of saving. Sometimes this expansion results in invalid TeX code when processed again. ``\protect\cmd'' tells LaTeX to save \cmd as \cmd, without expansion.

What is a `fragile command'? It's a command that expands into illegal TeX code during the save process.

What is a `robust command'? It's a command that expands into legal TeX code during the save process.

No-one (of course) likes this situation; the LaTeX3 team have removed the need for protection of some things in the production of LaTeX2e, but the techniques available to them within current LaTeX mean that this is an expensive exercise. It remains a long-term aim of the team to remove all need for these things.


Go to the first, previous, next, last question, table of contents.