The natbib package

Adds author-year citations to the BibTeX workflow: with the option round, \citet prints Knuth (1984) and \citep prints (Knuth, 1984).

Loading the package

\usepackage[round]{natbib}

The \cite command of LaTeX knows one form of citation, a number in square brackets. natbib adds a textual and a parenthetical form, notes before and after the citation, and commands for the author or the year alone.

The bibliography is still produced by BibTeX from a .bib file, with \bibliographystyle and \bibliography. The style has to supply author and year separately. The package brings three such styles: plainnat, abbrvnat and unsrtnat.

The run order is pdfLaTeX, BibTeX, then pdfLaTeX twice. Many journal templates require natbib; for a new document of your own, biblatex is the alternative with more control over the style.

Main commands

\citet{knuth1984}Textual citation: Knuth (1984).
\citep{knuth1984}Parenthetical citation: (Knuth, 1984).
\citep[see][p.~5]{knuth1984}Note before and after: (see Knuth, 1984, p. 5). A single optional argument is the note after the citation.
\citeauthor{knuth1984}, \citeyear{knuth1984}Only the author or only the year.
\citealp{knuth1984}Like \citep without the parentheses; \citealt does the same for \citet.
\usepackage[numbers,sort&compress]{natbib}Numeric citations; several keys in one \citep are sorted and merged into ranges such as [1-3].
\usepackage[round]{natbib}Round parentheses. Without the option the package uses square brackets: Knuth [1984].
\bibliographystyle{plainnat}A bibliography style that supports author-year citations.

Complete example

\documentclass{article}
\usepackage[round]{natbib}
\begin{document}
\citet{knuth1984} describes the program. Logical clocks order the
events of a distributed system \citep[p.~558]{lamport1978}.

\bibliographystyle{plainnat}
\bibliography{references}
\end{document}
Result
The compiled example

File references.bib:

@book{knuth1984,
  author    = {Donald E. Knuth},
  title     = {The {\TeX}book},
  publisher = {Addison-Wesley},
  year      = {1984}
}
@article{lamport1978,
  author  = {Leslie Lamport},
  title   = {Time, Clocks, and the Ordering of Events in a Distributed System},
  journal = {Communications of the ACM},
  volume  = {21},
  number  = {7},
  pages   = {558--565},
  year    = {1978}
}

Compiled with pdfLaTeX from TeX Live 2023. Tools run in this order: pdflatex → bibtex → pdflatex → pdflatex.

Pitfalls

Related pages