rmarkdown:如何为一个文档使用多个参考书目

rmarkdown: how to use multiple bibliographies for a document

[我的环境:Win 7 Pro / R 3.2.1 / knitr_1.12.3 / R Studio Version 0.99.892]

我正在尝试使用 R Studio、Knit -> PDF 以 .Rmd 格式撰写文章,并且我一直在关注 http://rmarkdown.rstudio.com/authoring_bibliographies_and_citations.html 以了解如何获取 pandoc 的详细信息和 pandoc-citeproc 生成参考部分和引文 在文中。

我的 BibTeX 参考资料在几个不同的 .bib 文件中,当使用 .Rnw 文件中的 LaTeX,都可以在 我的本地 texmf 树 中找到,通过

\bibliography{statistics, graphics}

我似乎无法使用 pandoc-citeproc 完成这项工作。我的 YAML header 具有以下内容,适用于 one .bib 文件,只要它是 在与源 .Rmd 文件相同的目录中:

    ---
    title: "Notes on Testing Equality of Covariance Matrices"
    author: "Michael Friendly"
    date: '`r format(Sys.time(), "%B %d, %Y")`'
    output:
      pdf_document:
        fig_caption: yes
        keep_tex: yes
        number_sections: yes
    csl: apa.csl
    bibliography: statistics.bib
    ---

根据上面给出的 link 中的建议,我尝试了:

bibliography: [statistics.bib,graphics.bib]

这给出:

pandoc-citeproc.exe: "stdin" (line 50, column 12):
unexpected ":"
expecting letter, digit, white space or "="
pandoc.exe: Error running filter pandoc-citeproc
Filter returned error status 1

[编辑:为了完整性,我展示了生成的 pandoc 命令,看起来两个 .bib 文件都正确传递了]:

"C:/Program Files/RStudio/bin/pandoc/pandoc" +RTS -K512m -RTS EqCov.utf8.md --to latex --from markdown+autolink_bare_uris+ascii_identifiers+tex_math_single_backslash --output EqCov.pdf --template "C:\R\R-3.2.1\library\rmarkdown\rmd\latex\default-1.15.2.tex" --number-sections --highlight-style tango --latex-engine pdflatex --variable graphics=yes --variable "geometry:margin=1in" --bibliography statistics.bib --bibliography graphics.bib --filter pandoc-citeproc 
output file: EqCov.knit.md

以下所有表格也是如此:

    bibliography: ["statistics.bib","graphics.bib"]

    bibliography: 
      - "statistics.bib"
      - "graphics.bib"

    bibliography: 
      - statistics.bib
      - graphics.bib

理想情况下,我希望能够使用以下表格之一,而不必将 .bib 文件复制到文档目录。

bibliography: ["C:/Dropbox/localtexmf/bibtex/bib/statistics.bib","C:/Dropbox/localtexmf/bibtex/bib/graphics.bib"]

bibliography: 
 - "C:/Dropbox/localtexmf/bibtex/bib/statistics.bib"
 - "C:/Dropbox/localtexmf/bibtex/bib/graphics.bib"

郑重声明:我在 https://github.com/jgm/pandoc-citeproc/issues/220

向 pandoc-citeproc 提出了这个问题

事实证明,pandoc-citeproc 如何处理 @{string={}} 中的某些字符和 .bib 文件中的 non-ASCII 字符存在问题,所以我现在尝试的方法有效,具有 hard-coded 个路径名,采用我尝试过的所有形式。

为了使它更像通过 Latex/bibtex 处理 .Rnw 文件,最好能够使用类似

的东西
bibliography: 
  - `r system(kpsewhich statistics.bib)`
  - `r system(kpsewhich graphics.bib)`

这些命令 do 在 R session 中找到正确的文件,但在 YAML header 中找不到。