knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)

Disclaimer

This vignette descibes how a bib-file created for a certain R-markdown document that contains citation references.

Backgroud

When writing scientific publications or technical documentations, certain background information is described by citing other sources. The references to these sources are listed at the end of the document in a separate section. In principle, it is possible to compile the list of reference manually based on the cited sources in the text. Such a manual procedure is tedious and error-prone.

Automated Procedure

Manual compilation of references should be avoided at all costs. Hence, we have to come up with an automated procedure. Possible approaches to generating a reference list automatically are described in this section. The goal of such an automated procedure is that we have for each document source the available references as bib-records in one file. This bib-file is also considered as a part of the document source. This behavior is required to be able to share the document source with other people that do not have the same reference manager database.

A first attempt

An initial fast solution to the problem is to let the reference manager export all publication entries into one bib-file. This single bib-file is then used in the bibliography field of the yaml-header in the R-markdown document. While this approach works well for documents that are written by a single author, it does not work well when multiple co-authors write on the same document. The problem with this approach for multiple co-authors is that every co-author would need to have access to the same reference manager database and the locally exported bib-file would have to be stored in a directory having the same name and the same path. In addition to that when reference manager databases grow, these bib-files can get large and it might be slow to generate only a few references out of a huge database of publications.

A refined approach

We assume the following model for writing a document. We start by writing some text that contains a fact or an argument that we want to support with a reference to a certain publication. At this point, we distinguish two different cases

  1. We know that the publication to be cited is in our reference manager database and hence it is just a matter of copying the bib-record into the current working directory of our document.
  2. The publication is not in our reference manager database. We first have to add the cited publication to the reference manager and then can proceed as described in 1.

For both cases it is important to be able to copy a bib-record out of a reference manager database into to bib-file in the current working directory. This can be done using the following steps:

Step 1: Read the reference manager database Step 2: Find and select the desired publication record Step 3: Save or write the found publication record to a bib-file in the current working directory

Reading Reference Manager Database

Reading the reference manager database requires that we can specify and persistenly store the location of that database. There are several options for that. One possiblility is to use the general list



charlotte-ngs/rmddochelper documentation built on June 27, 2019, 1:22 a.m.