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

前端 未结 2 691
时光说笑
时光说笑 2021-02-07 05:28

I am not sure whether this an R, LaTeX, or BibTex problem.

I am trying to automatically generate a .bib file containing citations for R packages and then list them at th

相关标签:
2条回答
  • 2021-02-07 05:59

    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.

    0 讨论(0)
  • 2021-02-07 06:03

    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.

    0 讨论(0)
提交回复
热议问题