0

I want to write table(matrix) with jqmath but the output is not correct .
I copy jqmath example .
there is my code :

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

the output is linear matrix like below :

enter image description here

I suggest that combine slash and t (\t)in " var s = '$( \table \ cos θ, - \sin θ; \sin θ, \cos θ) " cause this problem because the t character is gone and first line moved to right.

How I can solve this problem?

SOlVED if I replace every slash with 4 slash the result is correct ....

Mike
  • 4,550
  • 4
  • 33
  • 47
Kapta
  • 1,525
  • 14
  • 24

1 Answers1

0

I think it's best to replace the line:

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

with:

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

or:

        + "$(`table `cos θ, - `sin θ; `sin θ, `cos θ)$ gives a rotation by $θ$" +
Dave Barton
  • 1,429
  • 13
  • 12