Skip to content

Natbib Styles Bibliography Generator

When it comes to bibliography management in LaTeX the program natbib is an alternative used in several journals. The program is not actively developed, but is very stable and widely used. This article explains how to use natbib to format and cite bibliographic sources.

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.

[edit]Introduction

A minimal working example is presented below:

\documentclass{article}\usepackage[utf8]{inputenc}\usepackage[english]{babel}   \usepackage{natbib}\bibliographystyle{unsrtnat}   \title{Bibliography management: \texttt{natbib} package}\author{Share\LaTeX}\date{}   \begin{document}   \maketitle   This document is an example of \texttt{natbib} package 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   \bibliography{sample}   \end{document}

In this example there are four basic commands to manage the bibliography:

Imports the package natbib.
Sets the bibliography style unsrtnat. See the article about bibliography styles for more information.
Prints a reference to the citation entry, what is printed depends on the citation style. The word inside the braces corresponds to a particular entry in the bibliography file.
Imports the file sample.bib that contains bibliography sources. See the bibliography file section.

  Open an example of the natbib package in ShareLaTeX

[edit]Basic usage

A simple working example was shown at the introduction, there are more bibliography-related commands available.

\documentclass{article}\usepackage[utf8]{inputenc}\usepackage[english]{babel}   \usepackage[square,numbers]{natbib}\bibliographystyle{abbrvnat}   \title{Bibliography management: \texttt{natbib} package}\author{Share\LaTeX}\date{}   \begin{document}   \maketitle   This document is an example of \texttt{natbib} package using in bibliography management. Three items are cited: \textit{The \LaTeX\ Companion} book \cite{latexcompanion}, the Einstein journal paper \citet{einstein}, and the Donald Knuth's website \cite{knuthwebsite}. The \LaTeX\ related items are \cite{latexcompanion,knuthwebsite}.   \medskip   \bibliography{sample}   \end{document}

There are a few changes in this example:

  • The options and in enable squared brackets and numeric citations respectively. See the reference guide for a list of package options
  • The command adds the name of the author to the citation mark, regardless of the citation style.

  Open an example of the natbib package in ShareLaTeX

[edit]The bibliography file

The bibliography files must have the standard bibtex syntax and the extension .bib. They contain a list of bibliography sources and several fields with information about each 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, tells BibTeX that the information stored here is about an article. The information about this entry is enclosed within braces. 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 a unique 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 printed and referenced within a LaTeX document, as shown in the previous sections, with the command . Not all the information in the .bib file will be displayed, it depends on the bibliography style set in the document.

  Open an example of the natbib package in ShareLaTeX

[edit]Adding the bibliography in the table of contents

If you want the bibliography to be included in the table of contents, importing the package tocbibind in the preamble will do the trick:

\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}

Adding the line


to the preamble will print the "References" or "Bibliography" in the table of contents, depending on the document type. Be careful, it will also add other elements like the Index, Glossary and list of Listings to the table of contents. For more information see the tocbibind package documentation.

  Open an example of the natbib package in ShareLaTeX

[edit]Reference guide

natbib package options

  • for round parentheses
  • uses square brackets
  • curly braces
  • angle braces or chevrons
  • separates multiple citations with semicolons
  • same as
  • separate multiple citations with commas
  • for author-year citations
  • for numerical citations
  • superscripts for numerical citations, as in Nature
  • orders multiple citations according to the list of references
  • same as but multiple numerical citations are compressed if possible
  • compress without sorting
  • the full name of the author will appear in the first citation of any reference
  • To be used with the package chapterbib to add the bibliography to the table of contents as a unnumbered section instead of an unnumbered chapter
  • prevents hyphenation of author names
  • to omit common elements of merged references

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
Report published by an institution
Document not formally published, with author and title


Most common fields used in BibTeX

address annote author
booktitle chaper 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

[edit]Further reading

For more information see

@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}

This is a gentle introduction to using some of the bibliography functionality available to LaTeX users beyond the BibTeX basics. This introduction won't be discussing how to create new styles or packages but rather how to use some existing ones. It is worth noting that Harvard, for example, is a citation style. It is associated with an alphabetical reference list secondarily ordered on date, but the only strictly defined element of Harvard style is the citation in author-date format.

The example data[edit]

The database used for my examples contains just the following

@article{Erdos65, title = {Some very hard sums}, journal = {Difficult Maths Today}, author = {Paul Erd\H{o}s and Arend Heyting and Luitzen Egbertus Brouwer}, year = {1930}, pages = {30}}

The limits of BibTeX styles[edit]

Using cite.sty and BibTeX makes it very easy to produce some bibliography styles. But author-date styles - for example the often mentioned, never defined "Harvard" - are not so easy. It's true that you can download some .bst files from CTAN that will handle some variants but using them is not always straightforward. This guide deals with Natbib a supplementary package that can access .bib files and has sophisticated functionality for producing custom or default author-year format citations and bibliographies as well as the numerical styles handled by BibTeX.

Natbib[edit]

Natbib is a package created by Patrick Daly as a replacement for the cite.sty package when author-date citation styles are required. Natbib provides three associated bibliography styles:

  • plainnat
  • abbrvnat
  • unsrtnat

which correspond to the three styles available by default in BibTeX where you have a plain numbered style, an abbreviated numbered style and an unsorted numbered style.

Alongside these new styles is an extended set of citation commands to provide flexible citation formats. These are

and

each of which has a number of variants.

The Preamble[edit]

All Natbib styles require that you load the package in your document preamble. So, a skeleton LaTeX file with Natbib might look like this:

\documentclass[]{article}\usepackage[round]{natbib}\begin{document} Document body text with citations. \bibliographystyle{plainnat}\bibliography{myrefs}\end{document}

Options[edit]

Options available with Natbib can be specified in the brackets on the \usepackage command. Among them are:

OptionEffect
round()
square[]
curly{}
angle<>
semicolonseparate citations with ;
colonas semicolon
commaseparate with commas
authoryearauthor-year citations
numbersnumeric citations
supersuperscript citations
sortmultiple citations are ordered as in bibliography
sort&compressas sort but number ranges are compressed and hyphenated
compressnumber ranges are compressed and hyphenated but only where the 'natural' sort produces a continuous range
longnamesfirstfirst citation is full author list and subsequent citations are abbreviated
sectionbiballows multiple bibliographies in the same document
nonamebreakforces all author names onto one line
mergemerges a citation with a previous citation
elideelides any repeated elements in merged references
mciteignore merge

Clearly some of these options require explanation but that will be achieved via examples below. For now, we just note that they can be passed through \usepackage[]{} in the preamble of your LaTeX file.

Citation[edit]

Basic Citation Commands[edit]

To cite with Natbib, use the commands \citet or \citep in your document. The "plain" versions of these commands produced abbreviated lists in the case of multiple authors but both have * variants which result in full author listings. We assume the use of the round option in these examples.

\citet and \citet*[edit]

The \citet command is used for textual citations, that is to say that author names appear in the text outside of the parenthetical reference to the date of publication. This command can take options for chapter, page numbers etc. Here are examples

\citet{Erdos65}producesErdős et al. (1965)
\citet[chapter 2]{Erdos65}producesErdős et al. (1965, chapter 2)
\citet[pp. 10-12]{Erdos65}producesErdős et al. (1965, pp. 10-12)
\citet[see][chap. 2]{Erdos65}producesErdős et al. (see 1965, chap. 2)

Here are the \citet* versions

\citet*{Erdos65}producesErdős, Heyting and Brouwer (1965)
\citet*[chapter 2]{Erdos65}producesErdős, Heyting and Brouwer (1965, chapter 2)
\citet*[pp. 10-12]{Erdos65}producesErdős, Heyting and Brouwer (1965, pp. 10-12)
\citet*[see][chap. 2]{Erdos65}producesErdős, Heyting and Brouwer (see 1965, chap. 2)

\citep and \citep*[edit]

The \citep command is used where the author name is to appear inside the parentheses alongside the date.

\citep{Erdos65}produces(Erdős et al. 1965)
\citep[chapter 2]{Erdos65}produces(Erdős et al. 1965, chapter 2)
\citep[pp. 10-12]{Erdos65}produces(Erdős et al. 1965, pp. 10-12)
\citep[see][chap. 2]{Erdos65}produces(see Erdős et al. 1965, chap. 2)
\citep[e.g.][]{Erdos65}produces(e.g. Erdős et al. 1965)

Here are the \citep* versions

\citep*{Erdos65}produces(Erdős, Heyting and Brouwer 1965)
\citep*[chapter 2]{Erdos65}produces(Erdős, Heyting and Brouwer 1965, chapter 2)
\citep*[pp. 10-12]{Erdos65}produces(Erdős , Heyting and Brouwer 1965, pp. 10-12)
\citep*[see][chap. 2]{Erdos65}produces(see Erdős , Heyting and Brouwer, 1965, chap. 2)
\citep*[e.g.][]{Erdos65}produces(e.g. Erdős , Heyting and Brouwer, 1965)

The Reference List[edit]

Having dealt with basic varieties of citation, we turn to the creation of the bibliography or reference list.

Inserting a correct and correctly formatted bibliography when using Natbib is no different than when using plain BibTeX. There are two essential commands -

\bibliography{mybibliographydatabase}

which LaTeX interprets as an instruction to read a bibliographic database file (eg myrefs.bib) and insert the relevant data here, and

\bibliographystyle{plainnat}

which specifies how the data are to be presented.

Above the three basic Natbib styles were mentioned as analogues of the partially homonymous styles in BibTeX. Let us imagine documents bearing citations as in the section about citation above. Here is, approximately, how these citations would appear in plainnat.

What more is there?[edit]

This covers the basic functionality provided by the package Natbib. It may not, of course, provide what you are looking for. If you don't find what you want here then you should probably next investigate harvard.sty which provides a slighly different set of author-date citation functions. Providing a gentle guide to harvard.sty is my next rainy day project.