-
Notifications
You must be signed in to change notification settings - Fork 233
Size of root() in asciimath and sans serif
Following on from the discussion about obtaining sans-seirf output, I'm wondering if there is a way to define a global change for the size of the nth-root character, for example, the "n" in "root(n)a".
I'm using ASCIIMathML input.
I'd also like to target that nth-root character (but no others) with the "\sf" handle, to help readability.
While I'm at it, I'd like to ask how to increase the size of fractional exponents, e.g. the "m" and "n" in a^(m/n).
Thanks for your untiring, and inspiring, help.
Following on from the discussion about obtaining sans-seirf output, I'm wondering if there is a way to define a global change for the size of the nth-root character, for example, the "n" in "root(n)a".
The size of the roots (as well as superscript, subscripts, and all smaller elements like that) is controlled by the MathML scriptsizemultiplier value, though you don't have direct access to that via the AsciiMath input format. There were some discussions about this in the past for the TeX input jax. See
http://groups.google.com/group/mathjax-users/browse_thread/thread/e314a70fba458b00/3d367c282c4b4c12
http://sourceforge.net/projects/mathjax/forums/forum/948701/topic/3856887
The latter is quite old, but it does still work (though the thing about "anonymous Jax" is no longer needed). There are better tools now for making the global modification than the one listed there. For example,
MathJax.Hub.Register.StartupHook("AsciiMath Jax Ready",function () {
MathJax.InputJax.AsciiMath.postfilterHooks.Add(function () {
data.math.root.scriptsizemultiplier = .8;
});
});
would be better than the code listed in the SourceForge address.
It is also possible to set the scriptminsize as well, which controls the smallest size that is allowed (default is 8pt as I recall).
Note that this affects ALL super- and subscripts, not just the roots.
I'd also like to target that nth-root character (but no others) with the "\sf" handle, to help readability.
I don't know of a reasonable way to do that. The AsciiMath input jax uses the ASCIIMathML code directly, and that is not designed for user modification, as MathJax is. So there is no easy place to patch into that. It would be possible to use the postfilter hook to walk the resulting MathML tree and look for roots, but I don't think it is worth it. Changing the script multiplier probably is enough. Or setting the global math scaling factor might be a better alternative.
While I'm at it, I'd like to ask how to increase the size of fractional exponents, e.g. the "m" and "n" in a^(m/n).
The code above will do that (along with all other exponents). Again, it is not easy to target a specific situation, but you can change the global multiplier.
Thanks very much, Davide
However, the following is giving me a "Math processing error":
MathJax.Hub.Register.StartupHook("AsciiMath Jax Ready",function () {
MathJax.InputJax.AsciiMath.postfilterHooks.Add(function () {
data.math.root.scriptsizemultiplier = .8;
});
});
I'm putting it after this: MathJax.Hub.Config({ *** });
Commenting out the following line removes the error, so I suspect that's where the issue is: data.math.root.scriptsizemultiplier = .8;
Regards
Muray
Sorry, miscopied it. It should be
MathJax.Hub.Register.StartupHook("AsciiMath Jax Ready",function () {
MathJax.InputJax.AsciiMath.postfilterHooks.Add(function (data) {
data.math.root.scriptsizemultiplier = .8;
});
});
(note that "data" in the prefilter hook function definition).
Perfect! Improves readability immensely.
Thank you so much for your prompt reply.
Regards