r - 编译 pdf 输出时knitr -pandoc-citeproc 错误

标签 r knitr r-markdown pandoc

有人可以帮我解决这个错误吗? 当我尝试使用外部 latex .bib 文件编译西类牙语 .Rmd 文档时,出现下一个错误

---
title: "Untitled"
output: 
  pdf_document: 
    fig_caption: yes
bibliography: biblio.bib
lang: spanish
---

错误消息是:

  |.................................................................| 100%
label: unnamed-chunk-3 (with options) 
List of 2
 $ echo   : logi FALSE
 $ results: chr "asis"


/usr/bin/pandoc bib.utf8.md --to latex --from markdown+autolink_bare_uris+ascii_identifiers+tex_math_single_backslash --output bib.pdf --filter /usr/bin/pandoc-citeproc --template /home/juanchi/R/x86_64-pc-linux-gnu-library/3.2/rmarkdown/rmd/latex/default.tex --highlight-style tango --latex-engine pdflatex --variable 'geometry:margin=1in' --bibliography biblio.bib 
output file: bib.knit.md

pandoc-citeproc: could not find locale data for spanish
pandoc: Error running filter /usr/bin/pandoc-citeproc
Filter returned error status 1
Error: pandoc document conversion failed with error 83

此 session 信息:

> sessionInfo()
R version 3.2.2 (2015-08-14)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 15.10

locale:
 [1] LC_CTYPE=pt_BR.UTF-8       LC_NUMERIC=C               LC_TIME=pt_BR.UTF-8       
 [4] LC_COLLATE=es_ES.UTF-8     LC_MONETARY=pt_BR.UTF-8    LC_MESSAGES=es_ES.UTF-8   
 [7] LC_PAPER=pt_BR.UTF-8       LC_NAME=C                  LC_ADDRESS=C              
[10] LC_TELEPHONE=C             LC_MEASUREMENT=pt_BR.UTF-8 LC_IDENTIFICATION=C       

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

loaded via a namespace (and not attached):
[1] htmltools_0.2.6   tools_3.2.2       yaml_2.1.13       rmarkdown_0.6.2.2
[5] knitr_1.10.5      digest_0.6.8  

如果我将其分开,它会起作用:

---
title: "Untitled"
output: 
  pdf_document: 
    fig_caption: yes
bibliography: biblio.bib
---

---
title: "Untitled"
output: 
  pdf_document: 
    fig_caption: yes
lang: spanish
---

当我尝试更改 yaml 时

lang: es-ES

给出了这个错误:

! Package babel Error: Unknown option `es-ES'. Either you misspelled it
(babel)                or the language definition file es-ES.ldf was not found.


See the babel package documentation for explanation.
Type  H <return>  for immediate help.
 ...                                              

l.299 \ProcessOptions*

pandoc: Error producing PDF from TeX source
Erro: pandoc document conversion failed with error 43

最佳答案

您的rmarkdown版本似乎太旧了。我想你需要update.packages(ask = FALSE) 。最新版本的rmarkdown使得不使用pandoc-citeproc成为可能当您使用 citation_package 时处理引用书目pdf_document 的参数,例如

---
title: "Untitled"
output: 
  pdf_document: 
    fig_caption: yes
    citation_package: natbib
bibliography: biblio.bib
lang: spanish
---

关于r - 编译 pdf 输出时knitr -pandoc-citeproc 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35103571/

相关文章:

r - 将代码块从一个 Rmarkdown 文档插入另一个文档

r - 在 knitrout 环境之后确保相同的垂直空间

html - 使用 Shiny 链接到 RMarkdown 上的本地 html 文件

r - 使用 rmarkdown::render 设置文档标题(标题、作者、日期)

R-项目错误消息 - 无法读取表格

r - 我如何做一个只在特定日期标准之间查找的条件总和

r - 用 SVD 矩阵预测

r - 使用 Knitr 将绘图居中到页面中间

html - 如何在 Rmarkdown html 输出中有一个 float 图像?

r - 将矩阵拆分为大小为 n 的 block ,偏移量为 i(矢量化方法)