Is it possible to set minimum size for sub/superscripts?

261 views
Skip to first unread message

Iztok

unread,
Mar 12, 2011, 6:03:06 AM3/12/11
to MathJax Users
When rendering math in default scale=100%, some superscripts are
illegibly small. For example, try typesetting \sqrt[m]{x} or x^2^n. A
solution is to increase the overall math scale, but that makes some
other math too big. I think a better solution for this case would be
to enforce some minimum font size that can be used by Mathjax. Is that
possible?

Davide P. Cervone

unread,
Mar 13, 2011, 12:44:50 PM3/13/11
to mathja...@googlegroups.com
The size of the surrounding text will control the size of the math, so
if your original text is small, then the subscripts will become even
smaller. The examples you show display fine for me in my default
browser sizes, but certainly there are setups where that is not going
to be the case. It also varies by browser, and operating system (I
find the font handling in Windows XP to be quite poor, for example).

In MathML (the format underlying MathJax), there are two parameters
that control the size of super- and subscripts. These are
scriptsizemultiplier and scriptminsize. The first
(scriptsizemultiplier) is a factor that is used to find the size of
the superscript in relation to the original size. The default is 1/
sqrt(2), which is about .707, and that corresponds to the scaling that
TeX does. If you were to change this to .8 or .85, that would make
the scripts get smaller at a slower rate. The second (scriptminsize)
is a minimum size that scripts will not go below (this is what you are
asking for). The default is 8px, but you can set it to something
larger like 12px or 14px.

You can set these for the HTML-CSS output jax by using

MathJax.Hub.Register.StartupHook("mml Jax Ready", function () {
MathJax.ElementJax.mml.math.prototype.defaults.scriptsizemultiplier
= .8;
MathJax.ElementJax.mml.math.prototype.defaults.scriptminsize =
"12px";
});

Note that this only affects the HTML-CSS output jax, not the NativeMML
output. There is no current method for specifying defaults for
NativeMML, since hte browser sets those. Perhaps we can add something
for that in the future.

Davide

Iztok

unread,
Mar 14, 2011, 1:28:31 PM3/14/11
to MathJax Users
Thank you very much. This is exactly what I needed.

I only use HTML/CSS output, so NativeMML is not a problem.

Iztok
Message has been deleted

meti.alb

unread,
Mar 18, 2011, 10:57:52 AM3/18/11
to MathJax Users
sorry for the following spam. my post was not going through for some
reason. here is what I wanted to post:


Hi Davide,

I ran into the same problem. I did try to implement your solution
however I don't get the expected result. I do in chrome when using
images, but not in firefox when using webfonts.
I did a printscreen for each case: scriptsizemultiplier 0.8 and 1
which you can check here: img855. imageshack. us/img855/2059/
comparison.jpg (i think urls are not allowed, so please remove the
spaces)

Additionally the javascript included at the head of the page is the
following:
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
showProcessingMessages: false,
messageStyle: "none",
jax: ["input/TeX","output/HTML-CSS"],
tex2jax: {inlineMath: [['$','$']]}
});
MathJax.Hub.Register.StartupHook("mml Jax Ready", function ()
{

MathJax.ElementJax.mml.math.prototype.defaults.scriptsizemultiplier =
0.8; //the second case involved this changed to 1

MathJax.ElementJax.mml.math.prototype.defaults.scriptminsize =
"9px"; //this I left as it is as it was making no effect
});
</script>
<script type="text/javascript" src="[cdnlink]/mathjax/latest/
MathJax.js?config=TeX-AMS-MML_HTMLorMML"</script>


My concern is: why does firefox produce the same result when setting
it as 1 and as 0.8 ?? Additionally I think that is the 0.707 default
value and not even the 0.8 ????




On Mar 18, 10:51 am, "meti.alb" <meti....@gmail.com> wrote:
> test
Reply all
Reply to author
Forward
0 new messages