MathML with multiple Font

27 views
Skip to first unread message

rames...@gmail.com

unread,
Dec 18, 2017, 8:41:10 AM12/18/17
to MathJax Users
Hi ,

Am trying to configure client MathJax to forumn. 
Forumn poster can use different font for Math equations . Can i render MathML equations with different fonts on the same post.

I have configured my Mathjax to output SVG.

Example : 
<p>
<math xmlns="http://www.w3.org/1998/Math/MathML" font="Asana-Math">

<mi>x</mi>

<mo>&#x2A70;</mo>

<mn>1</mn>

</math>
</p>
<p> Am testing multiple fonts on same forumn post</p>
<p>
<math xmlns="http://www.w3.org/1998/Math/MathML">

<mi>x</mi>

<mo>&#x2A70;</mo>

<mn>1</mn>

</math>
</p>

Thanks,
Ramesh

Peter Krautzberger

unread,
Dec 18, 2017, 9:43:28 AM12/18/17
to mathja...@googlegroups.com
Hi,

If you are asking if you can render some equations with one font and others with another, then there is currently no built-in way of doing this.

I suppose you could approach a custom solution by rendering one set of equations, changing the MathJax configuration, and then render the rest. 

Regards,
Peter.

--
You received this message because you are subscribed to the Google Groups "MathJax Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mathjax-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

rames...@gmail.com

unread,
Dec 19, 2017, 11:04:53 AM12/19/17
to MathJax Users

Thanks Peter , Can you please provide me with small code snippet, as these are MATHML equations and am not able to render in sets .

Thanks,
Ramesh

William F Hammond

unread,
Dec 19, 2017, 2:01:58 PM12/19/17
to mathja...@googlegroups.com
Instead of using the attribute font="Asana-Math", try to bring in Asana
with CSS, i.e., style="font-family: Asana-Math;".  (Is 'font' a legitimate
attribute for <math>.) 

This works for me using config=MML_CHTML but not with
config=MML_SVG.  I'm not sure why at the moment.  When I say it works,
I mean that I'm looking at something different though I haven't checked
carefully whether it's Asana.

The topic raises the question of how Asana-Math is to be found on a user's
platform unless web fonts are being served.

                                -- Bill


--
You received this message because you are subscribed to the Google Groups "MathJax Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mathjax-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Davide Cervone

unread,
Dec 20, 2017, 9:46:57 AM12/20/17
to mathja...@googlegroups.com
While using style="font-family:..." (or the deprecated fontfamily="..." attribute, which does work in SVG) will cause MathJax to try to us the given font for whatever characters it can, this will not produce very good results, for several reasons:  first, it relies on the user having the given font installed locally on their own computer (MathJax does not try to use web fonts for these, though you could set up CSS to do that yourself).  Second, MathJax does not have the font metrics for the given font, and so the position of super and subscripts, and other layout will not be as accurate as usual.  Third, MathJax will try to measure the widths of the characters, but the mechanism for this will cause a reflow of the page for each character, and that will have a significant negative impact on the performance of MathJax's typesetting.

For these reasons, I don't recommend using font-family CSS except for isolated characters for special needs.

As for running MathJax once with one font configuration and then a second time with another, that is a good idea, but unfortunately, MathJax only loads one set of fonts, and changing the configuration will not cause it to load another.  So you won't be able to use that approach.  The only way I can see that you could do it would be to change the output jax as well (since each output jax can have a different font), or to delete the MathJax global variable and reload MathJax again from scratch with the new configuration.  Both of these seem to be rather heavy-handed approaches.

Davide


To unsubscribe from this group and stop receiving emails from it, send an email to mathjax-user...@googlegroups.com.

Peter Krautzberger

unread,
Dec 20, 2017, 9:54:27 AM12/20/17
to mathja...@googlegroups.com
As for running MathJax once with one font configuration and then a second time with another, that is a good idea, but unfortunately, MathJax only loads one set of fonts, and changing the configuration will not cause it to load another. 

Oh, thanks for correcting me, Davide. (And apologies to @ramesh for my misleading idea).

The only way I can see that you could do it would be to change the output jax as well (since each output jax can have a different font), or to delete the MathJax global variable and reload MathJax again from scratch with the new configuration.  Both of these seem to be rather heavy-handed approaches.

One way to reduce this problem for the reader is to do this kind of process on the server using mathjax-node.

Still, pretty messy.
Peter.

Reply all
Reply to author
Forward
0 new messages