TeX and Colors

242 views
Skip to first unread message

bart....@gmail.com

unread,
Nov 18, 2010, 2:35:19 PM11/18/10
to MathJax Users
Hi,

I'm trying to have equations display in different colors when
expressed as LaTeX expressions.

Is this possible? I see that MathJax supports the \color command, but
it doesn't seem to be working for me.

Thanks!
-Bart

bart....@gmail.com

unread,
Nov 18, 2010, 2:38:52 PM11/18/10
to MathJax Users
Ok - I found a bit more -

I just realized that does work in firefox, but I want this to work on
the iPad's browser...

Thoughts?

On Nov 18, 2:35 pm, "bart.sn...@gmail.com" <bart.sn...@gmail.com>
wrote:

bart....@gmail.com

unread,
Nov 18, 2010, 2:42:16 PM11/18/10
to MathJax Users
I'm sorry guys - I figured this out completely...

I have STIX fonts install on my firefox, but not on the ipad. that is
what makes the difference!

Sorry for all the posts!!!

On Nov 18, 2:38 pm, "bart.sn...@gmail.com" <bart.sn...@gmail.com>
wrote:

Davide P. Cervone

unread,
Nov 19, 2010, 9:44:25 AM11/19/10
to mathja...@googlegroups.com
The iPad (and iPhone/iTouch) usually use MathJax's image font mode,
which means that images of the characters are used. These can't be
recolored, and so the \color command will not affect them; that
requires actual. fonts. The more recent releases of iOS have support
for web-based fonts, but it has been buggy and not really very
reliable. I haven't had the chance to test the most recent release,
so perhaps that will be better. If it turns out to be, then MathJax
can take advantage of the web-based fonts (as it can for most other
browsers), and that will make \color effective for the iPad.

Davide

Jason Curley

unread,
May 8, 2012, 3:37:53 PM5/8/12
to mathja...@googlegroups.com
I am trying to make these fonts render colors in ie, firefox, safari and android if possible... How does one go about doing that using MathJax?  Let me know if I should make a separate issue.

~Jason

Davide P. Cervone

unread,
May 8, 2012, 3:42:52 PM5/8/12
to mathja...@googlegroups.com
The IE, Firefox, Safari, and Android browsers all now support web-fonts, so the image fonts should no longer en up being used , and the MathJax output should inherit the font color of the surrounding text (if you are using HTML-CSS or NativeMML output).  The only time image fonts will be used is with Firefox when you are viewing a local file (via file:// URL) and you are taking MathJax from another directory on your hard disk that is not a subdirectory of the one containing the page you are viewing.

Davide

Jason Curley

unread,
May 8, 2012, 3:48:34 PM5/8/12
to mathja...@googlegroups.com
Thanks Davide!  However, I am trying to highlight certain parts of a formula so that they can be highlighted in a meaningful way in an educational environment.  That is, I may make only a part of the formula red or blue while the rest remains black.  Is there an easy way to do this? 

~Jason

Davide P. Cervone

unread,
May 8, 2012, 3:51:18 PM5/8/12
to mathja...@googlegroups.com
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

Jason Curley

unread,
May 11, 2012, 2:12:51 PM5/11/12
to mathja...@googlegroups.com
Gotcha... I had been using the LaTeX renderer for mediawiki before and it would work if I did not include the second set of curly braces.  That is, it was ok to type <math>\color{red}stuff </math> but for mathJax I must type $\color{red}{stuff}$

Thanks for the help Davide! 

~Jason

David Carlisle

unread,
May 14, 2012, 8:15:34 AM5/14/12
to mathja...@googlegroups.com


On 8 May 2012 20:51, Davide P. Cervone <dp...@union.edu> wrote:
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

Davide P. Cervone

unread,
May 14, 2012, 8:23:14 AM5/14/12
to mathja...@googlegroups.com
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.

Davide
Reply all
Reply to author
Forward
0 new messages