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

The following works:




but the following does not:




I get this error message:

ERROR: Argument of \textcolor has an extra }.

--- TeX said ---
<inserted text> 
l.7 test&textcolor<red><foo>test

--- 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.

I've tried all combinations of backslash-escaping the command chars but no luck. How can I use &, <, and > as the command characters? (Or if it's not possible, why?)

share|improve this question
up vote 9 down vote accepted

The problem is that \textcolor expects an actual brace after it, not just a "group open" token: its definition is


(here #1 would be the possible "color model" allowed by the syntax). You can do with another command defined in terms of \textcolor:


This should work:


Not with <>, I'm afraid: these two characters can't be used as delimiters in fancyvrb commandchars (I've already been bitten by this "feature").

share|improve this answer
Thanks! Do you know why < and > can't be used as delimiters in fancyvrb? – Richard Hansen Jul 15 '11 at 16:38
I've never investigated deeply, but I suspect that some \ifnum or \ifdim is involved. – egreg Jul 15 '11 at 18:05

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.