Q:

Undefined color error, if have symbol in Chapter Title

I am getting an Package xcolor Error: Undefined color 'RED' if I use a red symbol in the Chapter title.  In the MWE below, commenting the last \chapter results in an error. There seems to be no problem with the Second Chapter title containing the red symbol, as the example as is below produces correct results.  Problem only shows up in the subsequent chapter.
\documentclass{book}

\usepackage{xcolor}
\newcommand{\SymbolInRed}{$\textcolor{red}{\times}$}

\begin{document}
\chapter{First Chapter}
\chapter{Second Chapter\SymbolInRed}
%\chapter{Third Chapter}% Undefined color 'RED' if uncomment this.
\end{document}

I have been using this for a while now and have had not problems. I recently changed the header/footer to contain the chapter title using \leftmark and started having this problem so thought it was related to that. But with this example I can reproduce the problem without that.

A:

As Lev Bishop already stated this is caused by the header mark which is converted to uppercase which also turns red into RED and is also a problem with e.g. \label. This can also be avoided by declaring \SymbolInRed as a robust command or of course using \protect\SymbolInRed inside the \chapter{..}. This way the symbol macro isn't expanded and the header mark code never sees the red. This also helps you with the ToC file which then will only hold \SymbolInRed and not its expanded version.
\documentclass{book}

\usepackage{xcolor}
\DeclareRobustCommand{\SymbolInRed}{$\textcolor{red}{\times}$}

\begin{document}
\chapter{First Chapter}
\chapter{Second Chapter\SymbolInRed}
\chapter{Third Chapter}% works now
\end{document}

Also this related question on How to add a tikz/pgf command to section command for more info.

A:

Problem is with the header mark (page 4). Fix with \usepackage[overload]{textcase}

