The Living Thing / Notebooks :

Citation management

How a 21st century researcher can imply their ideas are important by presenting them through 20th century infrastructure in the style of a 19th century gentleman scholar, for who would so profligately waste such effort on an unimportant idea?

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 may ask. Please don’t. Just do as I say.

Zotero

My weapon of choice.

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 of 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

Zotero for your tablet/e-reader

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

See also markdown.

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.

See also the markdown/pandoc page for more on this.

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.

I can add:

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.

Screencap of Zotero
Screencap of Zotero

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.

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

Better BibTex

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

The biggest trick is that BBT makes sensible, user-accessible citation keys for your references, and if you use these consistently life will go well for you. Here are some citation key format strings for bibtex. (Of course, there is no guarantee your colleagues will agree on a sensible standard for citation keys, but that problem is perennial.)

Classic:

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

which I think is approximately the same as [zotero:clean]

I currently use this one:

​[auth][veryshorttitle1_1][year]

I am fond of the following BibLaTeX export exclusions:

file,abstract,note

BBT has a Cite-as-you-write feature for integration with generic editors, including a GUI popup. I do not use this. It also has HTTP-pull export support, meaning that accessing an up-to-date URL is a matter of an HTTP request that looks like http://127.0.0.1:23119/better-bibtex/collection?/1/citation_management.biblatex to pull all the records in the citation_management collection and this works from my local copy of Zotero, so it’s fast and reliable unlike the Zotero API which depends upon my internet connection, which is one of those things that Australia hasn’t got around to yet in any professional or reliable fashion.

RStudio integration

citr provides an interactive citation finder for RStudio that works with betterbibtex.

install.packages("citr")

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)

They are rendered in the output by an in-built pandoc filter, which is installed separately. One locates the output bibliography in the document in either pandoc-YAML or plaintext format at

[#bibliography]: #

I don’t bother; BetterBibTeX works fine for my needs and across many editors.

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. It feels less fragile to me to use Better BibTex Pull Export.

Installing

Easy with windows and mac; there are standard installers. A little more tedious with linux. retorquere’s repo of deb installers is a simple way for Ubuntu. There are none of the snap-app packages one would expect for ubunutu. However, there is a cross-platform flatpak zotero, which I have not tried yet.

flatpak install flathub org.zotero.Zotero
flatpak override --user --filesystem=/PATH/TO/ZOTEROFOLDER org.zotero.Zotero

BibTeX

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, to obfuscate 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.

BibTeX is ancient and has accreted deep strata of fossilised rules, but it does work if you move very carefully and don’t touch anything. Imitate the rituals of your predecessors and the gods will reward you.

BibLaTeX

a.k.a. biber, because the biblatex system is factored into a couple of distinct packages but you more or less need to get the lot to reap benefits. It looks similar to BibTeX but is better in various ways, including having less baffling misfeatures than BibTeX and full unicode support. As such, it is a low key upgrade from the winding steeplechase of character set errors that is BibTeX. It is notable not better in the ecological sense of being widely used by the various technoligcally moribund conferences/journal to which you might want to submit your paper, because many such organisations believe that these accursed foreigners will eventually despair of their disconcerting languages and their filthy habits of smearing diacritical marks all over their names, if only we wait long enough.

BibLaTeX can handle non-english names and URLs, bringing it up to speed with 1999. You often need to use alternate biblatex styles made by passionate bibliography rendering fans to approximate some jounral or other, e.g. here is an IEEE-like one.

Note that, unlike BibTeX, BibLaTeX is supported in Beamer slides.

The configuration options are manifold. Here is one set I like.

\usepackage[
style=authoryear,       % author-year style in references
citestyle=authoryear-icomp, % compact author-year in cites
date=year,  % No i don't care what month
url=false,                   % clickable urls in ref.
uniquelist=false,
uniquename=false, % turn off auto-disambiguate
backref=true,               % auto backrefs in ref.
datezeros=true,         % dates with leading zeros
maxcitenames=1, % et al. with two or more authors
%indexing,                   % to create an index of persons
sortcites=false,
sorting=nyt,
%defernumbers=true,     % numbers in any bibliography
backend=biber]              % use biber for compiling
{biblatex}

To mention

Jabref, bibdesk.

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.

See also text editors, academic writing workflow.

TODO: complain about the entire structure of citations in the electronic age (keep it short though, because everyone is tired of complaining about it, and at least it’s better than the general howling void of unsourced internet media.)

TODO: apologise for accidentally complaining at length despite my stated aim of keeping it short.