# How put color in all math mode?

I want to put all math mode in a color, for example, red. But I don't know how to do that. In this web I found how to do it, but in Beamer, I want do it too in Article, Book, etc.

• \everymath{\color{red}}, \everydisplay{\color{red}}? Nov 12 '14 at 7:22
• Welcome to TeX.SX! I'm not sure why you'd want such a device. Nov 12 '14 at 10:43
• Sort of related: tex.stackexchange.com/q/335/86 Nov 12 '14 at 21:56

\documentclass{article}
\def${\ifmmode\)\else$$\fi} \makeatother \begin{document} Una funzione f:U \longrightarrow \mathbb{C}, U$${} aperto di$\mathbb{C}${} si dice \textbf{olomorfa} se \{e} $$\mathbb{C}$$-derivabile in ogni punto di $$U$$, ovvero se $$\forall$$ $$z_0 \in U\ \exists$${} finito \begin{displaymath} \lim_{h \to 0}\frac{f(z_0+h)-f(z_0)}{h}=\frac{\partial f}{\partial z_0}, h\in \mathbb{C}. \end{displaymath} $$f$${} \textbf{intera} se olomorfa su $$U=\mathbb{C}$$. \end{document}  However this solution is a little impractical for inline math mode. I suggest to use this trick only for display math mode, and use a contracted extra command when inline. Doing this with \everymath and \everydisplay is unsafe, as mentioned here: \everymath and author color • You can use the xspace package and then use \def${\ifmmode)\xspace\else(\fi} instead of \def\${\ifmmode)\else(\fi}. With this we avoid using {} to add spaces Jan 23 '18 at 2:39