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.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

marked as duplicate by Leo Liu, lockstep, Caramdir, Lev Bishop, Loop Space 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.

4  
Possible duplicate question: tex.stackexchange.com/questions/4736/… – Leo Liu Mar 5 '11 at 8:28
    
    
@LeoLiu you may edit your link: it seems dead. – Manu H Nov 27 '15 at 12:23
    
@ManuH tex.ac.uk/FAQ-protect.html – Leo Liu Dec 9 '15 at 6:33
up vote 35 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

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