User:Johannes Bo/draft:Bibtex

Title to be: Bibliographies with BibTeX

Learn how to create a bibliography using the stable BibTeX workflow - A short tutorial.

BibTeX has been developed in the 1980's to ease the creation and management of citations and bibliographies within LaTeX. The workflow is split in different parts.
 * The user provides a plain text database which includes the bibliographic information of the sources used.
 * The user also points the BibTeX system to a bibliographystyle file, a plain text file that defines the layout of the bibliography, including styling author lists, the appearance of titles as well as the order in which the information is output.
 * The user calls the BibTeX program, an external tool, which then grabs which citations are needed in the document, takes them from the database and formats them according to the chosen bibliographystyle. The result is a finished bibliography that can be read and typeset by LaTeX.

The database
Creating a bibliography using BibTeX means storing all of your available bibliographic information in a simple text-based database. The name should be as unique as possible, for example. This is helpful when transferring files with your advisor, students or colleagues. The helper program BibTeX is used to deal with the database.

A sample database file could look like this:

Every entry in the database starts with an -sign followed by the entry type (book or article for example). More types are available. The bibliographic information for each entry are stored in a pair of braces, beginning with a unique keyword for every source item (bibkey). Least complicated way of presenting the data is every field type in a new line, the content in curly braces, followed by a comma. The order in which you give the information is not important.

Please have a close look at the authors, every individual author is separated by the keyword.

A simple example - Step by Step
is a command provided by LaTeX, it takes a key from the database (see above) as argument. Every time something is cited, a note is written for the BibTeX program in an auxiliary file. takes the name of the style you want the bibliography to have and is also written to the auxiliary file. takes the name of the database (without the file extension). After the first LaTeX run, we see question marks instead of citation numbers and the  file tells us

All the citations are undefined and there is no. Now, BibTeX is needed to get the needed citations and create the bibliography list. It needs to be run on the name of the main project file, but without the file extension. Your favourite LaTeX editor will have a button for that. The result is the following output in the terminal.

BibTeX has read in three different files, the aforementioned auxiliary file , the bibliographystyle file and the database and has generated two new files. One has the file ending  and is the log file of BibTeX, the other on has the ending. This is the file LaTeX was complaining about missing earlier.

Since this file is now available, LaTeX can be run again.



The bibliography is done, but LaTeX still warns about undefined references but also gives a hint: After another (few) LaTeX runs, all citations and cross references will be resolved.



The reference list is sorted by author names. A closer look shows us some mysterious results:
 * The names are formatted slightly differently in the first two entries, the second one having an Oxford comma.
 * The journal title of the first entry is italic, but it is the book title for the second
 * The title of the third entry lost its uppercased letters and the url is missing completely in the output

The order of elements and the formatting are defined in the bibliographystyle file. , which was introduced in 1984, does not support URLs.

Several other default styles are available.





Splitting into different Topics
bibtopic

Bibliographies per Section or Chapter
You can have a bibliography for each chapter using the  package.

Back to main bibliography page