[英]Correct. escape sequence for over bar?
I am using a string as my source for an equation, and whenever I try to add something like an overbar tag which is: 我使用字符串作为方程式的来源,每当尝试添加类似overbar标记的东西时,它就是:
\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: 但是,当我将其添加到Java字符串中以进行编译时,我需要这样编写它:
string x= "\\ov5\\";
It would appear that this way breaks JQMath and doesn't work, resulting in a broken equation. 看来这种方式破坏了JQMath并且不起作用,从而导致方程破坏。 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$$". 编辑:为澄清起见,最终结果奇怪地显示为“ $$ \\ ov55 $$”。
Please note that when I try the same string on JQMath's website page here , it works as intended. 请注意,当我尝试JQMath的网站页面上相同的字符串在这里 ,它按预期工作。
EDIT2: Here are some debug values for a breakpoint placed at webView.loadDataWithBaseURL: EDIT2:以下是放置在webView.loadDataWithBaseURL上的断点的一些调试值:
actual string: String functext = "$$\\\\\\\\ov55\\\\\\\\$$"; 实际字符串:字符串functext =“ $$ \\\\\\\\ ov55 \\\\\\\\ $$”;
actual displayed result: $$\\ov55\\$$ 实际显示结果:$$ \\ 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.) (第一个
\\
必须在 ov
运算符之前 。)
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. PS:如果最终结果为
"$$\\ov55$$"
则问题似乎出在jqmath看到任何东西之前。 The code you posted definitely does not produce that result for me. 你的代码贴绝对不会产生这一结果对我来说。
Also jqMath accepts ` (backquote) in place of \\ if that makes things easier. 如果jqMath使事情变得更容易,它也接受`(反引号)代替\\。 Finally, I'd put a space between the ov and the 5 to clarify that it's not a macro named ov5.
最后,我将在ov和5之间放置一个空格,以阐明它不是名为ov5的宏。 (Plus see my comment above to remove the final \\.)
(此外,请参阅上面的我的评论以删除最终的\\。)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.