Wednesday, 7 August 2013

\everymath, AMS equations, beamer, and tikz not working together

\everymath, AMS equations, beamer, and tikz not working together

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?)

No comments:

Post a Comment