简体   繁体   中英

Package inputenc Error & Error: pandoc document conversion failed with error 43

I was trying to produce a PDF file with the knitr in RStudio but I encountered a problem. I have read a lot of solutions found on stack overflow and google but they are not very helpful. Could anyone please help me with this? Much obliged!

The error is shown as below:

output file: final_project.knit.md

"C:/Users/JOHNL_~1/AppData/Local/Pandoc/pandoc" +RTS -K512m -RTS final_project.utf8.md --to latex --from markdown+autolink_bare_uris+ascii_identifiers+tex_math_single_backslash --output final_project.pdf --template "E:\R\R-3.2.3\library\rmarkdown\rmd\latex\default-1.15.2.tex" --highlight-style tango --latex-engine pdflatex --variable graphics=yes --variable "geometry:margin=1in" 
! Package inputenc Error: Unicode char 骞?(U+5E74)
(inputenc)                not set up for use with LaTeX.

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

l.128 \maketitle

Try running pandoc with --latex-engine=xelatex.
pandoc.exe: Error producing PDF
Error: pandoc document conversion failed with error 43
In addition: Warning message:
running command '"C:/Users/JOHNL_~1/AppData/Local/Pandoc/pandoc" +RTS -K512m -RTS final_project.utf8.md --to latex --from markdown+autolink_bare_uris+ascii_identifiers+tex_math_single_backslash --output final_project.pdf --template "E:\R\R-3.2.3\library\rmarkdown\rmd\latex\default-1.15.2.tex" --highlight-style tango --latex-engine pdflatex --variable graphics=yes --variable "geometry:margin=1in"' had status 43 
Execution halted

Specification:

  1. Window 8.1 64
  2. RStudio version: 0.99.891 Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/538.1 (KHTML, like Gecko) rstudio Safari/538.1 Qt/5.4.1
  3. MikTeX: version 2.9.5840 (basic)
  4. pandoc

Others

I have tried most solutions I can find from stack overflow and it did not work. So I am afraid solutions like adding latex_engine: xelatex will also fail to solve this.

Could anyone please help me? Thanks a lot!

Best

I have figured out what the problem is, that you have to choose WINDOWS-1252 as your text encoding.

If you have set other types as default, change it at tools> global options > code > saving, choose [Ask] in the default text encoding.

Hope that works for you.

I do not think that it is workable way by switching something or set something. Just carefully check your code, particularly the part you copy from somewhere, not type it by your self.

I have the same problem recently.

I show you How I solve this problem.

I remove the code from the R markdown part by part to find which part caused this problem. Finally, I found the below part that resulted in the error in my code.

### Platform:Affymetrix A-AFFY-2-Affymetrix GeneChip Arabidopsis Genome [ATH1-121501].

I remember I copy this information from webpage. So I delete them and type this part by myself. It can run and generate the pdf file without any error.

To be clear, I show you the difference between the copy version and the version of my typing:

在此处输入图片说明

This is just one example I think. I want to point out that it is always problematic when you copy something from an unknown resource file into your code.

Hope this can help you and other people who were frustrated by this problem.

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM