In a beamer
document, I have $
expressions embedded in displayed equations (using tikz
to make, e.g., colored boxes around some expressions). I put \everymath{\displaystyle}
in the preamble so that these expressions aren't show in text style. However, when the $
expression is in an AMS equation environment rather than equation
, this \everymath
is not honored:
\documentclass{beamer}
\usepackage{tikz}
\usepackage{amsmath}
\everymath{\displaystyle}
\begin{document}
$\sum_i$ \$ expr\\ % works
\tikz \node {$\sum_i$ \$ in tikz}; % works
\begin{equation}
\tikz \node {$\sum_i$ tikz in equation}; % works
\text{$\sum_i$ text in equation} % works
\end{equation}
\begin{gather}
\tikz \node {$\sum_i$ tikz in gather}; % problem
\text{$\sum_i$ text in gather} % works
\end{gather}
\end{document}
Note that this happens only inside \tikz
, not \text
; and only with the beamer
document class. I am intrigued: why does this happen? And is there a simple workaround?
(Of course there is a simple workaround: put \displaymath
in every $
expression ... But maybe something more elegant?)
\tcbhighmath
command from thetcolorbox
package. Using this, you don't have to do manual adjustments.\everymath
in LaTeX because math mode is used and abused behind the scenes in many unexpected ways. I wouldn't trust something as intricate as Beamer to leave it alone at all.tikz
to draw arrows between nodes, so I think I want to stay with that (apart from not wanting to learn yet another package ...) @Ryan: I read about this problem in the context of coloring equations. I thought for\displaystyle
it would not be an issue, because that will affect nothing that is not actually math.