包inputenc错误:RStudio中的Unicode char\u8

Ani*_*aul 20 pdf markdown r rstudio knitr

在RStudio中,当我将我的Markdown文件转换为PDF时,它会给我错误:

输出文件:report.knit.md

!包inputenc错误:Unicode char\u8:未设置为与LaTeX一起使用.

有关说明,请参阅inputenc软件包文档.输入H即可获得帮助....

l.117表现为32辆汽车(1973年

尝试使用--latex-engine = xelatex运行pandoc.pandoc.exe:从TeX源生成PDF时出错错误:pandoc文档转换失败,错误43另外:警告消息:正在运行命令'"C:/ Program Files/RStudio/bin/pandoc/pandoc"+ RTS -K512m -RTS报告.utf8.md --to latex --from markdown + autolink_bare_uris + ascii_identifiers + tex_math_single_backslash-implicit_figures --output report.pdf --template"C:\ Users\USER\Documents\R\win-library\3.2\rmarkdown\rmd\latex\default.tex"--highlight-style tango --latex-engine pdflatex --variable"geometry:margin = 1in"'have status 43执行暂停

我的R版本(Windows 7):

R version 3.2.1 (2015-06-18) -- "World-Famous Astronaut" Copyright (C) 2015 The R Foundation for Statistical Computing Platform: x86_64-w64-mingw32/x64 (64-bit)

sva*_*noy 29

鉴于几乎相同的错误消息,我尝试遵循@ scoa的建议,但是将该行放在YAML标题中并没有改变错误,所以无论出于何种原因,Knitr都没有在那里确定LaTex引擎.但是,控制栏中的"Knit PDF"按钮旁边是一个设置菜单,允许您指定在"高级"窗格中结束的LaTex.这解决了我的问题.它会对上面的建议产生轻微的变化,从而修改YAML标题:

  output:
     pdf_document:
         latex_engine: xelatex
Run Code Online (Sandbox Code Playgroud)

我可以看到@scoa可能认为YAML输出已经按照这种方式格式化了,但我遗漏的是'pdf_document'之后的冒号.使用设置对话框在标题中创建了正确的语法.

RStudio版本0.99.896,编织版本1.12.3.

在此输入图像描述

  • 我使用了你的解决方案,尽管没有检索到错误,它显示了纯乳胶代码knitr.v`1.15.1`. (2认同)