Tooled up bibliographies

I’ve just got around to installing the magnificient kcite plugin that Simon Cockell wrote for knowledgeblog. It’s actually a really simple plugin, but it’s tremedously useful. For instance, I can now cite my own papers on reality [1], function [2] or protein classification [3] and all the metadata will be gathered and cited for me in a nice reference list at the end.

Of course, I am used to the good life, and this is still all a bit clunky for me. I wanted support from my text editor. For this blog, I use a tool-chain of Emacs, asciidoc and blogpost. But for references I use reftex mode and bibtex. Now I realise that this is a pretty minority tool-chain, but it seemed to me that it should be possible to get it working. And it is, actually, pretty easy. Very rough and ready, but the lisp is below. Obviously, this will need fiddling with for each user, and I will improve it over time.

But it demonstrates the point, I think. A little bit of glue can produce a pretty good publishing tool chain, relatively quickly.

(add-hook 'adoc-mode-hook
          'phil-asciidoc-reftex-support)

(defvar phil-reftex-citation-override nil)

(defun phil-asciidoc-reftex-support()
  (reftex-mode 1)
  (make-local-variable 'phil-reftex-citation-override)
  (setq phil-reftex-citation-override t)
  (make-local-variable 'reftex-default-bibliography)
  (setq reftex-default-bibliography
        '("~/documents/bibtex/phil_lord_refs.bib"
          "~/documents/bibtex/phil_lord/journal_papers.bib"
          "~/documents/bibtex/phil_lord/conference_papers.bib"
          )))

(defadvice reftex-format-citation (around phil-asciidoc-around activate)
  (if phil-reftex-citation-override
      (progn
        (setq ad-return-value (phil-reftex-format-citation entry format)))
    ad-do-it))


(defun phil-reftex-format-citation( entry format )
  (let ((doi (reftex-get-bib-field "doi" entry)))
    (format "pass:[[4]%s[/cite\\]]" doi)))

References

  1. P. Lord, and R. Stevens, "Adding a Little Reality to Building Ontologies for Biology", PLoS ONE, vol. 5, pp. e12258, 2010. http://dx.doi.org/10.1371/journal.pone.0012258
  2. P. Lord, "An evolutionary approach to Function", Journal of Biomedical Semantics, vol. 1, pp. S4, 2010. http://dx.doi.org/10.1186/2041-1480-1-S1-S4
  3. K. Wolstencroft, P. Lord, L. Tabernero, A. Brass, and R. Stevens, "Protein classification using ontology classification", Bioinformatics, vol. 22, pp. e530-e538, 2006. http://dx.doi.org/10.1093/bioinformatics/btl208