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?

  • 4
    Just avoid eqnarray in every circumstances. – egreg Aug 2 '17 at 8:58
  • @egreg Could you tell us the reasons why? – Say OL Aug 2 '17 at 16:38
  • See eqnarray vs align – egreg Aug 2 '17 at 17:03
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

  • Great! I could actually read Beamer manual before posting this question :) – Say OL Aug 2 '17 at 9:36
  • It's a long read... – Ian Thompson Aug 2 '17 at 9:46
  • You are right. Sometimes it is less efficient than surfing the internet or asking in the forum! – Say OL Aug 2 '17 at 16:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.