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.
Thanks for your time.
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.
Thanks for your time.
Here is a way:
\documentclass{article}
\usepackage{xcolor}
\usepackage{amssymb}
\makeatletter
\renewcommand{\displaymath}{\color{red}\[}
\renewcommand{\enddisplaymath}{\]\@ignoretrue\color{black}}
\renewcommand{\(}{\relax\ifmmode\@badmath\else\color{blue}$\fi}
\renewcommand{\)}{\relax\ifmmode\ifinner$\color{black}\else\@badmath\fi\else \@badmath\fi}
\catcode`\$=13
\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
\everymath{\color{red}},\everydisplay{\color{red}}? – Henri Menke Nov 12 '14 at 07:22