# Citation management

### How a 21st century researcher can imply their ideas are important by presenting them through 20th century infrastructure in the manner of a 19th century gentleman

The genealogy of evidence is important and there are many important ideas about how we could track it, especially with advances in technology; However, this page is not about that propagation of certainty, but rather the shabby proxy, citations in actually-existing academic publishing.

In particular, here I answer for myself: How can I get my journal-ready citations in the outmoded format required by my journals with the most modern possible convenience? Fast-forwarding citations themselves all the way into the state of the 1940s art must fall accomplished by someone else with time.

After trying too many things at great cost of time, I use Zotero. This option is open source, powerful and hackable. It could be more user-friendly; but then the competitors set the bar so low that this is hardly a criticism. Slightly more user-friendly but less hackable is Mendeley, a closed-source reference manager that I will not judge you for using. Since I have no patience for things that cannot be automated, Zotero is an easy winner for me; you may wish to try both.

All other options that I have tried are abysmal and I can say nothing but I told you so if you try them and they give you grief.

What kind of grief?” you ask.

## Zotero

Zotero has, as presaged, an API with which you can both read and write data.

It has an active community around it, and I don’t feel that I am locking my data away forever if I rely upon it. (Of course, you can always try to migrate data around from anything to anything with BibTeX or one fo the XML formats etc, but if you have URLs in there, or consort with foreigners who dare to have diacritics in their names, this usually leads to trouble). I can use the API to make changes that I couldn’t make manually, without worrying about that parsing nonsense. Moreover some other apps, such as Mendeley, already use the Zotero API, so you know that it’s not going to be a community of one playing with it.

### Useful hacks

• Integrate with your existing folder of PDFs?

Richard Zach points out > … you keep your PDF directory synced across computers (e.g., if it lives in your Dropbox), > linking the PDFs is just as good. If you add a PDF, > Zotero will look up the metadata for you and add a reference to your database.

• For exporting references from Zotero to my plain text blog, I wrote a CSL file which renders my citations and bibliographies as Markdown and RestructuredText, which is good enough for the internet. This is a hack that works, but it could be better if you want to keep your citation keys consistent across internet and web pages.

• You could write a custom exporter for Zotero without too much pain. But this is asking for pain. Nontheless, here are overview docs, detail docs, and all the code. Moreover, here is a simple example which deals with the sensitive citekey issue (albeit with an outdated version of the citekey system) Here is a soothing walk-through of the process.

to be evaluated, the currently active clients seem to be

or you you use zotfile to synchronise a folder full of attachments to your tablet. That’s what I do. It’s not perfect, but it’s easy and robust.

## pandoc and markdown

• Chris Krycho’s pandoc-based workflow.

• Caleb McDaniel talks through the process of getting citation into near anything using pandoc; I have lots of links like this because, whilst it works, I can’t believe how painful it is, but I hope it will seem less painful if I read a lot about it. The wisdom of the ancients etc.

The preferred pandoc-citeproc format seems to be something with an @ sign and/or occasional square brackets

Blah blah [see @heyns_foo_2014, pp. 33-35; also @heyns_bar_2015, ch. 1].
But @heyns_baz_2016 says different things again.

This is how you output it.

# Using the CSL transform
pandoc -F pandoc-citeproc --csl="APA" --bibliography=bibliography.bib \
-o document.pdf document.md
# or using biblatex and the traditionalist workflow.
pandoc --biblatex --bibliography=bibliography.bib \
-o document.tex document.md

You will need to set up Preferences>export>Default format to be Better Bibtex citation key quick copy and set Better Bibtex to copy pandoc style.

See the pandoc manual and the pandoc-citeproc manual.

## docutils citations

a.k.a. Citations in ReST.

I no longer recommend this. For all the laudable design goals and extensibility of ReST, it’s not where the community is. They are all using markdown.

But if you are keen, the docs say:

Standard ReST citations are supported, with the additional feature that they are “global”, i.e. all citations can be referenced from all files.

For your comfort and convenience these citations will be rendered as born-obsolete fugly 1995-esque hard-coded HTML tables that no-one in the entire internet has managed to whip into anything other than an eyesore in a decade of vain struggle.

More resources:

## Zotero markup integration

tl;dr. There are many over-engineered solutions. The CSL file one is the simplest I’ve found, and it should additionally work for anything which supports CSL, not only Zotero. This includes Mendeley at the least, and possibly Papers. Others?

Anyway, if you want a more fragile but fancier solution, there are other options below.

### Render using a CSL style file.

CSL is a citation rendering mini-language used by modern journals and software to express house style. And you can use it too.

This is a slightly weird way to get plain-text citations out, since it’s designed for rich formatting etc, but it is robust ad simple. There is a CSL editor online so this is easy-ish.

• Here is my docutils/ReST style file, restructuredtext.csl, which renders citations as plain text with ReST markup, including anchor links.

It’s ugly, because it has to battle with a grumpy rich-text XML infrastructure to render plain text, but it gets the job done without any coding, and is robust against software changes.

• Similarly, here is my Markdown style file, markdown.csl, which, likewise, renders citations as plain text with Markdown markup, including anchor links.

• Emilio Heyns has a BibTeX key CSL, which renders some style with which I am not familiar

CSL has a citation-label variable, but it doesn’t correspond to the bibtex keys generated by BBT, which is unsatisfactory.

### Better BibTex

a.k.a BBT.

Better bibtex makes all the BibTex stuff in Zotero much smoother, and since bibtex also integrates with markdown via pandoc, this is a double win.

Here are some citation key format strings for bibtex.

[auth:fold:nopunct][Title:fold:nopunct:skipwords:select,1,1][year]

I currently use this one

​[auth][veryshorttitle1_1][year]

I am fond of the following biblatex export exclusions:

file,abstract,note

## Atom citation picker

For Atom+Zotero+Markdown, you could try zotero citation, which adds a citation picker to the atom editor. References look like

[$$Heyns, 2014$$](#@heyns2014)
[$$Heyns, 2014$$]([email protected],heyns2015)

The bibliography is rendered in either pandoc-YAML or plaintext format at

[#bibliography]: #

I don’t bother; BetterBibtex works fine for my needs.

They are rendered in the output by an in-built pandoc filter, which is installed separately.

### Dynamic bibliography file generation

Erik Hetzner’s zotxt can avoid the need to create bibfiles, rendering bibliographies directly by querying the zotero app, rather than manually rendering an intermediate file. Note that Better BibTex also does this, and even more flexibly, and so may wish to use it.

## Oh, BibTeX

None of that faffing about is useful if you are working with academics, who don’t regard words on the internet as a real thing. Your words must be behind a paywall where no-one can read them to count as significant. Moreover, they must have been rendered harder to analyse by running them through LaTeX, and obfuscating them into a PDF, which probably also entails using BibTeX to do the citation stuff.

If you are starting from Zotero, you can use Better BibTeX to make this less painful.

To manage annoying BibTeX problems from BibTeX files themselves algorithmically I use bibtool.

### Biblatex/biber

Mild upgrade from the winding labrynth of character set errors that is BibTeX. You often need to use bib styles made by passionate bibligraphy rendering fans, e.g. here is an IEEE-like one.

### To mention

Jabref, bibdesk, biblatex vs bibtex vs biber, character set sadness.

## Past traumas

There have been various other options such as Papers (meh) and Sente (defunct due to being crappy) and (sigh) Endnote. I won’t link or refer to those further here, for the reason that I’ve already lost too much data that way, and I don’t intend to lose more. Since all citation software is, basically, awful, it is even more important that whichever application you choose, it is one that you can get your data out of it when you find a less awful option. But the one that is best at letting you keep all your citations even if you ditch it, is Zotero. Also it’s probably the least awful.

Still, if you’re unswayably dedicated to trying other things for yourself, here is my advice: For any closed-source software my advice is the same – Try and see how well you can get data in and out, en masse, because that’s what you’ll have to do if the company goes bankrupt or gets bought by Google and shut down, or by Yahoo and accidentally set on fire, or by Facebook and you are only allowed to use it if you click on ads promoting sports shoes for 18 minutes out of every hour.

All the alternatives apart from Mendeley and Zotero have failed the test of preserving my precious data when I exported it to a different software package, so using those other packages is putting my work in the uncaring hands of an unaccountable third party. To actually extract my data from Sente, for example, I had to burn a whole working week turning their malformed markup into valid XML, (which is a specialty that I don’t care about and no-one should ever need to care about) and I still couldn’t work out how to parse some of it. Then many other things went wrong. Also, Mendeley started behaving suspiciously since they got bought by Elsevier

If you mostly care about LaTeX (which decision is constrained by the lowest common denominator amongst your collaborators, and probably not available to promiscuous authors) you might be able to survive on Bibdesk or jabref or just editing a plain Bib(La)TeX file, but I for one could not bear to give up the browser integration of Zotero, which has saved innumerable hours of painstaking pointless typing.