1

So here's my code:

webView = (WebView) findViewById(R.id.layout_webview);
WebSettings webSettings = webView.getSettings();
webSettings.setJavaScriptEnabled(true);
String js = "<html><head>"
       + "<link rel='stylesheet' href='file:///android_asset/mathscribe/jqmath-0.4.0.css'>"
       + "<script src = 'file:///android_asset/mathscribe/jquery-1.4.3.min.js'></script>"
       + "<script src = 'file:///android_asset/mathscribe/jqmath-etc-0.4.2.min.js'></script>"
       + "</head><body>"
       + "<script>var s =   '$$x={-b±√{b^2-4ac}}/{2a}$$';M.parseMath(s);document.write(s);</script> </body>";
webView.loadDataWithBaseURL("", js, "text/html", "UTF-8", "");

Even though I set the fontsize to 100 the equation doesn't change in size at all no matter what number I set in the font size. Is there a way to increase the font size of the equation?

VividD
  • 10,456
  • 6
  • 64
  • 111
xeno
  • 33
  • 4

1 Answers1

0

It is not clear where and when you set the font size to 100 (as it is not apparent in the code you posted).

According to this other answer you should set the font size after loading jqmath-x.y.css in order to override the values it contains.

Try setting it in the JavaScript after the code you posted. Something like document.body.style.fontSize = "100pt"; after your document.write for example.

var s = '$$x={-b±√{b^2-4ac}}/{2a}$$';
M.parseMath(s);
document.write(s);
document.body.style.fontSize = "40pt";
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.3/jquery.min.js"></script>
<link rel="stylesheet" type="text/css" href="http://mathscribe.com/mathscribe/jqmath-0.4.0.css" />
<script type="text/javascript" src="http://mathscribe.com/mathscribe/jqmath-etc-0.4.0.min.js"></script>
Community
  • 1
  • 1
Cimbali
  • 11,012
  • 1
  • 39
  • 68
  • I tried this but it doesn't work. It increases the font size of the "x=" but not the rest. Here's the updated code: + "

    ";

    – xeno Dec 25 '14 at 22:40
  • Well it works fine in a browser, but I can't exactly test it in an Android project as you have it. – Cimbali Dec 25 '14 at 22:42