Oskar Pettersson bio photo

Oskar Pettersson

Researcher in SECOs and TEL. Coder, beer geek and runner in decline.

Twitter Github

A large part of my academic workflow is centered around Latex and Bibtex. Wordpress was not exactly ideal for that, even tho there are a few alternatives. With the move to Jekyll however, the Jekyll-scholar project provides excellent support for both bibliographies and using citation in general posts. My previous experiences with setting up mostly RoR installations helped a little, but setting this up still took much longer then I care to admit. I will elaborate the way I generate this in another post but let’s just say that Windows still isn’t my favorite operating system.

Add to following to /Gemfile

gem 'jekyll-scholar'
gem 'bibtex-ruby'
gem 'citeproc-ruby'
gem 'csl-styles'

Then add these lines to /_config.yml

scholar:
  style: apa
  locale: en

  sort_by: none
  order: ascending

  source: ./_bibliography
  bibliography: references.bib
  bibliography_template: "{{reference}}"

  replace_strings: true
  join_strings:    true

  details_dir:    bibliography
  details_layout: bibtex.html
  details_link:   Details

  query: "@*"

We then place our bibliography file in the ./_bibliography directory as we specified above. With the bib file in place, we can now call upon the references within it to print out a bibliography. In my case I wanted them sorted by year, which is achieved by querying for each year as follows:

bibliography --query @*[year=2014]