9 Citations
9.1 Reference keys
Adding reproducible references happens with BibTex keys. A typical BibTex key might look as follows:
@misc{RMarkdownWritingReproducible,
title = {{RMarkdown} for writing reproducible scientific papers},
url = {https://libscie.github.io/rmarkdown-workshop/handout.html},
urldate = {2023-04-18},\\Users\\Moope001\\Zotero\\storage\\SJITSZZI\\handout.html:text/html},
file = {RMarkdown for writing reproducible scientific papers:C\: }
BibTex keys can be stored in a .bib
file, for example a file named references.bib
. Such a file can be stored in the folder of your Quarto book, and the references from that file can be used as citations or in a bibliography.
9.2 Workflow with Zotero
Here we discuss a workflow with the reference manager Zotero. Other reference managers can also produce .bib files. We’ve chosen Zotero, because 1) it is open source and 2) it allows automatic updating of the .bib file as you find more references during the writing of your book.
9.2.1 Installation
- Install Zotero.
- If you work on a Utrecht University-managed laptop, you can install Zotero from the Software Center.
- If you work on a private device, follow the installation instructions on the Zotero installation page.
- Install the Zotero connector for your browser. This connector makes sure you can directly save a reference to Zotero from your browser.
- Install the Better BibTex extension for Zotero. This makes sure your references are saved in a format that Quarto can work with.
9.2.2 Set-up
- Open Zotero Desktop
- Log into your account
- Create a new collection for your project, for example:
name-of-your-quarto-book
- Open your web browser
- Double-check that you can find the Zotero Connector in your browser
- Search for a resource (article, web page, book, etc.) that you want to cite in your Quarto book
- Use the Zotero Connector to save the reference to your collection
- Check that the resource has indeed appeared in your
name-of-your-quarto-book
collection in Zotero - If needed, adjust or complement the Zotero metadata if something is wrong or missing
- In Zotero Desktop
- Right-click your collection and select Export Collection
- For the Format, select Better BibTex
- Click the option to Keep updated
- Provide the file name as
references.bib
and save it in the same folder as your Quarto book
- In RStudio
Make sure that the
_quarto.yml
file contains the correct path to the references.bib file, for example:bibliography: references.bib
9.2.3 Workflow
Now that you’ve set up a connection between Zotero and your local Quarto book, you can start adding references to your Zotero collection and citing them in your book. Every time you save a reference to your Zotero library, Zotero automatically updates your .bib file through syncing with Zotero desktop and updating the .bib file.
To insert a citation:
- Open the .bib file.
- Look for the citation reference, it is listed after the
@
sign. - Cite the reference:
- In-text citations:
@knuth84
- Bracketed citations:
[@knuth84]
- In-text citations:
To insert a bibliography, add the following to the page where you want the bibliography to show up:
::: {#refs} :::
For more information about citations, please check out the Quarto documentation.