The main answer to your question is that \everymath
is not a LaTeX command, i.e., you shouldn't have gotten that from any LaTeX manual or instruction. It is a bit unfortunate that a lot of the TeX primitives are given names that are very nice and that for historical reasons most formats (including LaTeX) kept those names available (also from plain TeX extensions) even if they are not safe to use in context of a more complicated environment such as LaTeX.
The technical reason for the behavior is that TeX is missing a number of important building blocks or offers them only in a roundabout way. E.g., vertical centering is available as \vcenter
which is only possible in math mode, so a lot of higher-level constructs use a "fake" math mode to achieve special effects like this, even though technically speaking no formula is being build at all.
Having said that, there may be a way to get around this problem (but this is at your own risk :-)
Try
\makeatletter \def\m@th{\mathsurround\z@\color{black}} \makeatother
in addition to your code. The reason why this most likely works, is that any "fake" math should include \m@th
to cancel the extra space that could be added around formulas. So if all constructs in all packages are properly built, then this should do the trick.
$...$
and$$...$$
syntax and switch to\(...\)
and\[...\]
instead. If that it an option, please let us know ;)tabular
,minipage
and\parbox
all use math mode and their output would be red (printing the author name is done with atabular
). So\everymath
is not a good way to make all math red.