Back Table of contents Index Next   BibTool Manual
Introduction
Using BibTool --- Some Instructive Examples
Key Generation

Key Generation

Once you have a reference and you insert it into a BibTeX file you have to assign a reference key to it. The problem is to find a key which is unique and meaningful, i.e. easy to remember. The easiest way to remember a key is to use an algorithm to create it and remember the algorithm---which is the same for all keys.

One algorithm which comes to mind is to use the author and (an initial part) of the title. Alternatively we can use the author and the year. But the problem is with industrious authors writing more than one publication per year. The necessary disambiguation of such references is not very intuitive. However, BibTool has the capability to describe desired keys. Thus, the alternatives described above can be realized.

For this section we want to use the following BibTeX entry as our example:1 Suppose it is contained in a file named sample.bib.

@ARTICLE{article-full,
   author = {L[eslie] A. Aamport},
   title = {The Gnats and Gnus Document Preparation System},
   journal = {\mbox{G-Animal's} Journal},
   year = 1986,
   volume = 41,
   number = 7,
   pages = "73+",
   month = jul,
   note = "This is a full ARTICLE entry",
}
First, we want to see how we can make keys consisting of author and title. This is one of my favorite algorithms thus it is rather easy to use it. You simply have to run the command

bibtool -k sample.bib -o sample1.bib

Afterwards the following entry can be found in the file sample1.bib:

@Article{         aamport:gnats,
  author        = {L[eslie] A. Aamport},
  title         = {The Gnats and Gnus Document Preparation System},
  journal       = {\mbox{G-Animal's} Journal},
  year          = 1986,
  volume        = 41,
  number        = 7,
  pages         = "73+",
  month         = jul,
  note          = "This is a full ARTICLE entry"
}
You see that the reference key has been changed. It now consists of the last name and the first relevant word of the title, separated by a colon. Sometimes it might be desirable to incorporate the initial names as well. This can be achieved by the command

bibtool -K sample.bib -o sample1.bib

The resulting reference key is aamport.la:gnats. The initials are appended after the first name. Thus the usual lexicographic order on the keys will (hopefully) bring together the publications of the same first author.

Another alternative is to use the author and the year. This can be achieved with the following command:2

bibtool -f %n(author):%2d(year) sample.bib -o sample1.bib

The resulting key is Aamport:86. Note that the last example works as desired for our sample file. But for a real application of this technique a deep understanding of the key generation mechanism as described in section Key Generation is necessary.


1 Shamelessly stolen from the BibTeX xamples.bib file.
2 Note that some command line interpreters (like the UN*X shells) require the format string to be quoted (enclosed in single quotes).



Back Table of contents Index Next   BibTool Manual
Introduction
Using BibTool --- Some Instructive Examples
Key Generation
© 1999 Gerd Neugebauer