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

In the following MWE,

\usepackage[usenames,dvipsnames]{xcolor} % in order to use color names


\title{\grn Title}% Force line breaks with \\

\section{\grn Section} % compilation error in this line!
Some Text.


I get the compilation error "Package xcolor Error: Undefined color 'NGREEN' ", but it seems to me that I have correctly defined the color ngreen. What's the problem? Note that if you comment the line, I got the correct compilation for the title.

PS I get the same error compiling with latex and pdflatex.

PPS probably some of the packages are redundant.

share|improve this question
I suppose the problem comes with section capitalization: add \colorlet{NGREEN}{ngreen} for a workaround. – Claudio Fiandrino Dec 4 '13 at 9:32
With article it works just fine. This must be related to revtex4. I've never used it, so I've no clue... – nickie Dec 4 '13 at 9:34
You are right @ClaudioFiandrino, adding \colorlet{NGREEN}{ngreen} it works. So the capitalization of the section title reflects to the commands? – Nicola Dec 4 '13 at 9:46
@nickie The guy who has sent me the .tex file used \grn to highlight his changing to the text. Probably it works fine on his laptop. I wonder why it doesn't on mine without \colorlet{NGREEN}{ngreen} – Nicola Dec 4 '13 at 9:46
up vote 4 down vote accepted

You need to use \protect\grn or else \grn is expanded to \color{NGREEN} when the section heading is converted to upper case.

\section{\protect\grn This is a section}

This is not specific to revtex except in that revtex capitalises section headings. To cause the same problem in any document class you can use

\MakeUppercase{\grn abc}

and the solution (\protect) is the same.

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.