【发布时间】:2016-02-20 08:06:33
【问题描述】:
我想在 Android 应用中离线渲染 MathML。我正在使用使用 MathJax 的 leathrum 的 APK。下面是设置 mathjax 离线配置的代码(http://cs.jsu.edu/~leathrum/mjapp-src/full/MainActivity.java):
webview.loadDataWithBaseURL("http://bar/", "<script type='text/x-mathjax-config'>"
+"MathJax.Hub.Config({ "
+"showMathMenu: false, "
+"jax: ['input/TeX','output/HTML-CSS'], " // output/SVG
+"extensions: ['tex2jax.js','toMathML.js'], "
+"TeX: { extensions: ['AMSmath.js','AMSsymbols.js',"
+"'noErrors.js','noUndefined.js'] }, "
//+"'SVG' : { blacker: 30, "
// +"styles: { path: { 'shape-rendering': 'crispEdges' } } } "
+"});</script>"
+"<script type='text/javascript' "
+"src='file:///android_asset/MathJax/MathJax.js'"
+"></script>"
+"<script type='text/javascript'>getLiteralMML = function() {"
+"math=MathJax.Hub.getAllJax('math')[0];"
// below, toMathML() rerurns literal MathML string
+"mml=math.root.toMathML(''); return mml;"
+"}; getEscapedMML = function() {"
+"math=MathJax.Hub.getAllJax('math')[0];"
// below, toMathMLquote() applies &-escaping to MathML string input
+"mml=math.root.toMathMLquote(getLiteralMML()); return mml;}"
+"</script>"
+"<span id='math'></span><pre><span id='mmlout'></span></pre>","text/html","utf-8","");
本地 Mathjax 在资产中。它可以正确呈现 Tex 输入,但我无法将其配置为将 MathML 作为输入并离线显示结果。
【问题讨论】:
-
您可能想提供更多背景信息。至少一个链接到你正在使用的任何东西。
-
我指的是cs.jsu.edu/wordpress/index.php/2012/08/01/…的代码它接受Tex输入并呈现输出。我想将 Mathml 作为输入并渲染输出。
-
Peter 的意思是您需要提供您正在使用的实际代码,而不是您为您的目的而修改的代码的链接(我们知道您必须修改它,因为您正在链接输入格式)。否则,我们几乎无法分析您的问题。