Colors within a formula

27 views
Skip to first unread message

Peter Luschny

unread,
Jan 9, 2011, 8:08:11 AM1/9/11
to MathJax Users
An example with jsMath is

<div class="math">
\def\green{\bbox[#d0ffd0,2pt]}
\def\yellow{\bbox[#ffffa0,2pt]}
\def\pink{\bbox[#ffe0e0,2pt]}
x = \green{\lfloor x \rfloor} + \yellow{(x - \lfloor x \rfloor)}
= \lfloor x \rfloor + \frac{1}{\pink{\frac{1}{x - \lfloor x
\rfloor}}}
</div>

I was not able to reproduce this example with MathJax.
Any help would be appreciated.

Peter

Davide P. Cervone

unread,
Jan 9, 2011, 8:36:51 AM1/9/11
to mathja...@googlegroups.com
Peter:

The \bbox extension to jsMath is one of the few things from jsMath
that hasn't yet been converted to MathJax. It is on the list of
things to do, but we have been concentrating on performance issues and
other internal factors for v1.1. New features will follow after we
have that later this month. The \bbox macro is on the list of things
to do, but currently isn't available through TeX input.

Davide

Davide P. Cervone

unread,
Jan 9, 2011, 10:52:01 AM1/9/11
to mathja...@googlegroups.com
Well, it turns out not to be too hard to handle bboxes with color and
padding (though the border styling would take some more doing). I
have attached a bbox.js file that you can put into your MathJax/
extensions/TeX folder to implement the \bbox command. For now, you
will have to add "TeX/bbox.js" to your extensions array in your
MathJax configuration. Eventuall, this will be loaded automatically
when \bbox is first used.

This should handle your needed, but does not do everything that the
jsMath version of \bbox does. Note also that it will not work
properly with NativeMML output in Firefox, since Firefox doesn't yet
implement the MathML3 form of setting the background colors on
individual items. (It could be modified to accommodate that if native
MathML output was important to you.)

Davide

On Jan 9, 2011, at 8:08 AM, Peter Luschny wrote:

bbox.js.zip

Peter Luschny

unread,
Jan 9, 2011, 12:18:01 PM1/9/11
to MathJax Users

Thank you so much, Davide!

Peter

Peter Luschny

unread,
Jan 9, 2011, 2:18:27 PM1/9/11
to MathJax Users

If someone wants to see what can be done with this function
he might look at this test page:

http://www.luschny.de/math/tex/MathJaxColor.html

Peter

Davide P. Cervone

unread,
Jan 9, 2011, 2:35:38 PM1/9/11
to mathja...@googlegroups.com
Thanks, that looks great.

Davide

Reply all
Reply to author
Forward
0 new messages