I am trying to colorize equations (especially inline ones) so that they standout from the rest of the text and thus have used the \everymath{} and \everydisplay{} commands, however that also seems to affect tables. Text is not affected though. Any idea why this happening or how to get around it?
\documentclass{article}
\usepackage{xcolor}
\everymath{\color{teal}}
\everydisplay{\color{magenta}}
\begin{document}
Some text.
Some text.
Some text.
Some text.
$x=\int_{-\infty}^{\infty}\frac{\sin}{x}\mathrm{d}x=\frac{\pi}{2}$
Some text.
Some text.
Some text.
Some text.
[
x=\int_{-\infty}^{\infty}\frac{\sin}{x}\mathrm{d}x=\frac{\pi}{2}
]
\begin{table}[!h] % also colored?
\centering
\begin{tabular}{ll}
\hline
Animal & Legs \
\hline
Dogs & 4 \
Human & 1 \
\hline
\end{tabular}
\end{table}
\end{document}


tabularuses math mode. – egreg Aug 23 '21 at 21:12\makeatletter \def\m@th{\mathsurround\z@\color{black}} \makeatothershould do the trick. – citsahcots Aug 23 '21 at 22:39