I am getting an error to knit a Rmd document to pdf. Here is the part of the code causing the error.
```{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")
```
This throws the following error when knitting to 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
I do not get the same error when I knit to html instead. Also, I have figured out the sources of error are the backspace \\b
and the newline \\n
characters in my code. But I cannot find a way to get around this.
在r代码块中使用tidy =F
选项似乎为我消除了错误。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.