# Beamer \textcolor space in math mode problem [duplicate]

Why in the second case the spacing is correct and not in the first ?

Maybe not fully correct in the second between + and u ?

\documentclass[xcolor=dvipsnames]{beamer}
\begin{document}
\begin{frame}
\begin{equation*}
5 \only<1>{\textcolor{red}{+}}6+7
\end{equation*}

\begin{equation*}
\frac{\partial u}{\partial t}= \only<1>{\textcolor{red}{+u(n,t)}u(n+1,t)}\only<2>{u(n,t)\textcolor{red}{u(n+1,t)}} -u(n,t)u(n-1,t)
\end{equation*}

\end{frame}

\end{document}

• Compare 5+6+7 with 5{+}6+7. Curly braces around + (and other math operators) eat space around it. The same happens when you change their color an way as you do. – Zarko Aug 15 '15 at 7:33
• Thank you, I know now why it doesn't work. How to change the color a math operator ? – Tarass Aug 15 '15 at 7:44
• the answer is in the comment of this question : tex.stackexchange.com/questions/21598/how-to-color-math-symbols – Tarass Aug 15 '15 at 7:48
• One way is manually add the space araound signs, something like {\color{red}\,+\,}. For better way ... temporary I haven't clue. – Zarko Aug 15 '15 at 7:50
• A group without making a subformula: \begingroup\color{red}+\endgroup`. – Heiko Oberdiek Aug 15 '15 at 7:50