Load and render

133 views
Skip to first unread message

Rafael Hernández

unread,
Nov 29, 2012, 10:43:18 AM11/29/12
to mathja...@googlegroups.com
Hello,

I test your framework, its great job. But I have and issue with when my page load, first appear my asciimath code and then its transform to math view. Is there any way to avoid view ascii source code.?

And other question is: compatibility with mathMl 3.0 or 2.0?

Thanks

Regards

Rafa

Frédéric WANG

unread,
Dec 6, 2012, 6:57:34 AM12/6/12
to mathja...@googlegroups.com, rhern...@rhsoft.es
Hola,

You can try to use the option preview: "none" for the asciimath2jax preprocessor:

http://docs.mathjax.org/en/latest/options/asciimath2jax.html

MathJax is compatible with MathML 2 and 3, although all the features are not supported yet.
-- 
Frédéric Wang
maths-informatique-jeux.com/blog/frederic

Davide Cervone

unread,
Dec 18, 2012, 6:55:28 PM12/18/12
to mathja...@googlegroups.com
I test your framework, its great job.

Thank you for your kind words.

But I have and issue with when my page load, first appear my asciimath code and then its transform to math view. Is there any way to avoid view ascii source code.?

Because MathJax can't alter the page until it is actually loaded, you will see the original AsciiMath markup before MathJax has a chance to typeset it.  There are a couple of possible approaches to dealing with this, though none is entirely satisfactory.

One is to enclose all the math in tags that have a CSS class that is initially set to visibility:hidden (don't use display:none, as the results will be poor), and then set the CSS for that class to visibility:visible when MathJax is finished.  Here is one way to accomplish that:

<!DOCTYPE html>
<html>
<head>
<title>Hide AsciiMath Until it is Typeset</title> 

<style id="hidden_math">
  .amath {visibility: hidden}
</style>

<script type="text/x-mathjax-config">
MathJax.Hub.Queue(function () {
  var sheet = document.getElementById("hidden_math");
  sheet.disabled = true;   // disable the style sheet that is hiding the mathematics
});
</script>
<script type="text/javascript" src="../MathJax/MathJax.js?config=AM_HTMLorMML"></script>

</head>
<body>

<span class="amath">`(x+1)/(x-1)`</span>

</body>
</html>

This will prevent the AsciiMath from being seen, but you will initially see blank spaces where the math will eventually go.  An alternative is to hide the entire page until the math is typeset.  For example

<!DOCTYPE html>
<html>
<head>
<title>Hide Entier Page Until it is Typeset</title>

<script type="text/x-mathjax-config">
MathJax.Hub.Queue(function () {
  document.getElementById("hide_page").style.visibility = "";
});
</script>
<script type="text/javascript" src="../MathJax/MathJax.js?config=AM_HTMLorMML"></script>

</head>
<body>
        <div id="hide_page" style="visibility:hidden">

`(x+1)/(x-1)`

        </div>
</body>
</html>

Here the main container <div> is set to have visibility:hidden and that is removed when MathJax is done typesetting.  This is reasonable if there is a small amount of math on the page, as otherwise the user might have to wait a long time before the page is visible.

And other question is: compatibility with mathMl 3.0 or 2.0?

MathJax implements most of MathML3.0, but there are still some missing pieces (most notably the elementary math tags).

Hope that helps.

Davide

Paul Wiegers

unread,
Feb 1, 2013, 2:05:07 AM2/1/13
to mathja...@googlegroups.com
Davide,

 
One is to enclose all the math in tags that have a CSS class that is initially set to visibility:hidden (don't use display:none, as the results will be poor), and then set the CSS for that class to visibility:visible when MathJax is finished.  Here is one way to accomplish that:

I used this technique, and it works great. I needed two divs around the math, one to hold the space open for the math to render. But it looks better this way than the page jumping around.

Thanks again, this usergroup is a treasure trove of information! 

Paul
Reply all
Reply to author
Forward
0 new messages