2016-01-23 72 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

謝謝你,它的工作 –