模板中的Latex指令导致"Unicode转义中的错误" [英] Latex directives in template are causing `error in unicode escape`
本文介绍了模板中的Latex指令导致"Unicode转义中的错误"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想在play framework 2.0模板中包含一些LaTEX代码,即:
I want to include some LaTEX code in play framework 2.0 template, namely:
\usepackage[T1]{fontenc}
\usepackage[latin9]{inputenc}
\usepackage{babel}
由于\us...
部分,当然比赛会抱怨error in unicode escape
错误消息.
Of course play complains with error in unicode escape
error message because of \us...
parts.
我应该如何转义这些文本,以便play编译模板并得到逐字LaTeX代码?用@Html()尝试了我的运气,但这也不起作用...
How should I escape those pieces of text, so play compiles the template and I get verbatim LaTeX code in result? Tried my luck with @Html(), but it doesn't work either...
推荐答案
在Application.java
控制器中创建方法:
public static String latex(String s){
return "\\"+s;
}
因此您可以在视图中使用它:
So you can use it in the view:
@Application.latex("usepackage[T1]{fontenc}")
@Application.latex("usepackage[latin9]{inputenc}")
@Application.latex("usepackage{babel}")
这篇关于模板中的Latex指令导致"Unicode转义中的错误"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文