Possible Duplicate:
What is the difference between Fragile and Robust commands?
I've never understood the purpose of the command \protect
? When and why should it be used?
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It only takes a minute to sign up.
Sign up to join this communityPossible Duplicate:
What is the difference between Fragile and Robust commands?
I've never understood the purpose of the command \protect
? When and why should it be used?
To understand how to use \protect
you need to understand the concept of fragile commands and to understand this concept, you need to understand what a moving argument is. Some commands called fragile commands causes an error when they use a moving argument. It's a command that expands into illegal TeX code during the save process. Some arguments are called moving arguments because they may be "moved" to other places in the document. A fragile command that appears in a moving argument must be preceded by a \protect
command. For example,
\caption
commandsAn example :
\caption{Beautiful picture from \protect \citeauthor{allan}
\protect \shortcite{allan}}