How to automatically create BibTex citations for R packages in knitr file?

安稳与你 提交于 2019-12-03 05:55:35

Just replace \bibliography{R-Pckgs.bib} with \bibliography{R-Pckgs}, and it should work fine.

On Windows 7, with an up-to-date MikTeX installation and current R and R packages, the following worked:

  1. Put your reproducible example in a file named "eg.Rnw" and edit to remove the extraneous ".bib"
  2. Launch R and navigate to the directory in which "eg.Rnw" is located.
  3. Do library(knitr); knit2pdf("eg.Rnw")

Note: There are obviously many workflows for going from *.Rnw to *.pdf, but if you want to use knit2pdf() (at least), make sure that you run it from the directory containing the *.Rnw to be processed.

Add a \nocite{dummycite} to your document - to create a citation so that the bibliography is printed.

Note that this is obsolete if you already have other citation in your document.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!