Managing references
A general overview of BibTeX.
Table of Contents
1 Motivation
1.1 Before BibTeX
1.1.1 In the .tex file
You can include references in a .tex file without BibTeX, you just need to do something like this:
Then any reference can be called in the .tex file by using the command \cite, for example \cite{Zariski}.
1.2 Why is this a mess?
1.2.1 Including each reference is work
1.2.2 Order matters.
- If order alphabetically you have to be very careful.
- Imagine you order them by order of appearance and move one section to another place.
1.2.3 Every journal has its own style.
- Most of the time you do not know where you will submit the article. 2x the work.
- If a paper gets rejected, it means start again. 3x the work.
- If you reuse a reference in another paper you cannot reuse the LaTeX code unless the two papers are sent to the same journal.
2 BibTeX
2.1 What is BibTeX?
A reference management software for formatting lists of references.
This is the official web page of the project:
2.2 History
- Created by Oren Patashnik and Leslie Lamport in 1985.
- Version 0.99c was released in 1988.
- Version 0.99d was released in 2010.
2.3 How it works
- It takes as input:
- an .aux file produced by LaTeX before;
- a .bst file, the style file;
- a .bib file(s), database of all the references.
- BibTeX chooses from the .bib file(s) only those entries specified by the .aux file (that is, those given by LaTeX's \cite or \nocite commands)
- BibTex then creates as output a .bbl file containing these entries together with the formatting commands specified by the file
- LaTeX will use the .bbl file to produce the reference list.
2.4 The .bib file
2.4.1 Adding a book
Suppose you want to include a reference to a book:
Philosophiæ Naturalis Principia Mathematica by Isaac Newton, 1687 published by The Royal Society.
Start by creating a .tex file:
Inside the "document" indicate with a key (for this example I will use "principia") that you want to cite the book.
Add the following as well.
This will tell BibTex to use the file my_bibliography.bib for the references and the "plain" style (more on this below on Styles).
Compile that .tex file. Check in your LaTeX editor how to do this.
Now we need to do a my_bibliography.bib file that contains:
Of course we can use any other name for the .bib file, but we have to be consistent in the .tex file where it says \bibliography{my_bibliography}, and change it accordingly.
Note: BibTeX does not care for whitespace, so we could have added this code as
but it looks ugly, so I indent all my BibTeX code. Maybe your editor can clean your entry in a nice way.
Once done with this we need to compile use the "bibtex" program to produce the .bbl file. Again you need to check your editor to see how to do this.
Then we compile again the .tex file and compile it again (LaTeX needs the .bbl to produce the References Section and needs the References Section to cross-reference the references in the text).
2.4.2 Adding an article
If we also want to include the article:
The foundation of the general theory of relativity, by Albert Einstein published in Annalen Physics in 1916. Volume 49, number 31 and pages 769-822.
We just add:
and then we can \cite{einstein} in our .tex file.
Compile the result using LaTeX, then BibTeX, then LaTeX and then LaTeX again.
Big thing here is that probably your LaTeX editor has a fast way to add each one of the entry types, that already formats all the required fields and gives optional fields as well.
2.5 Styles
If you change the "plain" in the \bibliographystyle{plain} for one of the following below you will get a different result.
2.5.1 Standard formats
The following formats come included in BibTeX, so there is no need to download them:
- abbrv abbreviated (Ordered alphabetically and abbreviates the months the first names, etc.)
- alpha alphabetic (Ordered alphabetically and prints the keys with a couple of letters of the name and the year, very nice on books)
- plain plain (Ordered alphabetically, nothing more)
- unsrt unsorted (Ordered by appearance)
2.5.2 Semi-standard
These are also included in BibTeX:
- acm Association for Computing Machinery Transactions
- apalike American Psychological Association
- ieeetr Institute of Electrical and Electronics Engineers Transactions
- siam Society of Industrial and Applied Mathematics
2.6 Common issues
2.6.1 Several names
An article by Jorge Alfaro, Arturo Murillo and Jorge Arturo Alfaro Murillo.
Do:
Then you can \cite{my_key} in your .tex file.
2.6.2 Complicated names
How to type: Jorge Arturo de la Trinidad von der Höh de la O, III.
Note that to write special characters we have to use braces {}.
2.6.3 BibTeX does not respect capital letters
Note that in the example of the Several names when compiling the LaTeX file, USA appears as usa. Of course we do not want that. The solution is to change the title to:
Anything you write within the entry in braces {} will appear as it is in you code.
2.6.4 How to cite a web page
Suppose we want to cite
http://en.wikipedia.org/wiki/Special:Random
Go to the left of the web page, where it says "Toolbox"", then to "Cite this page" and scroll down to "Bibtex entry". Copy the code.
The lesson is that the entry type that we need is @misc and that we can add a field called "note" indicating whatever we need. "note" is an optional field that can be included in any entry type.
Also note that there are two ways of copying the code in Wikipedia, one is nicer but requires you to load an extra package. In the preamble of the .tex file add:
2.6.5 How to cite a chapter of a book
Suppose we want to cite only Chapter 2 of Principia:
We have to change to the entry type to @InBook and include another field called chapter:
Tip: This defaults to chapter, if you want to cite Section 1.2 instead a section you can use:
2.6.6 How to cite an article in a collection
- An example
Suppose you want to cite:
"The Chain of Infection, Contacts, and Model Parametrization"
by "Stephen Tennenbaum"
that appears in
"Mathematical and Statistical Estimation Approaches in Epidemiology"
a book published by "Springer" in "2009" with
"Chowell, G. Hyman, J.M. Bettencourt, L.M.A. and Castillo-Chavez, C."
as editors.
- What field to use
@InCollection, include it like this:
- Citing another article in the same book
Stochastic Epidemic Modeling by Greenwood, P.E. and Gordillo, L.F.
Tip: if there are several articles of a book collection that you want to cite, you can make one entry for the book and use crossref to bring its information. You need to put the book after the entry.
We put both the title and booktitle fields so that BibTeX does not give a warning (since every book entry should have a title).
2.6.7 How to cite an article from arxiv or something in an electronic collection
Use @Unpublished and add a note field. Put in the note field the date you downloaded it, e.g., "Retrieved November 29, 2012".
2.6.8 But the journal I am submitting to just asks for a .tex file!
Copy all the content of the .bbl file into a thebibliography environment like the one we created in the .tex file that we started with.