/Literature

Files to import literature from Mendeley into org mode and keep updated

Primary LanguageEmacs LispMIT LicenseMIT

Requirements

System

All these can be done through apt-get

  • poppler-data
  • poppler-utils
  • git

Emacs

  • bibtex-utils
  • org-ref
  • helm-bibtex
  • biblio

Set-up

To use, download and place on your load path. Only literature.el is required, literature-config.el adds it to the load path and require literature, as well as defining some hooks, key shortcuts, and variables. Those are all optional and you can use as you see fit.

Before use, make sure to set the literature-paper-directory, literature-master-bib, and literature-master-org variables. To make sure the different libraries talk to each other correctly, you should also set:

  • bibtex-completion-bibliography
  • bibtex-completion-library-path
  • bibtex-completion-notes-extension
  • reftex-default-bibliography
  • org-ref-bibliography-notes
  • org-ref-default-bibliography
  • org-ref-pdf-directory

See literature-config.el for an example of how they should be set.

It’s also recommended you set the various bibtex-autokey-* variables so that the key generated by bibtex-autokey (as used in org-ref-clean-bibtex-entry) is one you like. Again, an example is found in literature-config.el

To get literature-add-file as an option in helm-find-files, add the line alias literature-add-file literature-add-file $1 to your eshell aliases file (eg, .emacs.d/eshell/alias). Then, using helm-find-files (not necessarily bound to C-x C-f! Check that it is), typing M-! and selecting literature-add-file will run it on the highlighted file (you can mark multiple files and then literature-add-file will be run on them one after the other).

For now, there’s an issue with bibtex-utils, where the version that exists on el-get starts with a bunch of uncommented text, which can lead to a Symbol is void: A error. If this happens, find the version of bibtex-utils.el that is being loaded, comment out the text at the beginning (and the closing brackets at the end), delete the compiled version (bibtex-utils.elc) and try again.

Android set-up

This set-up can be made to work on Android, but it takes a tiny amount of work. I use RefMaster, but I think this would work with Library as well. The links need to be relative and formatted to work with JabRef (which they are), but you also need to have all the files on your local device. If you use Dropbox, they aren’t all downloaded, so you need to use something like Dropsync, which links a local folder on your device to one of your Dropbox folders. This will take up a fair amount of space, depending on how many files you have, but if you have a wifi-only tablet and so don’t have consistent network access, you probably want all the files on your device anyway, so you can read anywhere.

Then simply load in your literature.bib file, and you should be good to go!

Acknowledgments

I spent a lot of time reading around on the internet before deciding how best to do this. As for as I could find, no one had specifically moved from Mendeley to using org mode for reference management, so I used a lot of things piece-meal.

Obviously, for the emacs setup, I use helm and helm-bibtex directly, both of which are wonderful packages. I also use pdf-tools for editing pdfs in emacs, which is a great package as well.

I first came across the idea of using org-mode and emacs as reference management in a blog post here, which has been linked to several times by people doing related projects. The main inspiration for my organization is a post by Vinh Nguyen. For getting annotations out of pdfs in Python, I based my code on two posts, and the get_annotations() function comes almost directly from the second of those. Using python to extract Mendeley notes and metadata information came from here, and an idea for the structure for how to export Mendeley information came from the R code found here, though the information I took differs from both of them. For obtaining bibtex entries from a doi, I used code from pybib (specifically, pybib/utils.py); I was unable to do what I wanted (get bibtex information from inside a python function) with the installed version of pybib, so I just copied the relevant parts of code.