I want to include something in my LaTeX article that will make all mathematical formulae appear in black, while all text (including everything inside `\text{}`

s in the middle of mathematical formulae) appear in red. Ideally I would like this to be something I could include in the preamble or in a `.cls`

file or something like that. What would be the quickest way to do that?

# [Tex/LaTex] How to get different colors for math and for text

colormath-mode

###### Related Question

- [Tex/LaTex] How to globally set the text color in XeLaTeX
- [Tex/LaTex] Changing colors over multiple sections and pages
- [Tex/LaTex] How to shade text in different colors
- [Tex/LaTex] Different colors for itemize in blocks and outside, in Beamer
- [Tex/LaTex] Distinguishing \ref and \cref through different colors

## Best Answer

A quick way is using

`\everymath`

,`\everydisplay`

and the`everysel`

package:However, with more complicated

`amsmath`

environments such as`align`

there could could be problems with`\everydisplay`

, see: Modifying \everydisplay causes the align environment to stop working. If you would like to go this way, perhaps omit`\everydisplay`

as`align`

uses inline math internally, and redefine basic displayed math otherwise for using the desired color.