TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

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

I'm trying to typeset an article. In the preamble, I defined these two things:



However, when I try to use $\hr$ in a section, as in:

\section{Constructing $\hr$}

I get an error:

Incomplete `\iffalse`; all text was ignored after line 1.

Any idea what could be causing this? Everything works just fine if I don't have the $\hr$ in the section (e.g. It typesets just fine if I have \section{Constructing $\mathbb{R}$}, say).

share|improve this question
Since the argument of \section "moves", protecting it seems to solve your problem: \newcommand{\hr}{\protect\leftexp{*}{\mathbb{R}}}, or just using \protect\hr in your sectional header. – Werner Feb 1 '12 at 23:19
up vote 9 down vote accepted

It'll be a fragile command, and \section is a moving argument, so use \protect or declare it with \DeclareRobustCommand

enter image description here








\section{Constructing $\protect\hr$}


\section{Constructing $\hrB$}


share|improve this answer
Thanks a lot. I'm just learning these things, so may I ask what exactly is a "moving argument" and a "fragile command"? Alternatively, what does \protect do? – FPP Feb 1 '12 at 23:22
Ah, the honest answer is a "moving argument" is any argument in which things go wrong sometimes. A fragile command is a command that goes wrong in a moving argument, and \protect normally does nothing but in each such command it is locally defined to do whatever necessary to fix the problem. This case is typical, the heading is typeset as the section head, but also perhaps written to the toc file and/or used at a different font size in a page head. \protect holds the command unexpanded so it is written to the toc file unexpanded and only expanded when the toc is read back in. – David Carlisle Feb 1 '12 at 23:26

You got the (in)famous "fragile command in moving argument" problem. The stuff in \section is written into table of contents, which breaks things.

The following works:

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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