Skip to content
dpvc edited this page Apr 9, 2013 · 2 revisions

From https://groups.google.com/d/msg/mathjax-users/fo93aucG5Bo/7dH3s8szbNYJ


Sorry, misunderstood. The \color macro in TeX will do that. E.g., $\color{red}{R} + \color{green}{G} + \color{blue}{B}$. You can use any HTML color for the first parameter, and the math to be colored for the second.

Davide

In LaTeX the syntax you describe, taking an argument is \textcolor rather than \color. \color just takes the argument specifying the colour then affects the rest of the current group. The usage is modelled after \bfseries (a declaration affecting the current group) and \textbf a command with argument that just makes its argument bold.


David:

Yes, I know that MathJax's default \color command isn't consistent with LaTeX's. This is a hold-over from earlier work from before I knew of the LaTeX \color command. There is a color extension that changes the behavior to be that of LaTeX's \color (together with things like \DefineColor, \colorbox, and the other LaTeX color commands). It is unfortunate that MathJax started out with a different approach to this, but it would be difficult to change the default now that there is content in place that uses it the other way.

Clone this wiki locally