# Bib Bibliography Latex

LaTeX supports bibliographies out of the box, either embedding the references in your document or storing them in an external file. This article explains how to manage bibliography with the environment and the BibTeX system.

Note: If you are starting from scratch it's recommended to use biblatex since that package provides localization in several languages, it's actively developed and makes bibliography management easier and more flexible.

## Introduction

Standard bibliography commands in LaTeX have a similar syntax to that of lists and items.

\begin{thebibliography}{9}\bibitem{latexcompanion} Michel Goossens, Frank Mittelbach, and Alexander Samarin. \textit{The \LaTeX\ Companion}. Addison-Wesley, Reading, Massachusetts, 1993.   \bibitem{einstein} Albert Einstein. \textit{Zur Elektrodynamik bewegter K{\"o}rper}. (German) [\textit{On the electrodynamics of moving bodies}]. Annalen der Physik, 322(10):891–921, 1905.   \bibitem{knuthwebsite} Knuth: Computers and Typesetting, \\\texttt{http://www-cs-faculty.stanford.edu/\~{}uno/abcde.html}\end{thebibliography}

The environment produces a list of references; such list will be titled "References" in a article document class, and "Bibliography" in book and report document classes. A parameter inside braces, in the example, indicates the number of entries to be added; this parameter can not be greater than 99.

To create a bibliography entry the command is used. A parameter inside braces is set to label this entry and can later be used as identifier for this reference. After the closing brace the text with the name of the author, the book title, publisher and so on is entered.

ShareLaTeX provides several templates with pre-defined styles to manage bibliography. See this link

Open an example in ShareLaTeX

## Embedded system

The example presented in the introduction only contains list of references, the next example shows how to cite the entries of that list within the document.

\begin{document}   \section{First section}   This document is an example of \texttt{thebibliography} environment using in bibliography management. Three items are cited: \textit{The \LaTeX\ Companion} book \cite{latexcompanion}, the Einstein journal paper \cite{einstein}, and the Donald Knuth's website \cite{knuthwebsite}. The \LaTeX\ related items are \cite{latexcompanion,knuthwebsite}.   \medskip   \begin{thebibliography}{9}\bibitem{latexcompanion} Michel Goossens, Frank Mittelbach, and Alexander Samarin. \textit{The \LaTeX\ Companion}. Addison-Wesley, Reading, Massachusetts, 1993.   \bibitem{einstein} Albert Einstein. \textit{Zur Elektrodynamik bewegter K{\"o}rper}. (German) [\textit{On the electrodynamics of moving bodies}]. Annalen der Physik, 322(10):891–921, 1905.   \bibitem{knuthwebsite} Knuth: Computers and Typesetting, \\\texttt{http://www-cs-faculty.stanford.edu/\~{}uno/abcde.html}\end{thebibliography}   \end{document}

The command insert the number corresponding to the bibliography entry whose label is passed inside braces. For example, the output of is [2].

The information printed by the command depends on the bibliography style used. See Bibtex bibliography styles.

Open an example in ShareLaTeX

## Bibliography management with Bibtex

BibTeX is a widely used bibliography management tool in LaTeX, with BibTeX the bibliography entries are kept in a separate file and then imported into the main document.

Once the external bibliography file is imported, the command is used just as in the introductory example.

Ths document is an example of BibTeX using in bibliography management. Three items are cited: \textit{The \LaTeX\ Companion} book \cite{latexcompanion}, the Einstein journal paper \cite{einstein}, and the Donald Knuth's website \cite{knuthwebsite}. The \LaTeX\ related items are \cite{latexcompanion,knuthwebsite}.   \medskip   \bibliographystyle{unsrt}\bibliography{sample}

This uses the following commands:

Imports the BibTeX file "sample.bib" to display the bibliography. To import several .bib files just write them comma-separated inside the braces, the file extension is not necessary.
Sets the bibliography style to be used in this document. The information displayed depends on the bibliography style used, even if the entry contains information about the date, author, title, publisher, and abstract, the style used might only print the title and the author. See Bibtex bibliography styles which contains examples of the default bibliography styles in LaTeX.
This will print a number of text, depending on the bibliography style, to reference the bibliography entry whose label is passed to the command. In this case, the label produces [2].

When the main document is compiled, a .bbl file is generated from the .bib file. This is simply a .tex file reorganising the information in the .bib file in a environment, as above. On ShareLaTeX the .bbl file is stored in the cache, and you can download it from the list of other logs and files.

Note: Unicode characters are not supported on BibTeX. Also, if there are too many bibliography entries (+100) it may not work properly. See the further reading section for links to other bibliography management tools.

Open an example of the bibtex package in ShareLaTeX

## The bibliography file

Bibliographic references are usually kept in a bibliography file whose extension is .bib, this file consists of a list of records and fields. Each bibliography record holds relevant information for a single entry.

This file contains records in a special format, for instance, the first bibliographic reference is defined by:

This is the first line of a record entry, denotes the entry type and tells BibTeX that the information stored here is about an article. Besides the entry types shown in the example (, and ) there are a lot more, see the reference guide.
The label is assigned to this entry, is an identifier that can be used to refer this article within the document.
This is the first field in the bibliography entry, indicates that the author of this article is Albert Einstein. Several comma-separated fields can be added using the same syntax , for instance: title, pages, year, URL, etc. See the reference guide for a list of possible fields.

The information in this file can later be used within a LaTeX document to include these references, as shown in the next subsection.

Open an example of the bibtex package in ShareLaTeX

There are two ways of including the bibliography in the table of contents, either manually adding it or using the package tocbibind (recommended).

To add it manually just insert the next line right before the command or

for books and reports or

for articles. If you prefer to use tocbibind see the next example.

\documentclass[a4paper,10pt]{article}\usepackage[utf8]{inputenc}\usepackage[english]{babel}   \usepackage[nottoc]{tocbibind}   \begin{document}   \tableofcontents   \section{First Section} This document ...   \bibliographystyle{unsrt}\bibliography{sample}   \end{document}

Open an example of the bibtex package in ShareLaTeX

## Reference guide

Standard entry types

Article from a magazine or journal
A published book
A work that is printed but have no publisher or sponsoring institution
An article in a conference proceedings
A part of a book (section, chapter and so on)
A part of a book having its own title
An article in a conference proceedings
Technical documentation
A Master's thesis
Something that doesn't fit in any other type
A PhD thesis
The same as
Document not formally published, with author and title

Most common fields used in BibTeX

 address annote author booktitle chapter crossref edition editor institution journal key month note number organization pages publisher school series title type volume year URL ISBN ISSN LCCN abstract keywords price copyright language contents

@article{einstein, author = "Albert Einstein", title = "{Zur Elektrodynamik bewegter K{\"o}rper}. ({German}) [{On} the electrodynamics of moving bodies]", journal = "Annalen der Physik", volume = "322", number = "10", pages = "891--921", year = "1905", DOI = "http://dx.doi.org/10.1002/andp.19053221004" }   @book{latexcompanion, author = "Michel Goossens and Frank Mittelbach and Alexander Samarin", title = "The \LaTeX\ Companion", year = "1993", publisher = "Addison-Wesley", address = "Reading, Massachusetts" }   @misc{knuthwebsite, author = "Donald Knuth", title = "Knuth: Computers and Typesetting", url = "http://www-cs-faculty.stanford.edu/\~{}uno/abcde.html" }
\usepackage[nottoc]{tocbibind}
Your LaTeX file needs to include
• a reference to a label in your BibTeX file whenever you want to cite an item in the file
• a reference to the bibliography style file you want to use, which determines how the references you cite are formatted in the bibliography of your document (and possibly a LaTeX style file associated with the bibliography style)
• a LaTeX command to generate the bibliography at the point in your document where you want it to appear.

#### Example using

Here is an example using the bibliography style , which produces citations in "author (year)" format. This file is available on this page (which has instructions on where to put the file once you get it). The lines related to BibTeX are highlighed. It requires the LaTeX style file to produce citations in the right style in the text (matching the format of the references produced by ). You probably have this file already (assuming you have some implementation of TeX on your computer). If you don't, you can get it on this CTAN page. Hover over orangetext to see explanations.

When you run the LaTeX file through LaTeX and BibTeX (instructions below), you'll get output for the body of the document that looks roughly like this:

This document illustrates the use of BibTeX. You may want to refer to Arrow et al. (1961) or Aliprantis and Border (1994) or Maskin (1985). Or you may want to cite a specific page in a reference, like this: see Maskin (1985, p. 199). Or perhaps you want to cite more than one paper by Maskin: Maskin (1985, 1999). Or you want to make a parenthetical reference to one or more articles, in which case the \citealt command omits the parentheses around the year (Arrow et al. 1961).
A few more options for the command are available. Here they are:
 Jones et al. (1990) Jones, Baker, and Smith (1990) (Jones et al. 1990) (Jones, Baker, and Smith 1990) (Jones et al., 1990, p. 99) (e.g. Jones et al., 1990) (e.g. Jones et al., 1990, p. 99) Jones et al. Jones, Baker, and Smith 1990 * Jones et al.'s (1990)

*Assumes \citeapos is defined in your style or document like this:

(Thanks to Christopher M. Duncombe Rae for pointing out this simple way of generating a possessive citation.)

The list of references will look like this:

Aliprantis, Charalambos D. and Kim C. Border (1994), Infinite Dimensional Analysis. Springer, Berlin.

Arrow, Kenneth J., Leonid Hurwicz, and Hirofumi Uzawa (1961), "Constraint qualifications in maximization problems." Naval Research Logistics Quarterly, 8, 175–191.

Maskin, Eric S. (1985), "The theory of implementation in Nash equilibrium: a survey." In Social Goals and Social Organization (Leonid Hurwicz, David Schmeidler, and Hugo Sonnenschein, eds.), 173–204, Cambridge University Press.

Maskin, Eric S. (1999), "Nash equilibrium and welfare optimality." Review of Economic Studies, 66, 23–38.

#### Example using

Here is an example using the bibliography style , which in included in many LaTeX systems.

When you run the LaTeX file through LaTeX and BibTeX (instructions below), you'll get output for the body of the document that differs from the output when you use only in that the names of all three authors of Arrow, Hurwicz, and Uzawa (1961) are listed in the first citation to that work, although not in the second, parenthetical, citation.

The list of references differs more significantly from the list produced by : only authors' initials, not their full first names, are included, and "&" rather than "and" is used as a separator; numbers in page ranges are separated by hyphens, rather than the conventional en-dashes. Precisely, the list of references produced by looks like this:

Aliprantis, C. D. & K. C. Border (1994), Infinite Dimensional Analysis. Berlin: Springer.

Arrow, K. J., Hurwicz, L., & Uzawa, H. (1961), Constraint qualifications in maximization problems. Naval Research Logistics Quarterly, 8, 175-191.

Maskin, E. S. (1985), The theory of implementation in Nash equilibrium: a survey. In L. Hurwicz, D. Schmeidler, & H. Sonnenschein (Eds.), Social Goals and Social Organization (p. 173-204). Cambridge: Cambridge University Press.

Maskin, Eric S. (1999), Nash equilibrium and welfare optimality. Review of Economic Studies, 66, 23-38.

#### Other bibliography styles for author-year citations

A family of styles that produce author-year citations is available on this page.

#### Creating your own bibliography style

A BibTeX style file is plain text, which in principle you can edit. However, the language used is arcane, and changes that are more than trivial are tricky. A better way to proceed is to create a new style file from scratch, using the custom-bib package (that's how I created ). You run TeX on a file, which asks you a long list of questions about the features of the style you would like. You'll probably not be completely clear about your preferred answers to all the questions on your first attempt, but two or three runs should produce a format to your liking.