Capturing BibText entries with Org, BibTex-Mode & Google Scholar

There have been numerous articles written about how to generate bibliographies in orgmode documents from BibTex. But not a lot has been written about collecting those references in the first place. I tend to add twenty or thirty references on a slow week. If I am deep in research mode I can easily do that many in a single day.

Toolchain

My toolchain includes emacs (of course), Org Capture, Bibtext-Mode, Ebib, a BibText Database for emacs and the Firefox Google Scholar Button.

I have this added to org-capture-templates:

("c" "BibTex" plain (file "~/org/ref.org") "\n\n\n\n%?")

The template appends whatever is pasted into the capture buffer in plain text without any headers, time stamps or formatting into my temporary bibtex file named "ref.org". The file doesn't have any header, only a

-*- mode: bibtex; fill-column: 60 -*-

at the top to ensure that when the file is opened that bibtex-mode is turned on.

Finally install the Firefox Google Scholar Button, or the Google Chrome Google Scholar Button.

Go to any Google Scholar page and click on the pull down menu in the top right of the window and choose Settings and at the bottom of the page tick choose "show links to import citations in BibTex"

Workflow

When you look up or find a book, web page or paper that you have download or want to reference, highlight the title of what you want to reference and click on the Google Scholar Button. A popup window will appear that searches for the item. If you find it, click on the button to the right of the entry with the /"/ (quote) character on it and then click on the BibTex button. A tab will open in your main browser window with the BibTex entry in plain text. Highlight and copy the entry then switch to emacs. In emacs bring up the Capture menu, and choose "c", past the entry into the window and then use C-c C-c to save and close capture.

If you are looking up multiple items, keep the Capture window open and paste as many items as you need before hitting C-c C-c.

In the rare event that Google Scholar can't find the item you are looking for, use BibTex-Mode's template system to create new entries.

C-c C-e C-a bibtex-Article
C-c C-e C-b, C-c C-e I bibtex-InBook
C-c C-e b bibtex-Book
C-c C-e B bibtex-Booklet
C-c C-e C-c, C-c C-e i bibtex-InCollection
C-c C-e C-m bibtex-Manual
C-c C-e m bibtex-MastersThesis
C-c C-e M bibtex-Misc
C-c C-e C-p, C-c C-e C-i bibtex-InProceedings
C-c C-e p bibtex-Proceedings
C-c C-e P bibtex-PhdThesis
C-c C-e M-p bibtex-Preamble
C-c C-e C-s bibtex-String
C-c C-e C-t bibtex-TechReport
C-c C-e C-u bibtex-Unpublished

The keybindings are a bit too much to handle for me. I use Helm so typing M-x bibtex will show completion. If you remember the name of the template you can call M-x bibtex-entry which by default is bound to C-c C-b and prompt you to enter the name of the template.

A template is copied into the buffer. Fill in the entries you need to, and when you are finished type C-c C-c and the entry will be cleaned up, with empty fields and ALT and OB prefixes removed, it will then guess what the entry key should look like which you can edit in the minibuffer. Hit return when you're finished and it will add the key to the file. Very cool stuff.

By default keys are generated with only 2 digits for the year, I prefer full four digit years so I set the following:

(setq bibtex-autokey-year-length 4)

I don't entirely like the way BibTex-mode guesses the title part of keys, but I haven't put in the time to figure out how to get it to format things without putting "_" underscores before a title. It's on my list of things to do….. just not today.

BibTex-Mode has a lot more to it, so it's worth checking out this manual to see everything it can do.

Conclusion

This toolchain and workflow has made my life a lot easier. Creating references was often a chore that I would put off. With this workflow, I can quickly lookup, grab a citation and save it in seconds even if I am in the middle of something else, without loosing my train of thought.

Tags: workflow , emacs , BLOG ,