Using BibLaTeX instead of Bibtex in Rmarkdown for finer control

As a standard, bibtex is used as a citation-renderer in Pandoc’s Markdown, that is, in RMarkdown as well. bibtex is useful for a fair amount of citation task, but biblatex allows for a finer control. For instance, multiple bibliographies for one document are possible.

For instance, citing a newspaper article using bibtex left me scratching my head, as I wanted to have the exact day of the date (not only the year) cited. However, I could not convince bibtex to show these details.

That’s what I wanted to get:

Krugman, P. (2013, 13. April). The Excel Depression. The New York Times, A31. Zugriff unter https://www.nytimes.com/2013/04/19/opinion/krugman-the- excel-depression.html

But that’s what I got:

Krugman, P. (2013). The Excel Depression. The New York Times, A31. Newspaper Article. Abgerufen von https://www.nytimes.com/2013/04/19/opinion/ krugman-the-excel-depression.html

See the difference in date formatting; for a newspaper article, one would want a day-based date, not a year-date only.

After some Google research, I found that bibtex appears rather limited in some nuanced fine tuning such as the exact day of an article. bibtex seems to have little patience for such subtleties.

By the way, that’s the bib(la)tex source of the citation just rendered:

@article{Krugman:2013aa,
    Author = {Krugman, Paul},
    Date-Added = {2018-02-13 17:22:18 +0000},
    Date-Modified = {2018-02-13 17:23:26 +0000},
    Journal = {The New York Times},
    date = {2013-04-13},
    type = {Newspaper Article},
    url = {https://www.nytimes.com/2013/04/19/opinion/krugman-the-excel-depression.html},
    Pages = {A31},
    month = 04,
    day = 13,
    Title = {The Excel Depression}
}

The following yaml header can be used to switch to biblatex for citation rendering:

---
output:
  pdf_document:
    citation_package: biblatex

title: "Untitled"

lang: de-De

header-includes:
   - \usepackage{csquotes}

biblio-style: apa

bibliography: test.bib
#csl: "/Users/sebastiansaueruser/Documents/Literatur/ref_mgt/apa.csl"

---

Note that no csl file is needed for biblatex, the specs are included in an included latex package (biblatex-apa). csquotes is a latex packages that helps to print non-English quotation marks such as Germans.

Below and beyond the yaml header, one continues as usual: citing the source, and not caring for the literature section, which will be put automatically to the end of the document.

For instance, let’s cite the Krugman article from the New York Times:

@Krugman:2013aa

Caveat

The biblatex approach only works for Latex output (pdf) only, not for html.

For LaTeX output, you can also use natbib or biblatex to render the bibliography.

Source

I’m no expert in biblatex, so there are surely aspects I’m not aware of.

Put the literature section at an arbitrary place

BTW, to have the literature section appear at some different point, and not necessarily at the very end of the document, use this approach.

<div id="refs"></div>