Versionable, Plain Text Reference Management – Git, PanDoc and BibTex

When you’re writing peer-reviewed articles, you must have references. Good news: you can have everything in plain text files, even the citation and reference management.


I have only used this exact BibTex setup for a while. However, having written five books in plain text (e.g. MarkDown) and with version control software, I could not imagine using old-fashioned word processor.

With PanDoc and BibTex, you can have your master document and references in plain text. And with plain text, you can have everything in Git version control.
With reference management, you can change your reference format. If you are writing for a paper that requires running [1] number [2] for references [3], reference manager can save a lot of time when inserting references.

Compile a Doc in Markdown

$ cat tero.md

In Markdown, empty line separates paragraphs. A single hash makes heading 1, two hashes make heading 2.

# Hello Tero
Hello Tero, see you at TeroKarvinen.com!

Compile

$ pandoc tero.md -o tero.pdf

View PDF

$ okular tero.pdf

Get Citation Data from Scholar.Google.com

Find an article to cite. Google Scholar has BibTex export.

Click the cite (quote ” icon). Choose BibTex.

This article seems to have pretty terse citation info

@article{karvineniot,
  title={IoT Rapid Prototyping Laboratory Setup},
  author={KARVINEN, KIMMO and KARVINEN, TERO}
}

Usually, the BibTex citation data is more full. For example, let’s have a look at my configuration management paper from Chengdu ICIM:

@inproceedings{karvinen2017investigating,
  title={Investigating survivability of configuration management tools in unreliable and hostile networks},
  author={Karvinen, Tero and Li, Shuliang},
  booktitle={Information Management (ICIM), 2017 3rd International Conference on},
  pages={327--331},
  year={2017},
  organization={IEEE}
}

Add Citation to Refs.bib

Just copy-paste it to a single file

$ cat tero.bib
@inproceedings{karvinen2017investigating,
 title={Investigating survivability of configuration management tools in unreliable and hostile networks},
 author={Karvinen, Tero and Li, Shuliang},
 booktitle={Information Management (ICIM), 2017 3rd International Conference on},
 pages={327--331},
 year={2017},
 organization={IEEE}
}
@article{karvinen2015using,
 title={Using hobby prototyping boards and commercial-off-the-shelf (cots) components for developing low-cost, fast-delivery satellite subsystems},
 author={Karvinen, Kimmo and Tikka, Tuomas and Praks, Jaan},
 journal={Journal of Small Satellites (JoSS)},
 volume={4},
 number={1},
 pages={301--314},
 year={2015}
}

Refer to Your Sources in Text

References are marked with at sign “@”.

$ cat hellobib.md
Hello simple BibText references. See you at TeroKarvinen.com.
Hello simple BibText references. See you at TeroKarvinen.com.
Hello simple BibText references. See you at TeroKarvinen.com.
Hostile malware uses methods that could be useful in bening system management in the enterprise [@karvinen2017investigating].
Hello simple BibText references. See you at TeroKarvinen.com.
Hello simple BibText references. See you at TeroKarvinen.com.
Hello simple BibText references. See you at TeroKarvinen.com.
Hello simple BibText references. See you at TeroKarvinen.com.
Satellite parts can be prototyped with cheap, of-the-shelf parts [@karvinen2015using].
Hello simple BibText references. See you at TeroKarvinen.com.
Hello simple BibText references. See you at TeroKarvinen.com.
Hello simple BibText references. See you at TeroKarvinen.com.
Hello simple BibText references. See you at TeroKarvinen.com.

Compile

$ pandoc hellobib.md -o hellobib.pdf --bibliography tero.bib
$

No news is good news: when PanDoc does not print anything, the compilation run without errors.

View

$ okular hellobib.pdf


Can you see your sources? Well done, now go write some science.

Yes, We [1] Can [2] Do IEEE [3] Style

Using a CSL file from Zotero CSL Styles repository, we can have running number on citations. Here, reference management can save a lot of time. Imagine inserting a single citation in the beginning and having to change all references by hand!
Get the CSL style for IEEE

$ wget https://www.zotero.org/styles/ieee

Compile

$ pandoc tero.md -o tero.pdf --bibliography refs.bib --csl ieee

View

$ okular tero.pdf


Now, go write some science!
Updates: added some images, minor clarifications to text. Fixed some typos, and left some.

Posted in Uncategorized | Tagged , , , , , , , , , , , , , , , | Comments Off on Versionable, Plain Text Reference Management – Git, PanDoc and BibTex

Comments are closed.