0

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

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);    

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

在此处输入图像描述

我建议在“ var s = '$( \table \ cos θ, - \sin θ; \sin θ, \cos θ) ”中组合斜杠和 t (\t) 会导致这个问题,因为 t 字符首先消失了线向右移动。

我该如何解决这个问题?

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

4

1 回答 1

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 $θ$" +
于 2016-01-24T21:14:23.813 回答