I am trying to compile a YiHui BIG5 example (knitr with Chinese content). I used a Mac OSX snow blower, the latest RStudio, pdfLatex (same result with XeLatex). This is an excerpt from raw.Rnw
\begin{document}
\title{knitr與繁體中文文檔}
\author{謝益輝}
測試,咳咳。以下代碼靠譜嗎?
<<test>>=
1+1
'引號能用嗎?'
rnorm(5)
(function(){
paste('這裡是字符串')
})()
@
Using the standard encoding system "UTF-8", the resulting pdf file
1+1
''
rnorm(5)
(function(){ paste('') })()
since you can see that the Chinese are just an empty place. Then I saved .Rnw with BIG5 encoding and compile again. The resulting pdf file will look like this:
AyyCHUNXaH
1+1
'H'
rnorm(5)
(function(){ paste('oOr') })()
This time, the Chinese become random letters.
What else can I do? Totally new to wrt Coding / national_version.
source
share