Using BibTex

Rob MacLeod


BibTex is a program that reads entries from a database of citations based on the output of LATEX and then makes a bibliography file that LATEX can insert into the document. There is lots to say about BibTex (and some good manuals that do it well) but here are some essentials I have found useful and not covered in the books. (There is a lot to say and learn about LATEX too). Finally, finding the material for a BibTex database is a chapter of its own, covered at least briefly at http://www.cvrti.utah.edu/~macleod/litbase

There are additional support tools available for use at the SCI Institute.

1 Editing BibTex files

To edit a BibTex file, you can use any editor but emacs has lots of great support for this process. The ones I like are Nelson Beebe's emacs tools found at www.math.utah.edu/pub/emacs/, in particular bibtools and bibtex-support.

Here is what my .emacs contains to access these:

;;; Add bibtex mode unconditionally; it is already bound to text-mode
;;; and we can do better than that.
(delq (assoc "\\.bib$" auto-mode-alist) auto-mode-alist)
(setq auto-mode-alist
      (cons (cons "\\.bib$" 'bibtex-mode) auto-mode-alist))
(autoload 'bibtex-mode  "~/emacs/lisp/bibtex/bibtex"
;(autoload 'bibtex-mode  "bibtex"
  "Enter BibTeX mode for bibliography editing." t nil)

(setq bibtex-mode-hook '(lambda ()
                          (setq comment-end "")
                          (setq comment-start "%% ")
                          (setq comment-start-skip "%+ *")
                          (setq bibtex-include-OPTcrossref nil)
                          (setq bibtex-include-OPTkey nil)
                          (setq bibtex-include-OPTannote nil)
                          (setq bibtex-include-robnote t)
                          (load "~/emacs/lisp/bibtex/bibtex-support")
                          (load "~/emacs/lisp/bibtex/bibtools")
                          ))

Note that these commands assume a subdirectory called emacs/lisp in which the require lisp code (.el or .elc files) is available.

2 Additional BibTex tools

There are some other fun software tools that can make life easier with BibTex. Most are in the public domain in one for or another and I have included links where I had them--if the links fail, use Google and please let me know (macleod@cvrti.utah.edu).

2.1 EndNote

EndNote is not really a program that works on BibTexfiles but it does manage citations well and it has some support for BibTex that can make it useful.

See endnote.html for more details on how to convert between Endnote and BibTex.

2.2 bibclean

The goal of bibclean is to clean up syntax and layout errors in BibTex files so that all entries have a nice, clean look that is consistent. The program will also reveal some errors in the file, which can be very helpful! To get bibclean, surf on over to
www.math.utah.edu/pub/bibclean/ and thank Nelson Beebe for making this available.

One of the many arguments to bibclean essential for SCI databases, if only because it is the convention we had adopted:

    bibclean -no-fix-names
which I actually alias to bibclean so that I don't forget!

2.3 bibindex/biblook

This is a pair of programs that support nice searching of a BibTex file. The first of the pair, bibindex, makes an index from an existing .bib file and biblook is the actual search engine.

To get these, go to sourceforge.net/projects/biblook/
and follow the typical instructions for downloading Unix software.

Once you have them both installed, just enter the commands

    bibindex filename.bib
    biblook filename
and you will will see a simple prompt from which you can enter the search commands, for example, the help command:
    biblook version 2.6  file version 3
    Type ? or h for help
    biblook: ?
        ------------------------------------------------------------
        help                    Print this message
        find <field> <words>    Find entries with <words> in <field>
        and  <field> <words>    Narrow search
        or   <field> <words>    Widen search
        display                 Display search results
        save <file>             Save search results to <file>
        whatis <abbrev>         Find and display an abbreviation
        quit                    Quit biblook
        ------------------------------------------------------------
        Type `help' or `?' again for more details.
and then carry out a search for my papers on ischemia
    biblook: find author macleod
            123 matches found.
    biblook: find author macleod and title ischemia
            15 matches found.
    biblook: display

    @InProceedings{RSM:Bro94,
      author =       "D.H. Brooks and R.S. MacLeod and H. Krim",
      title =        "Analysis of Changes in Body Surface Potentials During
                     {PTCA}-Induced Ischemia Using the Temporal Wavelet
                     Transform",
      pages =        "329--332",
      booktitle =    c-CinC,
      year =         "1994",
      publisher =    pub-IEEE,
      robnote =      "Dana's paper from the Computer in Cardiology
                      meeting.",
    }

    @InProceedings{RSM:Bro94c,
      author =       "D.H. Brooks and H. On and R.S. MacLeod",
      title =        "Spatio-temporal wavelet analysis of body surface
                     potential maps during {PTCA}-induced ischemia",
      pages =        "1208--1209",
      booktitle =    c-EMBS94,
      year =         "1994",
      robnote =      "A paper Hanson presented at EMBS in Baltimore on
                     wavelets with PTCA data",
    }
and so on...

2.4 Testing a BibTex file

There is a simple way to test a BibTex file for completeness using LATEX and the bibtex commands from your own computer. Testing is a good plan, especially if you do it after editing the file and not when you are in a hurry and have to build a document using the file.

To test a BibTex file, make a LaTeX file, call it testbib.tex with the following contents:

    \documentclass[]{article}
    \begin{document}

    Some text.
     \nocite{*}

    \bibliography{sci}
    \bibliographystyle{unsrt}

    \end{document}
where ``sci'' is the name of the BibTex file to test.

Then run

    latex testbib
    bibtex testbib
and the output will list all the errors or warnings resulting from trying to parse the file sci.bib. Some of the output will be warnings that you can ignore but other errors can be fatal the next time you use the file.

About this document ...

Using BibTex

This document was generated using the LaTeX2HTML translator Version 2002-2-1 (1.70)

Copyright © 1993, 1994, 1995, 1996, Nikos Drakos, Computer Based Learning Unit, University of Leeds.
Copyright © 1997, 1998, 1999, Ross Moore, Mathematics Department, Macquarie University, Sydney.

The command line arguments were:
latex2html -split 3 -no_white -link 3 -no_navigation -no_math -html_version 3.2,math -show_section_numbers -local_icons bibtex-tips

The translation was initiated by Rob Macleod on 2005-02-26


Rob Macleod 2005-02-26