Tags for Bibliography References

 

I love writing my papers in LaTeX. Its declarative style allows me to concentrate on the content, rather than the form. I even format the text according to the content, keeping each phrase or logical unit on a separate line. Many publishers supply style files that format the article according to the journal's specifications. Even better, over the years I've created an extensive collection of bibliographies. I can therefore use BibTeX to cite works with a simple command, without having to re-enter their details. This also allows me to use style files to format references according to the publisher's specification. Yet, there is still the problem of navigating from a citation to the work's details. Here is how I solve it.

Vim, my editor of choice, but also Emacs, support tags, a facility that allows you to jump to a function's definition. This works by storing the file and a regular expression for locating each function in a file named tags. A special keystroke (^] in vi and M-. in Emacs) will use the information on that file to jump to the definition of the element under the cursor. My idea involves creating a tag file for the keys of all entries in each bibliography file. When I then lookup the key of a citation appearing in the text I'm writing my editor will jump to the citation's bibliographic details

To create tags for a set of bibliography files, all you need to do is to run on all your bibliography files the following Unix shell script

#!/bin/sh
awk '/^@/{ printf "%s\t%s\t?^%s?\n",$2,FILENAME,$0}' FS='[,{ 	(]*' $* |
sort >tags
or the following Windows batch file (provided you have awk installed on your system)
@awk "/^@/{ printf \"%%s\t%%s\t?^%%s?\n\",$2,FILENAME,$0}" FS="[,{ 	(]*" %* | sort >tags
I call this simple script btags, and I run it as follows
btags /home/dds/bib/*.bib *.bib
Problem solved!

Comments   Toot! Share


Last modified: Thursday, October 15, 2009 9:25 am

Creative Commons Licence BY NC

Unless otherwise expressly stated, all original material on this page created by Diomidis Spinellis is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License.