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

I have a macro that I use to write units (so that I can write exponents easily), in math or in text mode.

I would like to change the definition of \mu in \upmu (from the upgreek package) only in this macro (not for standard math). This is what I wrote:


It works, but I get an error at compilation:

ERROR: Argument of \@caption has an extra }.

--- TeX said ---
<inserted text> 
l.117 ... bla 30\U{\mu K} bla bla}

--- HELP ---
From the .log file...

I've run across a `}' that doesn't seem to match anything.
For example, `\def\a#1{...}' and `\a}' would produce
this error. If you simply proceed now, the `\par' that
I've just inserted will cause me to report a runaway
argument that might be the root of the problem. But if
your `}' was spurious, just type `2' and it will go away.

for the incriminated code:

\caption{bla bla 30\U{\mu K} bla bla}
share|improve this question
Add \protect before \renewcommand. Also add % after {\upmu}. – karlkoeller Sep 18 '13 at 18:45
Thanks, this works. – Geoffroy Sep 18 '13 at 18:54
Do you want it as an answer? – karlkoeller Sep 18 '13 at 18:58
Yes, but if you could explain very briefly (or give a link) what \protect does in this case, it would be useful. – Geoffroy Sep 18 '13 at 19:01
I've just realized that you're a member of TeX.SX from over a year... You had surely already read our starter guide time ago. I apologize. – karlkoeller Sep 18 '13 at 19:20
up vote 11 down vote accepted

Fragile commands like \renewcommand have to be \protected when used in moving arguments like the one of \caption (see What is the difference between Fragile and Robust commands? for more info).

Moreover, you have to add a trailing % whenever you don't want to insert extra space (see What is the use of percent signs (%) at the end of lines?).

So you should change your definition to

share|improve this answer

You want to use


so you don't have to worry about untimely expansion of \U. Note that the proper spacing is \, rather than ~. Instead of \let\mu\upmu you could use \renewcommand{\mu}{\upmu} that's only less efficient.

However this is still wrong: the K should be upright, assuming it means the kelvin unit.

Here's how you should be doing it:


\caption{bla bla \SI{30}{\micro\kelvin} bla bla}


enter image description here

share|improve this answer

I think what you want is something like


When you call this from within \caption, write

\caption{bla bla 30\protect\U{\mu K} bla bla}
share|improve this answer
Is there any adverse effect if one \protects the \renewcommand as suggested by karlkoeller? – moewe Sep 18 '13 at 18:50
karlkoeller's solution is more convenient as I don't have to think of putting a \protect in front of each usage of my \U command. – Geoffroy Sep 18 '13 at 18:57

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.