Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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?

share|improve this question
3  
Possible duplicate question: tex.stackexchange.com/questions/4736/… –  Leo Liu Mar 5 '11 at 8:28
    
And refer this FAQ: tug.org/texlive/devsrc/Master/texmf-dist/doc/generic/FAQ-en/… –  Leo Liu Mar 5 '11 at 8:30
add comment

marked as duplicate by Leo Liu, lockstep, Caramdir, Lev Bishop, Andrew Stacey Mar 7 '11 at 14:26

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

1 Answer

up vote 15 down vote accepted

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,

  • sectioning commands
  • arguments of \caption commands
  • commands that produce page headings

An example :

\caption{Beautiful picture from \protect \citeauthor{allan}
  \protect \shortcite{allan}}
share|improve this answer
add comment

Not the answer you're looking for? Browse other questions tagged or ask your own question.