在Windows上编织以下文档dia.Rnw
时,只会打印出块(块)中的变音符号。与\Sexpr{}
内联打印它们按预期工作。
\documentclass[a4paper]{article}
\usepackage[utf8]{inputenc}
\begin{document}
<<c1>>=
sCaron <- "\u0161"
@
Priting the diacritic character \Sexpr{sCaron} inline with \verb|Sexpr{sCaron}| results in
the correct UTF-8 character in the .tex document.
Using a chunk/block (output is wrapped in a verbatim environment) does not print the right
character.
<<c2>>=
sCaron
@
\end{document}
文件保存为UTF-8,使用
调用knitr(版本1.11)knit("dia.Rnw", encoding = "UTF-8")
我的sessionInfo()
:
R版本3.2.2(2015-08-14)
平台: x86_64-w64-mingw32 / x64(64位)
在以下位置运行::Windows 7 x64(内部版本7601)Service Pack 1
区域设置: LC_COLLATE = German_Austria.1252,LC_CTYPE = German_Austria.1252,LC_MONETARY = German_Austria.1252,LC_NUMERIC = C,LC_TIME = German_Austria.1252
附加基础套餐 stats,graphics,grDevices,utils,datasets,methods,base
其他附件包 knitr_1.11,devtools_1.9.1.9000
通过命名空间(而非附加)加载: magrittr_1.5,formatR_1.2.1,tools_3.2.2,memoise_0.2.1,stringi_0.5-5,highr_0.5.1,stringr_1.0.0,digest_0.6.8,evaluation_0.8,fortunes_1.5-2