Bibliography management with natbib
When it comes to bibliography management in LaTeX, the package natbib is a package for customising citations (especially author-year citation schemes) when using BibTeX. 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 because that package provides localization in several languages, it's actively developed and makes bibliography management easier and more flexible. However, note that most journals still use bibtex
and natbib
.
Introduction
A minimal working example is presented below:
\usepackage{natbib}
\bibliographystyle{unsrtnat}
\title{Bibliography management: \texttt{natbib} package}
\author{Overleaf}
\date {April 2021}
\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:
\usepackage{natbib}
- Imports the package natbib.
\bibliographystyle{unsrtnat}
- Sets the bibliography style unsrtnat. See the article about bibliography styles for more information.
\cite{labelcompanion}
- 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.
bibliography{sample}
- Imports the file sample.bib that contains bibliography sources. See the bibliography file section.
Open an example of the natbib
package in Overleaf
Basic usage
A simple working example was shown at the introduction, there are more bibliography-related commands available.
\documentclass{article}
\usepackage[english]{babel}
\usepackage[square,numbers]{natbib}
\bibliographystyle{abbrvnat}
\title{Bibliography management: \texttt{natbib} package}
\author{Overleaf}
\date {April 2021}
\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
square
andnumbers
in\usepackage[square,numbers]{natbib}
enable squared brackets and numeric citations respectively. See the reference guide for a list of package options
- The styles abbrvnat is used here, see bibliography styles
- The command
\citet
adds the name of the author to the citation mark, regardless of the citation style.
Open another example of the natbib
package in Overleaf
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.
@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"
}
This file contains records in a special format, for instance, the first bibliographic reference is defined by:
@article{...}
- This is the first line of a record entry,
@article
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 (article
,book
andmisc
there are a lot more, see the reference guide.
einstein
- The label
einstein
is assigned to this entry, is a unique identifier that can be used to refer this article within the document.
author = "Albert Einstein",
- 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
key = value
, 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 \bibliography{sample}
. Not all the information in the .bib file will be displayed, it depends on the bibliography style set in the document.
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{article}
\usepackage[english]{babel}
%Includes "References" in the table of contents
\usepackage[nottoc]{tocbibind}
%Import the natbib package and sets a bibliography style
\usepackage[square,numbers]{natbib}
\bibliographystyle{abbrvnat}
%Title and author
\title{Bibliography management: \texttt{natbib} package}
\author{Overleaf}
\date {April 2021}
\begin{document}
\maketitle
\tableofcontents
\section{First Section}
This document is an example...
%Imports the bibliography file "sample.bib"
\bibliography{sample}
\end{document}
Open an example of natbib
and table of contents in Overleaf
Adding the line
\usepackage[nottoc]{tocbibind}
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.
Reference guide
natbib package options
round
for round parenthesessquare
uses square bracketscurly
curly bracesangle
angle braces or chevronssemicolon
separates multiple citations with semicolonscolon
same assemicolon
comma
separate multiple citations with commasauthoryear
for author-year citationsnumbers
for numerical citationssuper
superscripts for numerical citations, as in Naturesort
orders multiple citations according to the list of referencessort&compress
same assort
but multiple numerical citations are compressed if possiblecompress
compress without sortinglongnamefirst
the full name of the author will appear in the first citation of any referencesectionbib
To be used with the package chapterbib to add the bibliography to the table of contents as a unnumbered section instead of an unnumbered chapternonamebreak
prevents hyphenation of author nameselide
to omit common elements of merged references
Standard entry types
article
- Article from a magazine or journal
book
- A published book
booklet
- A work that is printed but has no publisher or sponsoring institution
conference
- An article in a conference proceedings
inbook
- A part of a book (section, chapter and so on)
incollection
- A part of a book having its own title
inproceedings
- An article in a conference proceedings
manual
- Technical documentation
mastersthesis
- A Master's thesis
misc
- Something that doesn't fit in any other type
phdthesis
- A PhD thesis
proceedings
- The same as
conference
techreport
- Report published by an institution
unpublished
- 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 |
Further reading
For more information see
Overleaf guides
- Creating a document in Overleaf
- Uploading a project
- Copying a project
- Creating a project from a template
- Using the Overleaf project menu
- Including images in Overleaf
- Exporting your work from Overleaf
- Working offline in Overleaf
- Using Track Changes in Overleaf
- Using bibliographies in Overleaf
- Sharing your work with others
- Using the History feature
- Debugging Compilation timeout errors
- How-to guides
- Guide to Overleaf’s premium features
LaTeX Basics
- Creating your first LaTeX document
- Choosing a LaTeX Compiler
- Paragraphs and new lines
- Bold, italics and underlining
- Lists
- Errors
Mathematics
- Mathematical expressions
- Subscripts and superscripts
- Brackets and Parentheses
- Matrices
- Fractions and Binomials
- Aligning equations
- Operators
- Spacing in math mode
- Integrals, sums and limits
- Display style in math mode
- List of Greek letters and math symbols
- Mathematical fonts
- Using the Symbol Palette in Overleaf
Figures and tables
- Inserting Images
- Tables
- Positioning Images and Tables
- Lists of Tables and Figures
- Drawing Diagrams Directly in LaTeX
- TikZ package
References and Citations
- Bibliography management with bibtex
- Bibliography management with natbib
- Bibliography management with biblatex
- Bibtex bibliography styles
- Natbib bibliography styles
- Natbib citation styles
- Biblatex bibliography styles
- Biblatex citation styles
Languages
- Multilingual typesetting on Overleaf using polyglossia and fontspec
- Multilingual typesetting on Overleaf using babel and fontspec
- International language support
- Quotations and quotation marks
- Arabic
- Chinese
- French
- German
- Greek
- Italian
- Japanese
- Korean
- Portuguese
- Russian
- Spanish
Document structure
- Sections and chapters
- Table of contents
- Cross referencing sections, equations and floats
- Indices
- Glossaries
- Nomenclatures
- Management in a large project
- Multi-file LaTeX projects
- Hyperlinks
Formatting
- Lengths in LaTeX
- Headers and footers
- Page numbering
- Paragraph formatting
- Line breaks and blank spaces
- Text alignment
- Page size and margins
- Single sided and double sided documents
- Multiple columns
- Counters
- Code listing
- Code Highlighting with minted
- Using colours in LaTeX
- Footnotes
- Margin notes
Fonts
Presentations
Commands
Field specific
- Theorems and proofs
- Chemistry formulae
- Feynman diagrams
- Molecular orbital diagrams
- Chess notation
- Knitting patterns
- CircuiTikz package
- Pgfplots package
- Typesetting exams in LaTeX
- Knitr
- Attribute Value Matrices
Class files
- Understanding packages and class files
- List of packages and class files
- Writing your own package
- Writing your own class