mathjax font auto resize

254 views
Skip to first unread message

gezginorman

unread,
Mar 24, 2017, 4:47:38 AM3/24/17
to MathJax Users
Hi,

First of all I want to thank you for this brilliant library.

I want to ask regarding an autosize event that happens after the page is loaded. The MathJax objects looks very good for a second, and then they resize themselves to become bold and large. Is there any option to disable this resizing? I searched to threads for a while but could not find (or found and couldn't realize). Sorry if this has been discussed before.

Thanks,

Murat
2017-03-24_11-37-13.jpg

Joseph Rex

unread,
Mar 24, 2017, 5:58:22 AM3/24/17
to MathJax Users

Hello @gezginorman,

Perhaps it's the font? You could try to change the font with the documentation here http://docs.mathjax.org/en/latest/font-support.html . If that doesn't do it for you you could do a dirty hack to resize the font from your CSS

.mjx-chtml{ font-size: 80% !important; }

gezginorman

unread,
Mar 24, 2017, 7:00:13 AM3/24/17
to MathJax Users
I used the dirty method, I'll have to spend some time on the other one. I just realized that .mjx-chtml class gets "font-size:121%" for some reason. Setting it to 100% worked like charm.

Thanks!

M

Peter Krautzberger

unread,
Mar 24, 2017, 10:55:06 AM3/24/17
to mathja...@googlegroups.com
Hi Murat,

You seem to be describing the Fast Preview, see http://docs.mathjax.org/en/latest/options/fast-preview.html. That's a very fast but not a fully functional output mechanism to provide a fast preview.

If your content is simple enough, you can use it directly via the PreviewHTML output, cf. http://docs.mathjax.org/en/latest/options/PreviewHTML.html

But we generally advise to not do that. If you don't like the visual jitter, then we suggest to drop the fast preview.

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.

Davide Cervone

unread,
Mar 29, 2017, 1:19:59 PM3/29/17
to mathja...@googlegroups.com
Peter is correct, what you are seeing is the initial fast preview, and then the final typeset version (which uses different fonts).  MathJax tries to match the size of its output so that an "x" in the math is the same height as an "x" in the surrounding text.  That is the source of the font-size at 121% that you are seeing.  I do NOT recommend setting the CSS for .mjx-chtml as you have done; rather you should configure MathJax to turn off the font matching, if that is what you want (though that may make in-line math not line up well with surrounding text).  To do that, use

MathJax.Hub.Config({
  CommonHTML: {matchFontHeight: false},
  "HTML-CSS": {matchFontHeight: false},
  SVG: {matchFontHeight: false}
});

Remember that font display differs from browser to browser and system to system, so what you see may not be the same as what others see, so tweaking the output to work for you may end up distorting it for others.  I recommend leaving the font matching on, but, of course, you can do what you think best.

Davide


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

Davide Cervone

unread,
Mar 29, 2017, 1:22:45 PM3/29/17
to mathja...@googlegroups.com
Another alternative would be to switch to the STIX fonts rather than the MathJax TeX fonts, as the STIX fonts are closer to the Times font that the fast preview uses. The output that you describe is not actually bold, but the design of the font is of a different weight, and the scaling does make it thicker, so perhaps STI fonts would work better for you.

Davide
Reply all
Reply to author
Forward
0 new messages