简体   繁体   English

包 inputenc 错误和错误:pandoc 文档转换失败,错误 43

[英]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.我试图在 RStudio 中使用 knitr 生成 PDF 文件,但遇到了问题。 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窗口 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 RStudio 版本: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) MikTeX:版本 2.9.5840(基本)
  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.所以我担心像添加latex_engine: xelatex这样的解决方案也无法解决这个问题。

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.我已经弄清楚问题是什么,您必须选择 WINDOWS-1252 作为您的文本编码。

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.我从 R markdown 中逐个删除代码以查找导致此问题的部分。 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.它可以运行并生成pdf文件而不会出现任何错误。

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.希望这可以帮助您和其他因这个问题而感到沮丧的人。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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