Including Bibliography in RMarkdown document with use of the knitcitations
If you want to include all references in the bibtex file, you can use, as mentioned by frankyan here
---
title: 'My Title'
author: "Me me me me!"
output: pdf_document
bibliography: references.bib
nocite: '@*'
---
The @*
is a wildcard for all references.
The pandoc documentation says:
If you want to include items in the bibliography without actually citing them in the body text, you can define a dummy nocite metadata field and put the citations there:
---
nocite: |
@item1, @item2
...
@item3
In this example, the document will contain a citation for item3 only, but the bibliography will contain entries for item1, item2, and item3.
The entire chunk above (from ---
to ...
) can go anywhere in your code. @abichat prefers to put it after the YAML or in the Reference section.
Here is minimal working example:
paper.Rmd
---
title: 'My Title'
author: "Me me me me!"
output: pdf_document
bibliography: references.bib
---
Application written in the R programming language [@RCoreTeam] using the Shiny framework [@Chang2015].
# REFERENCES
references.bib
@Misc{Chang2015,
Title = {shiny: Web Application Framework for R. R package version 0.12.1},
Author = {Chang, W. and Cheng, J. and Allaire, JJ. and Xie, Y. and McPherson, J. },
Year = {2015},
Type = {Computer Program},
Url = {http://CRAN.R-project.org/package=shiny}
}
@Article{RCoreTeam,
Title = {R: A Language and Environment for Statistical Computing},
Author = {{R Core Team}},
Year = {2015},
Type = {Journal Article},
Url = {http://www.R-project.org}
}
Console output
processing file: paper.Rmd
"C:/Program Files/RStudio/bin/pandoc/pandoc" +RTS -K512m -RTS paper.utf8.md --to latex --from markdown+autolink_bare_uris+ascii_identifiers+tex_math_single_backslash-implicit_figures --output paper.pdf --filter pandoc-citeproc --template "C:\Users\tdadaev\Documents\R\win-library\3.2\rmarkdown\rmd\latex\default.tex" --highlight-style tango --latex-engine pdflatex --variable "geometry:margin=1in" --bibliography references.bib
output file: paper.knit.md
Output created: paper.pdf
paper.pdf