模板中的 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...
部分,play 会抱怨 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
控制器中创建一个方法即:
Create an method ie in Application.java
controller:
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屋!
查看全文