Local configuration file processing is extremly slow (~15 sec)

111 views
Skip to first unread message

nin...@gmail.com

unread,
May 20, 2014, 3:42:25 PM5/20/14
to mathja...@googlegroups.com
Hello!

I'm using a local distribution of MathJax (both 2.3 final and 2.4 beta).
It works well and really fast as long as I don't add a local configuration file.

This is my starting page:


<html> <head> <title>SVGTEX</title> <script type="text/x-mathjax-config"> MathJax.Hub.Config({ showProcessingMessages: true, messageStyle: "normal", tex2jax: { inlineMath: [["$", "$"], ["\\(", "\\)"]] }, SVG: { linebreaks: { automatic: true, width: "container" }, blacker: 0.1, } }); </script> <script type="text/javascript" src="../MathJax/MathJax.js?config=TeX-AMS-MML_SVG,local/font"></script> </head> <body> <h1>svgtex bench file</h1> <p>TeX equation:</p> <div id="math-tex">${\frac{x}{2}}$</div> <p>MathML equation:</p> <div id="math-mml"> <math> <mfrac> <mi>y</mi> <mn>2</mn> </mfrac> </math> </div> </body> </html>

This is the referenced file MathJax/config/local/font.js:
MathJax.Hub.Config({SVG:{font:"TeX"}});



So nothing fancy. If I include the SVG font option in the main file, the processing is fast and normal, but in an extra file, it takes about 15 seconds, as you can see on the following screenshot:

https://lh4.googleusercontent.com/-Ip43tIsa8bY/U3uvSRfT8-I/AAAAAAAAAF4/fI1r4IH9lCE/s1600/laufzeit.png

I first suspected the relative paths might be of, but the config file is found in about 1 ms, and then the processing seems to stop (or run in loops or whatever) for 15 seconds.
I'm really not sure what's causing this.

Can anybody please help me with this or point me in a direction to search for errors?

Best regards,
Nikolai Neff

Davide P. Cervone

unread,
May 20, 2014, 5:25:36 PM5/20/14
to mathja...@googlegroups.com
You are missing the loacComplete() line in your configuration file, so MathJax waits 15 seconds before timing out and going on without it.  Add

Mathjax.Ajax.loadComplete("[Mathjax]/config/local/font.js");

at the bottom of your font configuration file and that should take care of it for you.

I'm not sure why you don't include the font configuration in your main x-mathjax-config block within the page, however.  Wouldn't that be easier?

Davide


--
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-user...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Nikolai Neff

unread,
May 21, 2014, 6:21:09 AM5/21/14
to mathja...@googlegroups.com
You received this message because you are subscribed to a topic in the Google Groups "MathJax Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/mathjax-users/iIvf2RkNdF4/unsubscribe.
To unsubscribe from this group and all its topics, send an email to mathjax-user...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Thank you,
this helped me fix the issue.
As for why I'm using a separate config file for the font: that file gets generated dynamically via PHP to be able to change the font before MathJax is started as ist is currently not possible to do this after the page has been loaded. And changing that one single file is much easier than messing with the DOM of the starting page.

best regards, Nikolai Neff

Reply all
Reply to author
Forward
0 new messages