我收到错误,将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
字符。但我无法找到解决这个问题的方法。
答案 0 :(得分:0)
使用r代码块中的tidy =F
选项似乎已经为我删除了错误。