Is it possible to insert the full reference of an article in the middle of a Rmarkdown document using citation keys?
Asked Answered
L

1

3

Here I learn how to insert citations in the middle of a text and generate a full bibliography at the end of the document. I wonder whether it is possible to have an output like this using citation keys:

Bla bla bla.

Watson, J. D., & Crick, F. H. (1953). Molecular structure of nucleic acids. Nature, 171(4356), 737-738.

Bla bla bla.

Lifeboat answered 10/11, 2014 at 19:57 Comment(0)
V
1

In-text full references/citations in RMarkdown using Bibtex-package.

Solution using bibtex-package proposed by Samuel-Rosa. An example with citations for packages:

  1. Example .bib file
knitr::write_bib("R"), "example.bib")
  1. Read your .bib file into R.
refs <- bibtex::read.bib("example.bib")
  1. Using in-line chunks, select the entry of interest, e.g. R-base, print the entry, and "capture" it as character for RMarkdown output.
Example full reference for R:  
> `r capture.output(print(refs["R-base"]))`

Output:

Example full reference for R:

R Core Team (2021). R: A Language and Environment for Statistical Computing. R Foundation for Statistical Computing, Vienna, Austria. <URL: https://www.R-project.org/>.

Visigoth answered 21/8, 2021 at 14:47 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.