Citations

Adding literature citations to a Quarto document

Published

February 20, 2025

We need three things in place to add references:

  1. A bibligraphy file (content of citations)
  2. A citation style file (style of citations)
  3. YAML and Quarto code to include references (where to add citations)
  • Create a new text file (File / New File / Text file) in the root folder of your project (same folder as the soldiers quarto file).
  • Add (copy/paste) these 14 lines to the file:
@article{wickhamWelcomeTidyverse2019,
  title = {Welcome to the {{Tidyverse}}},
  author = {Wickham, Hadley and Averick, Mara and Bryan, Jennifer and Chang, Winston and McGowan, Lucy D'Agostino and Fran{\c c}ois, Romain and Grolemund, Garrett and Hayes, Alex and Henry, Lionel and Hester, Jim and Kuhn, Max and Pedersen, Thomas Lin and Miller, Evan and Bache, Stephan Milton and M{\"u}ller, Kirill and Ooms, Jeroen and Robinson, David and Seidel, Dana Paige and Spinu, Vitalie and Takahashi, Kohske and Vaughan, Davis and Wilke, Claus and Woo, Kara and Yutani, Hiroaki},
  year = {2019},
  month = nov,
  journal = {Journal of Open Source Software},
  volume = {4},
  number = {43},
  pages = {1686},
  issn = {2475-9066},
  doi = {10.21105/joss.01686},
  urldate = {2025-02-20},
  langid = {english},
  file = {/home/soon/Zotero/storage/VB4D9NMM/Wickham et al. - 2019 - Welcome to the Tidyverse.pdf}
}
  • Save the file as ‘my_bibliography.bib’ … in the same folder as your soldiers quarto document
  • Go online and visit: zotero style repository
  • Search for elsevier-vancouver
  • Right-click on the link of the result you want to use – ‘save link as’ to your project folder
  • Make a note of the csl file name
  • Include the following two lines in the YAML of your Soldiers quarto document:
bibliography: my_bibliography.bib
csl: elsevier-vancouver.csl
  • In an appropriate place in your soldiers quarto document (in the text, not in an R code chunk), add the following: [@wickhamWelcomeTidyverse2019]

Render your document to HTML


Now do one of the following (or both?):

  • Open you reference management software (Zotero, Mendeley, RefMan, Endnote, ..), and export a single reference as a BibTeX file.
  • Copy the content of that BibTeX file and append it to my_bibliography.bib – do not overwrite the existing entry in the file.
  • Make a note of the unique identifier of the new reference.
  • Add it to the existing citation in your Soldiers quarto document, using this structure: [@REF_ID_1; @REF_ID_2]
  • Re-render you Soldiers quarto document to HTML
  • Go to https://scholar.google.com
  • Search for: Søren O'Neill Generalized deep-tissue hyperalgesia in patients with chronic low-back pain
  • Click the resulting link to see the article on the journal home page
  • Just below the manuscript title, look for ‘Cite’ .. click and select BibTeX
  • If you already have Zotero installed, select cancel to NOT import to zotero and download as BibTeX file instead.
  • Copy the content of the downloaded file and append it into the my_bibliography.bib file.
  • Make a note of the unique identifier of the new reference.
  • Add it to the existing citation in your Soldiers quarto document, using this structure: [@REF_ID_1; @REF_ID_2]
  • Re-render you Soldiers quarto document to HTML

You can read a more detailed description about citing literature here)