Citations in bookdown

31 May 2017

I using the bookdown package, to produce my coursebook for BUSINESS 705.

Everything was looking good until I realised my in-text citations were not looking right when I published the ‘book’ to my website. Instead of APA citations like (Huff, 2009), I was getting (Huff 2009); the comma was missing. Also, page numbers were not displaying correctly.

At first I thought I could add biblio-style: apalike to the YAML for the book, but that—it seems—only affects things going to Latex/PDF.

My next option was to look at raising an issue on GitHub, but that suggested I checkout StackOverflow first. No luck there, but I began to wonder if I could do something with the CSL file. On the RStudio site, I found a reference to specifying the CSL file in RMarkdown files.

So, in the YAML header of my book I added:

csl: apa.csl

After placing a copy of apa.cls in the working directory of my book, all it took was a quick, build and deploy and my citations were beautifully styled as per APA.