2016-01-23 97 views
0

我想用jqmath编写表格(矩阵),但输出不正确。
我复制jqmath example
有我的代码: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);  

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

enter image description here

我建议在“结合斜线和t(\ t)的变种S =“$(由于t字符消失并且第一行移动到右侧,所以导致这个问题。

我该如何解决这个问题?

解决 如果我更换每削减与斜线4的结果是正确的....

回答

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 $θ$" + 
+0

谢谢你,它的工作 –