MathJax 2.5 on Android

20 views
Skip to first unread message

smartcalcula...@gmail.com

unread,
Jul 28, 2015, 11:37:52 AM7/28/15
to MathJax Users
I have just seen that MathJax 2.5 is out and the specs say it has some huge speed up benefits. Can I have some sample code of how I can incorporate 2.5 into android webview. I currently have:

localWebView.loadDataWithBaseURL("http://bar", "<script type='text/x-mathjax-config'>"
+ "MathJax.Hub.Config({ "
+ "showMathMenu: false, "
+ "jax: ['input/TeX','output/HTML-CSS'], "
+ "extensions: ['tex2jax.js'], "
+ "TeX: { extensions: ['AMSmath.js','AMSsymbols.js',"
+ "'noErrors.js','noUndefined.js'] } "
+ "});</script>"
+ "<script type='text/javascript' "
+ "src='file:///android_asset/MathJax/MathJax.js'"
+ "></script><span id='text'></span>"
+ "<span id='math'></span>", "text/html", "utf-8", "");
localWebView.setWebViewClient(new WebViewClient() {
@Override
public void onPageFinished(WebView view, String url) {
super.onPageFinished(view, url);
if (!url.startsWith("http://bar")) return;
localWebView.loadUrl("javascript:document.getElementById('math').innerHTML='"
+ doubleEscapeTeX(initialStringLoaded) + "'");
if (android.os.Build.VERSION.SDK_INT < 19) {
localWebView.loadUrl("javascript:MathJax.Hub.Queue(['Typeset',MathJax.Hub]);");
} else {
localWebView.evaluateJavascript("javascript:MathJax.Hub.Queue(['Typeset',MathJax.Hub]);", null);
}
}
});

What files do I need to download ?
Reply all
Reply to author
Forward
0 new messages