Inputenc/Pandoc 在 Rstudio 版本 0.98.994 上编织到 Pdf 时出错
Inputenc/Pandoc error when knit to Pdf on Rstudio Version 0.98.994
我在将 Rmd 文档编织成 pdf 时遇到错误。这是导致错误的代码部分。
```{r chunk5 ,echo=F}
hypoconf<-function(z){if(z=="dose"){
cat(paste(as.character(1),"\b. If there is no difference in
tooth growth for" ,z, "of",as.character(20),"and"
as.character(10),"the probability of seeing the
observed or more extreme outcome is", as.character(30),"percent."))
cat("\n\n")
}
hypoconf("dose")
```
编织成 pdf 时会抛出以下错误。
output file: report2.knit.md
pandoc: Error producing PDF from TeX source.
! Package inputenc Error: Keyboard character used is undefined
(inputenc) in inputencoding `utf8'.
See the inputenc package documentation for explanation.
Type H <return> for immediate help.
...
l.260 \end{verbatim}
Try running pandoc with --latex-engine=xelatex.
Error: pandoc document conversion failed with error 43
Execution halted
当我编织到 html 时,我没有得到同样的错误。另外,我发现错误的来源是代码中的退格 \b
和换行 \n
字符。但是我找不到解决这个问题的方法。
在 r-code 块中使用 tidy =F
选项似乎已经为我消除了错误。
我在将 Rmd 文档编织成 pdf 时遇到错误。这是导致错误的代码部分。
```{r chunk5 ,echo=F}
hypoconf<-function(z){if(z=="dose"){
cat(paste(as.character(1),"\b. If there is no difference in
tooth growth for" ,z, "of",as.character(20),"and"
as.character(10),"the probability of seeing the
observed or more extreme outcome is", as.character(30),"percent."))
cat("\n\n")
}
hypoconf("dose")
```
编织成 pdf 时会抛出以下错误。
output file: report2.knit.md
pandoc: Error producing PDF from TeX source.
! Package inputenc Error: Keyboard character used is undefined
(inputenc) in inputencoding `utf8'.
See the inputenc package documentation for explanation.
Type H <return> for immediate help.
...
l.260 \end{verbatim}
Try running pandoc with --latex-engine=xelatex.
Error: pandoc document conversion failed with error 43
Execution halted
当我编织到 html 时,我没有得到同样的错误。另外,我发现错误的来源是代码中的退格 \b
和换行 \n
字符。但是我找不到解决这个问题的方法。
在 r-code 块中使用 tidy =F
选项似乎已经为我消除了错误。