2015-09-26 191 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