I am using a string as my source for an equation, and whenever I try to add something like an overbar tag which is:
\ov5\ - creates a bar over the 5
However, when I add this into a Java string, for it to compile I am required to write it like this:
string x= "\\ov5\\";
It would appear that this way breaks JQMath and doesn't work, resulting in a broken equation. Here is the code in case I did something terribly wrong:
WebView webView;
String functext = "$$\\ov55\\$$";
js = "<html><head>"
+ "<link rel='stylesheet' href='file:///android_asset/mathscribe/jqmath-0.4.3.css'>"
+ "<script src='file:///android_asset/mathscribe/jquery-1.4.3.min.js'></script>"
+ "<script src='file:///android_asset/mathscribe/jqmath-etc-0.4.3.min.js'></script>"
+ "</head><body>"
+ functext + "</body></html>";
webView.loadDataWithBaseURL("", js, "text/html", "UTF-8", "");
EDIT: For clarification, the end result oddly reads "$$\\ov55$$".
Please note that when I try the same string on JQMath's website page here , it works as intended.
EDIT2: Here are some debug values for a breakpoint placed at webView.loadDataWithBaseURL:
actual string: String functext = "$$\\\\\\\\ov55\\\\\\\\$$";
actual displayed result: $$\\ov55\\$$
debug results:
functext = $$\\ov55\\$$
js = <html><head><link rel='stylesheet' href='file:///android_asset/mathscribe/jqmath-0.4.3.css'><script src='file:///android_asset/mathscribe/jquery-1.4.3.min.js'></script><script src='file:///android_asset/mathscribe/jqmath-etc-0.4.3.min.js'></script></head><body>$$\\ov55\\$$</body></html>
Any help with loading it in another way other than a string would help greatly.
I think you want this:
String functext = "$$\\ov55\\$$";
(The first \\
needs to be before the ov
operator.)
EDIT: Another possibility (since the above was evidently just a typo in your post, not in your code) is that somewhere in the pipeline the string is being interpolated a second time. In that case, you would need to double-escape the backslashes:
String functext = "$$\\\\ov55\\\\$$";
PS If the end result reads "$$\\ov55$$"
then the problem seems to be before jqmath sees anything. The code you posted definitely does not produce that result for me.
Also jqMath accepts ` (backquote) in place of \\ if that makes things easier. Finally, I'd put a space between the ov and the 5 to clarify that it's not a macro named ov5. (Plus see my comment above to remove the final \\.)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.