# Why a specific \color does not work on \author?

On beamer document class, in the part of \author does not let me put an specific color.

I have

\author{\pink{ my name} \\ other name}


Specifically does not work with \pink but it does for \blue,\green, etc.

Also I indicate to put color only on {my name} but it automatically put color on {other name}, why?

I am using \usepackage[dvipsnames]{xcolor}

• Please make a compilable minimal working example (MWE) that shows what you tried. – leandriis Mar 23 '19 at 21:19
• The general usage of the command is as follows: \textcolor{<color>}{<text>} Applied to your case this would be \textcolor{pink}{ my name} – leandriis Mar 23 '19 at 21:27
• @user178403: As already mentioned, a MWE would be very helpful to see what code you use and where possible errors come from. Using \usepackage[divsnames]{xcolor} in combination with the beamer documentclass will by the way generate an error message which should in general not be ignored. – leandriis Mar 23 '19 at 21:44
• @user178403 If you want to use dvipsnames with beamer: \documentclass[xcolor={dvipsnames}]{beamer}, but you will still need to use the proper colour syntax, either \textcolor{pink}{...} or {\color{pink}....}. – samcarter_is_at_topanswers.xyz Mar 23 '19 at 21:50
• @user178403 Never ignore error messages. Fix all 18 errors before you try to further customise your presentation. – samcarter_is_at_topanswers.xyz Mar 23 '19 at 22:35

The combination of \usepackage[dvipsnames]{xcolor} with the beamer documentclass will result in an eror message. The correct usage is the following: \documentclass[xcolor=dvipsnames]{beamer}.

In order to color a certain text, you have the following possibilities:

a) The \textcolor{<color>}{<text>} command:

\documentclass[xcolor=dvipsnames]{beamer}
\author{\textcolor{pink}{my name} \\ other name}

\begin{document}
\begin{frame}
\maketitle
\end{frame}
\end{document}


b) The \color{<color>} switch that is active inside a group or until a different \color switch is used:

\documentclass[xcolor=dvipsnames]{beamer}
\author{{\color{pink} my name} \\ other name}

\begin{document}
\begin{frame}
\maketitle
\end{frame}
\end{document}


c) Define your own \pink{<text>} command using \newcommand as shown in the following example:

\documentclass[xcolor=dvipsnames]{beamer}
\newcommand{\pink}[1]{\textcolor{pink}{#1}}
\author{\pink{my name} \\ other name}

\begin{document}
\begin{frame}
\maketitle
\end{frame}
\end{document}