Intro | First attempt | Text | References | Figures | Maths | Source Code | Theorems

Making Bibliographies

The easiest way to make references in LaTeX is to use the bibtex system.

The bibtex database file

All the references should be kept in a separate file. A typical example looks like this:

  @article{hgs06ifs,
    title = {The Boneh-Shaw fingerprinting scheme is better than we thought},
    author = {HG Schaathun},
    journal = {IEEE Transaction on Information Forensics and Security},
    month = jun,
    year = 2006,
  } 
  @inproceedings{hgs06aaecc,
   author  = {HG Schaathun},
   title   = {Nested codes for constrained memory and for dirty paper},
   year    = 2006, 
   publisher = {Springer-Verlag},
   series = {Lecture Notes in Computer Science},
   booktitle = {Applied Algebra, Algebraic Algorithms and
                 Error-Correcting Codes},
  }
  @book{lc2nd,
    author = {Frank Mittelbach and Michel Goossens},
    title = {The \LaTeX\ Companion},
    year = 2004,
    edition = 2,
    publisher = {Addison-Wesley},
  }

This should be kept in a separate file with extension .bib. It will normally be shared between a number of LaTeX documents. The examples show the most common reference types and data fields; there are others which you can look up when you need them.

The first item after the paper type, e.g. lc2nd for the book, is the key, i.e. a unique identifier, and this is used to refer to the entry.

The LaTeX file

In the document, you use the \cite{} command, passing the key as a reference, e.g. \cite{lc2nd}. In order to include the reference list, you need the following two commands:

  \bibliographystyle{alpha}
  \bibliography{bibfile}

where bibfile is the name of the bib file (without extension), and alpha is the desired citation style. The alpha style gives author initials and year.

There are other citation styles which you can read about.

Compilation

When you use bibtex, the following sequence of commands is necessary to compile the document:

  pdflatex docfile
  bibtex docfile
  pdflatex docfile
  pdflatex docfile

The first pdflatex command records all the citations used, and bibtex reads the database and compiles the reference list. The second pdflatex command essentially sets the entire document, including the reference list. The third pdflatex command inserts correct references (figures, pages, etc) so that they are correct after the final typesetting.

If you do not add or remove citations, it is not necessary to rerun bibtex.