8 Zotero

Zotero is a free and open-source reference management software to manage bibliographic data and related research materials, such as PDF files.

8.1 Set up

  • Download Zotero and create an account. We will then share the New Graph library with you.

  • Install the Better BibTex add-on. In the Better BibTeX settings change the citation key format to authEtal2.lower.replace(find=".",replace=_)+len+year+veryshorttitle(2) | title+year, see 8.1.

knitr::include_graphics("fig/zotero_settings01.png")
Better BibTeX citation key

Figure 8.1: Better BibTeX citation key

  • In the Better BibTeX settings, in the export tab, change Add URLs to BibTeX export to in the URL field, see 8.2.
knitr::include_graphics("fig/bibtex_export.png")
Better BibTeX settings

Figure 8.2: Better BibTeX settings

  • Install the ZotFile add-on and use the settings below:

  • Insure that Rmarkdown is communicating with Zotero by navigating to tools/global options/R Markdown/Citations. See screenshot below.

8.2 Adding references to Zotero

Add references to zotero using the Zotero/Zotfiles plug-in. Make sure the metadata (authers, date, title) and pdf were transferred and if not add whats missing, sometimes not everything is transferred.

Do your best to add the reference to the correct collection, we try to keep them organized by subject. You can move a reference by holding Cmd (Mac) or shift (Windows/Linux).

To add metadata to a reference:

  1. Right click the reference and select create parent item then manual entry and input all metadata

  2. Once complete, right click and select Manage Attachments/Rename and Move. This renaming ensures we are using Zotfile.

8.3 Inserting citations

Zotero makes it easy for us to insert citations into Rmarkdown documents. Zotero will only add citations that are referenced with a citation key to the references section at the end of the bookdown document, so for efficiency purposes we include the entire NewGraphEnvironment shared library even though not all references are used in each document.

  1. Right click to export the entire NewGraphEnvironment shared library in Better bibTex format. Open the exported *.bib file in Rstudio, as well as the *.bib files referenced in the YMAL of the index.Rmd file in the repo. Copy paste the exported *.bib file content into the repo *.bib file. If you only want to add a few references, add them to their own collection and export that way.

  2. Now in your document, just type the citation key for the reference and it will automatically add the citation for you. It will also add the reference to the references section at the end of the bookdown document.

For example, the citation key for MoE, (2011) was added and now you can see the citation in text as well as in the references section.

8.4 Updating citations

Sometimes when building a report you will run into an error saying that the citation key is not found (see error below). This is either because the citation has not been added to the *.bib file or the citation key needs to be updated. To update the citation key, search for the reference in Zotero using the title or authors, then copy/paste the citation key and replace the old citation key in the Rmarkdown document. Make sure to update the *.bib file following step 1 of [#inserting-citations]. If the citation is new and you are getting this error, double check that you have updated the *.bib file with the new reference, following step 1 of [#inserting-citations].

[WARNING] Citeproc: citation bustard_schell2002ConservingMorice not found
[WARNING] Citeproc: citation flnro2013BulkleyRiver not found
[WARNING] Citeproc: citation flnro2013OverviewAngling not found