# Beamer - how to change color of each equation in align environment?

I want to use beamer overlays to change the color of equations in an align environment.

On each slide, I want all equations to be black, except one which should be red. On the first slide, the first equation should be red, on the second slide, the second equation should be red, etc.

\documentclass{beamer}
\usepackage{amsmath, bm}

\begin{document}

\begin{frame}
\begin{align*}
\bm{f_t} &= \sigma(\bm{W_f} \cdot [\bm{h_{t-1}}, \bm{x_t}] + \bm{b_f}) \\
\bm{i_t} &= \sigma(\bm{W_i} \cdot [\bm{h_{t-1}}, \bm{x_t}] + \bm{b_i}) \\
\bm{\tilde{C}_t} &= \tanh(\bm{W_{\tilde{C}}} \cdot [\bm{h_{t-1}}, \bm{x_t}] + \bm{b_{\tilde{C}}}) \\
\bm{C_t} &= \bm{f_t} \odot \bm{C_{t-1}} + \bm{i_t} \odot\bm{\tilde{C}_t} \\
\bm{o_t} &= \sigma(\bm{W_o} \cdot [\bm{h_{t-1}}, \bm{x_t}] + \bm{b_o}) \\
\bm{h_t} &= \bm{o_t} \odot \tanh(\bm{C_t})
\end{align*}
\end{frame}

\end{document}


If anybody can help me, I'd be incredibly thankful. I've been fiddling with \onslide for hours!

• Do the equations have to appear after each other or is it enough that the color changes? Apr 4, 2019 at 16:09
• Preferably the equations would appear one after each other. Sorry, I should have mentioned that in the question. Apr 4, 2019 at 16:45

You can use \alert to highlight each line after another:

\documentclass{beamer}
\usepackage{amsmath, bm}

\begin{document}

\begin{frame}
\begin{align*}
\end{align*}
\end{frame}

\end{document}


• Thanks so much sam! Although is it possible for the equations to appear one after each other as well? Apr 4, 2019 at 16:42
• @Henry Sure it is possible, although in your question you explicitly asked that all equations to be black, only one red. Try \uncover<+->{\alert<.>{\bm{i_t}}} &\uncover<.->{\alert<.>{= \sigma(\bm{W_i} \cdot [\bm{h_{t-1}}, \bm{x_t}] + \bm{b_i})}} \\  Apr 4, 2019 at 16:48