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

knitr-pandoc citeproc编译pdf输出时出错,r,knitr,r-markdown,pandoc,R,Knitr,R Markdown,Pandoc,有人能帮我解决这个错误吗? 当我试图用一个外部的latex.bib文件编译一个西班牙语.Rmd文档时,我遇到了下一个错误 --- title: "Untitled" output: pdf_document: fig_caption: yes bibliography: biblio.bib lang: spanish --- 错误消息是: |.................................................................|

有人能帮我解决这个错误吗? 当我试图用一个外部的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
使用此会话信息:

> 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
---

当我尝试改变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
!包babel错误:未知选项“es”。要么你拼错了
(babel)或未找到语言定义文件es-es.ldf。
有关说明,请参阅babel软件包文档。
键入H以获得即时帮助。
...                                              
l、 299\ProcessOptions*
pandoc:从TeX源生成PDF时出错
错误:pandoc文档转换失败,错误为43

您的r标记版本似乎太旧了。我认为您需要
update.packages(ask=FALSE)
。最新版本的rmarkdown使您在使用
pdf\u文档
引文包
参数时,可以不使用
pandoc citeproc
处理参考书目,例如

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

西班牙语
似乎不是有效的语言代码;您可以使用某个
es XX
XX
可以是
es
CL
,或者
MX
:)@Yihui只需添加yaml lang:es并将locales-es-es.xml文件复制到工作目录?无需复制该文件。只需尝试将
lang:spanish
更改为
lang:es
。我不确定这是否有效。@Yihui我编辑了答案…对不起,我当时不知道。“rmarkdown的最新版本”哪个版本?我是从康达安装的,遇到这个错误,有很多版本可供选择。谢谢
---
title: "Untitled"
output: 
  pdf_document: 
    fig_caption: yes
    citation_package: natbib
bibliography: biblio.bib
lang: spanish
---