3

In my presentation, I want every math to be blue and every display math to be red. In my attempt, I have tried to compile the following MWE

\documentclass{beamer}
\everymath{\color{blue}}
\everydisplay{\color{red}}
\begin{document}
\begin{frame}
\begin{eqnarray}
a &=& b\\
c &=& d
\end{eqnarray}
\begin{equation}
E=mc^2
\end{equation}
\end{frame}
\end{document}

I got an error say Improper \halign inside $$'s. \end{frame}. If I disable \everydisplay command, there is no error. However, this is not my desire! I do want every display math to be typesetted in red. How can we achieve this?

Say OL
  • 1,793

1 Answers1

6

Use beamer's own commands to change colours.

\documentclass{beamer}
\setbeamercolor{math text inlined}{fg=blue}
\setbeamercolor{math text displayed}{fg=red}

\begin{document}
\begin{frame}
\begin{align}
a &= b\\
c &= d
\end{align}
\begin{equation}
E=mc^2
\end{equation}
$a=b$
\end{frame}
\end{document}

Note that you will get some unfortunate effects with equation labels if you use different colours for inline and displayed mathematics.

enter image description here

Ian Thompson
  • 43,767