Motivations

The advantage of using Rmarkdown as a replacement of Word, libreoffice or other editors is tremendous and perfect in my current workflow, in which R coding, visualization are recorded for reproducibility and presentation.

For reports, manuscripts written in the academic style, sufficient reference is important because we are scientist and that’s what we do! all arguements should be backed up by evidence. In order to make the citation process painless, I did the following process and works for me (for now).

The motive behind doing this is simple:

Human beings should automate repetitive works and focus on things of real importance

In my opinion, the best practice in adding citations should be:

  • Avoiding to organize documents by hands;
    • zotero is better for this job
  • Avoiding to manually edit info in citations and the reference list;
    • zotero + citr
  • Easy to adjust reference styles;

  • plain-text based enabling version controls;

  • separating citation file with the main manuscript;

Comparing to two alternative strategies:

  • word/libreoffice writer + zotero

    styling all those fancy stuff is distracting, slow, and disaster-prone.
  • latex + zotero

    //////////////////////////////////////everywhere. Although latex enables flexibility, the learning curve for mastering latex in writing pretty and professional documents is steep. The necessity is open to discuss.

Rmarkdown + zotero is best suited for my need by providing a set of simple grammars to form organized hierachichal structure, which looks pretty in either html,pdf, word, or plain .rmd too!

Setup

  • Install Rstudio, R, Zotero standalone version

    Rstudio can be used as an text editor(although I also prefer lots of useful features and themes in sublime text 3). Zotero for reference management, which is free (Looking at endnote, seriously endnote?? beefy 300 dollars??), academically based (looking at mendeley) and has a lovely add-on on my beloved Chrome browser because I prefer reading papers on the web instead of pdfs 1(looking at everybody else)
  • R Packages required: citr

  • Zotero plugin: betterbibtex

And it’s all set.

Workflow of adding citations

Here is a typical scenario in my writing experience where citation is needed.

  1. Plan to write a topic or a section in the manuscript; Search a bunch of related papers, select & read them roughly, organize them in my own word.Add useful articles in my zotero library, lots of tutorials are available;

  2. Write the part;

  3. At each point where a citation is needed, use Addins-Insert citations, add citation to the paper.

  4. Edit YAML to include the bibtex file (eg: bibliography: ./references.bib); add ## reference at the end of the main text;
  5. knit into pdf or html.


  1. basically you can click on citations in line, and the ref will pop up, instead of scrolling back and forth in pdfs