jqmath无法渲染矩阵?

时间:2016-01-23 20:58:10

标签: android jqmath

我想用jqmath写表(矩阵),但输出不正确 我复制jqmath example 有我的代码:

webView = (WebView) findViewById(R.id.wv);
WebSettings settings = webView.getSettings();
settings.setJavaScriptEnabled(true);

String path="file:///android_asset/mathscribe/";
String js = "<html><head>"
        + "<link rel='stylesheet' href='"+path+"jqmath-0.4.3.css'>"
        + "<script src='"+path+"jquery-1.4.3.min.js'></script>"
        + "<script src='"+path+"jqmath-etc-0.4.3.min.js' charset=\"utf-8\"></script>"
        + "</head><body>"
        + "<script>var s = '$(\\table \\ cos θ, - \\sin θ; \\sin θ, \\cos θ)$ gives a rotation by $θ$';M.parseMath(s);document.write(s);</script>" 
        + "</body>";
webView.loadDataWithBaseURL("file:///android_asset/mathscribe/", js, "text/html", "UTF-8", null);    

输出是线性矩阵,如下所示:

enter image description here

我建议在“var s ='$( \ table \cosθ, - \sinθ; \sinθ,\cosθ)”中结合使用斜杠和t(\ t)“原因这个问题是因为t字符消失了,第一行移到了右边。

我如何解决这个问题?

解决     如果我用4斜杠替换每个斜杠,结果是正确的....

1 个答案:

答案 0 :(得分:0)

我认为最好更换一行:

        + "<script>var s = '$(\\table \\ cos θ, - \\sin θ; \\sin θ, \\cos θ)$ gives a rotation by $θ$';M.parseMath(s);document.write(s);</script>" +

使用:

        + "$(\\table \\cos θ, - \\sin θ; \\sin θ, \\cos θ)$ gives a rotation by $θ$" +

或:

        + "$(`table `cos θ, - `sin θ; `sin θ, `cos θ)$ gives a rotation by $θ$" +