Workin' It: Bibliography
So, you want to cite someone else's work in your document? There are a few steps to make this work, but once you get going, you'll never go back.Why use BiBTeX?
If you have ever written a paper with a bibliography, you know that assembling the references, checking the spelling, getting the formatting just so, and living with the inevitable errors is long, hard, and aggrevating. Why do all that work for every paper when you can do it just once? BiBTeX and JabRef work together so that you can concentrate on finding good works to cite rather than on how to cite them.Overview of using BiBTeX
Here's how it works.- Enter the bibliographic information for each document you want to cite into JabRef, a free Java-based program.
- Add a few lines to your source file.
- Cite documents using \cite{AuthorYear}.
Creating your BiBTeX Database using JabRef
First things first: If you want to cite a document, fist you have to put all the details for that document in a single file called a BiBTeX database. It is a simple text file that you could create and edit using any text editor (like WinEdt) but it has very specific formatting. Why bother when there is a free convenient program that puts a nice graphic-user interface on it?Installing JabRef
Download JabRef. I recommend downloading the .jar file and putting that in a folder like C:\Program Files\JabRef, then creating a shortcut directly to that file. In Linux, my shortcut runs java -jar /path/to/JabRef-2.1.jar.Using JabRef
Open the software and create a new database. Add articles, books, and other documents you want to cite. For each document, create a BiBTeX Key by clicking the magic wand button
. This creates the 'Author2006' entry,
and you can modify this or customize it as you like. These keys are
capitalization-sensitive and should not contain spaces or punctuation. This is how you
will refer to the document in the paper you are writing.
If you have Web access to an electronic version of the document, make sure you copy the 'Stable URL' (JSTOR) or DOI (many sites) into the appropriate box on the 'General' tab. JabRef will bring up your browser and take you right to the article -- very convenient. JabRef becomes the front end to all of your readings this way.
Entering odd names? Check out this reference.
Where do I save the BiBTeX database?
It doesn't really matter. I recommend putting it in a place where it will get backed up regularly (you backup your data, right?) One good place is under My Documents, perhaps in a folder named 'latex\bibtex'. Then you need to tell LaTeX where to find it. If you are using MiKTeX, open MiKTeX Options, go to the 'Roots' tab, and click 'Add'. Browse to the folder where you stored your .bib file. Now this .bib file should be available to any LaTeX document compiled on this computer.Formatting the References: BiBTeX Style Files
When using BiBTeX, you don't control directly the format of references you cite. The formatting is controlled by a BiBTeX Style File (.bst). Each BST formats things differently. Many journals offer their own BiBTeX style files. For most purposes you can use something like the Chicago format, available here. Download this and put it with your bibliographic database (.bib). If you use MiKTeX, you will need to open MiKTeX Options and click 'Refresh Now' under 'File name database' to make sure LaTeX knows this new BiBTeX style file is on your machine.Getting Your Source File Ready for Citations
Before you cite documents in your database, you need to add a few lines to your document. Your header needs to cite the natbib package. I like to force the first citation of a document to use all of the authors' names ('Smith, Jones, and Johnson, 2006' rather than 'Smith et al., 2006') using longnamesfirst and prevent breaking citations across lines using nonamebreak, so the header line looks like\usepackage[longnamesfirst,nonamebreak]{natbib}
Then you need to tell LaTeX how to format the bibliography. You do this by citing the
BiBTeX style file that you downloaded before. If you downloaded
chicago.bst, then add
the following line anywhere before where you want the bibliography:
\bibliographystyle{chicago}
Finally, you have to tell LaTeX where you want the bibliography. This command also tells
LaTeX the name of your database file. Assuming you named your bibliographic database (the
file you created in JabRef) myrefs.bib, just put this where you want the bibliography:
\bibliography{myrefs}
Together, your document may look somthing like this:
\documentclass{article}
\usepackage[longnamesfirst,nonamebreak]{natbib}
\begin{document}
(Put content here, including \cite{Author2006}.)
\bibliographystyle{chicago}
\bibliography{myrefs}
\end{document}
Citing other Documents
Now you are ready to cite documents! If this seemed like a lot of work up until now, well here's the payoff. To cite documents just add \cite{Author2006} where Author2006 is the BIBTeX key of one of the documents you entered using JabRef into your bibliographic database. This puts 'Author (2006)' in the document right where you put the \cite command and adds the full citation to the list of references at the end of your docuemnt. If you want other formats, check out this good reference.Compiling Your Document
Make sure you either click the bear
or
. This will run LaTeX, BiBTeX, then LaTeX twice.
Sometimes this process needs a jump start: click
then
, then the bear.
If you get ? where your citation is supposed to be, make sure you have saved the latest changes to your BiBTeX database, make sure you have run MiKTeX Options and updated the file name database, and make sure you spelled the BiBTeX key (usually AuthorYear) in your citation. Also check the spelling of your style file and BiBTeX database in the lines you added to your source file. If moving the .bib and .bst files to the same folder as the source file fixes things, then it's a problem with LaTeX finding the path where you have the other files. If not, it's almost certainly something wrong in your source file.