2015-09-26 192 views
9

在RStudio,统一字符\ U8,当我去为我的降价文件转换为PDF,然后它给我的错误:包装inputenc错误:RStudio

output file: report.knit.md

! Package inputenc Error: Unicode char \u8: not set up for use with LaTeX.

See the inputenc package documentation for explanation. Type H for immediate help. ...

l.117 performance for 32 automobiles (1973â

Try running pandoc with --latex-engine=xelatex. pandoc.exe: Error producing PDF from TeX source Error: pandoc document conversion failed with error 43 In addition: Warning message: running command '"C:/Program Files/RStudio/bin/pandoc/pandoc" +RTS -K512m -RTS report.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"' had status 43 Execution halted

我的[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)

+1

盲目,你有没有定义编码? '\ usepackage [utf8] {inputenc}' –

+3

错误消息提示“尝试使用--latex-engine = xelatex运行pandoc”。这是通过在输出:pdf_document下的yaml头文件中添加'latex_engine:xelatex'完成的。 – scoa

+0

仅供参考'\ usepackage [utf8] {inputenc}'也''latex_engine:xelatex'也不@Svannoy的答案为我工作。所以这仍然是一个悬而未决的问题,应该给予奖励。 – warship

回答

10

鉴于几乎相同的错误消息,我尝试以下@ SCOA的建议,而是把该行的YAML头并没有更改错误,所以无论出于何种原因,Knitr不注意有确定乳胶发动机。但是,控制栏中的“编织PDF”按钮旁边是一个设置菜单,您可以在“高级”窗格中指定LaTex结尾。这解决了我的问题。它生产的建议有轻微的变化上面,从而改变YAML头:

output: 
    pdf_document: 
     latex_engine: xelatex 

我可以看到@scoa可能承担的YAML输出已格式化的这种方式,但我缺少的是冒号后'pdf_document'。使用设置对话框在标题中创建适当的语法。

RStudio版本0.99.896,knitr版本1.12.3。

enter image description here

+1

我用你的解决方案和尽管没有检索错误,但它显示纯胶乳代码knitr.v'1.15.1'。 – Dambo