使用`knitcitations`包附加.csl,.bib文件的任何方式?

Any way of attaching .csl, .bib files by using `knitcitations` package?

我试图通过在 myPkg_vignette.Rmd 上使用 knitcitations 包来附加 bibliography.bib, nature.csl 文件,但是当我执行 .Rmd 文件时,出现以下错误:

pandoc-citeproc.exe: Could not find bibliography.bib
pandoc.exe: Error running filter pandoc-citeproc
Filter returned error status 1
Error: pandoc document conversion failed with error

我查看了 knitcitations 手册以及如何方便地附加 .csl, .bib 文件,但我收到警告并且无法将这些文件附加到 myPkg_vignette.Rmd

编辑 :

这是 bibliography.bib 的上下文:

@article{Vahid_Jalili_Musera_2015,
         title  = "MuSERA: Multiple Sample Enriched Region Assessment",
         author = {Vahid Jalili, Matteo Matteucci, Marco Masseroli, Marco J. Morelli},
         journal = "Briefings in Bioinformatics",
         year    = "2016",
         pages   = "1-15",
           url     = {http://bib.oxfordjournals.org/content/early/2016/03/23/bib.bbw029.abstract?keytype=ref&ijkey=8IlROGziM9XA7NS},
         doi     = "10.1093/bib/bbw029 ",
}

如何轻松地将 bibliography.bibnature.csl 附加到包裹的小插图上?我在 SO 中阅读了一些 post 并且我对给定的解决方案感到困惑。我对使用 knitcitations 包很陌生,我可能会以正确的方式附加 .bib, .csl files 出错。谁能帮我解决 Rstudio 中的这个问题?任何想法 ?非常感谢:)

新编辑 :

我已阅读 this post 并遵循了解决方案:

setwd('C:/Users/me/Documents/myPkg')
Sys.setenv(TEXINPUTS=getwd(),
           BIBINPUTS=getwd(),
           BSTINPUTS=getwd())

但 bibliography.bib 未打印在 .Rmd 文件中。我将编织 Rnw 文件的全局选项更改为 knitr。如何在 .Rmd 文件中打印参考书目?请提供进一步的帮助?

和德克一样,它只适合我。也许您没有正确地将 YAML 放在一起,或者也许您从未引用过任何内容。这是一个适用于您的 bib 文件的示例文档:

---
title: "Biblio Example"
output: html_document
bibliography: bibliography.bib
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```

## Here's Some Text

This text cites the paper:  [@Vahid_Jalili_Musera_2015].

## References

The bibliography will appear by magic at the end of the document, just
below this text.

有关详细信息,请参阅 http://rmarkdown.rstudio.com/authoring_bibliographies_and_citations.html

对我来说,问题是我的 .bib 文件列在 .Rbuildignore 中。删除条目解决了问题。

根据 Duncan Murdoch 的 r-pkg-dev 邮件列表答复,.Rbuildignore 是 "case-insensitively against the file and directory names relative to the top-level package source directory"。

因此,条目 xxx.bib 递归地忽略了我的包目录中的所有 .bib 文件,并引发了错误。