[Tex/LaTex] Error when using colour in \author

beamercolorerrorstitles

I am getting an error when I try to use \color{} in the the author field with beamer, even though the file compiles and I get the the words I want coloured in the author field.

This is the error description:

ERROR: Argument of \beamer@stripands has an extra }.

— TeX said —
\par l.8 …\ \small \vspace{1cm} \color{viv} My name}

— 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 type2' and it will go away.

My MWE:

\documentclass{beamer}

\usepackage{color}
\definecolor{viv}{RGB}{255,109,254}
\title[]{\Large Credit and Banking in a DSGE Model\\ of the Euro Area} 
\author[]{\Large Gerali, Neri, Sessa and Signoretti (2010) \\ \small \vspace{1cm} \color{viv} My name}

\begin{document}    
\begin{frame}
  \titlepage
\end{frame}  
\end{document}

This MWE compiles and gives me the words "My name" coloured as desired. If I get rid of \color{viv} I no longer get the error message, but then, I don't get the colouring as I wish.

Does anyone know why I am getting this error message and how I can fix it?

Best Answer

This is a classic instance of needing \texorpdfstring, since the material you put in these metadata fields will also be made into PDF bookmarks, which can't have formatting like color. Here is a fix for you:

\documentclass{beamer}

\usepackage{color}
\definecolor{viv}{RGB}{255,109,254}
\title[]{\Large Credit and Banking in a DSGE Model\\ of the Euro Area} 
\author[]{\Large Gerali, Neri, Sessa and Signoretti(2010)\texorpdfstring{\\ \small \vspace{1cm} \color{viv}}{ }My name}

\begin{document}    
\begin{frame}
  \titlepage
\end{frame}  
\end{document}

(\texorpdfstring presents two alternatives, the first to be put in the TeX source, the second to be put in the PDF metadata)

Related Question