Author-year citations in LaTeX with natbib: \citep and \citet
Help centre › LaTeX › References and citations · Packages: natbib
Load \usepackage{natbib}, choose an author-year style such as \bibliographystyle{plainnat}, and cite with \citet{key} for "Smith and Brown (2020)" in the sentence or \citep{key} for "(Smith and Brown, 2020)" in parentheses. Notes go in optional arguments: \citep[see][p.~5]{key}.
A complete example
A whole document: paste it into an empty project and compile it.
\begin{filecontents*}[overwrite]{refs.bib}
@article{smith2020,
author = {Smith, Jane and Brown, Paul},
title = {Measuring Things Carefully},
journal = {Journal of Measurement},
year = {2020},
volume = {12},
pages = {1--10}
}
@book{garcia2018,
author = {Garcia, Maria and Chen, Wei and Okafor, Ngozi},
title = {Methods for Field Studies},
publisher = {University Press},
address = {Boston},
year = {2018}
}
\end{filecontents*}
\documentclass{article}
\usepackage{natbib}
\begin{document}
\citet{smith2020} measured carefully; field work is covered elsewhere
\citep{garcia2018}. See \citet*{garcia2018} for the full author list,
and \citep[see][p.~5]{smith2020} for detail.
\bibliographystyle{plainnat}
\bibliography{refs}
\end{document}The citing commands
\citet{key}→ Smith and Brown (2020): the author as part of the sentence.\citep{key}→ (Smith and Brown, 2020): the whole citation in parentheses.\citep[p.~5]{key}→ (Smith and Brown, 2020, p. 5);\citep[see][]{key}→ (see Smith and Brown, 2020);\citep[see][ch.~2]{key}uses both.\citet*and\citep*: the full author list instead of "et al.".\citealtand\citealp: like\citetand\citepwithout parentheses.\citeauthor{key},\citeyear{key},\citeyearpar{key}: the authors, the year, or the year in parentheses.\citep{a,b}: several works in one parenthesis, separated by semicolons.
Package options
When a class has already loaded natbib, change the style with \setcitestyle{square,comma} instead of loading the package again.
round(default),square,curly,angle: the brackets.semicolon(default) orcomma: the separator between citations.authoryear(default) ornumbers: author-year or numbered citations;superfor superscript numbers.sortandsort&compress: sort several citations, and compress numbers into ranges such as [1–4].longnamesfirst: the full author list the first time each work is cited.
Bibliography styles that work with natbib
Author-year citations need a style that writes author and year information: plainnat, abbrvnat and unsrtnat (bundled with natbib), apalike, and journals' own author-year styles. With a numbered style such as plain, natbib stops with "Bibliography not compatible with author-year citations" and falls back to numbers.
Numbered citations with natbib
natbib is also the usual way to get sorted, compressed numbered citations. With the numbers option, \citet still names the authors: "Smith and Brown [1]".
\begin{filecontents*}[overwrite]{refs.bib}
@article{smith2020,
author = {Smith, Jane and Brown, Paul},
title = {Measuring Things Carefully},
journal = {Journal of Measurement},
year = {2020},
volume = {12},
pages = {1--10}
}
@book{garcia2018,
author = {Garcia, Maria and Chen, Wei and Okafor, Ngozi},
title = {Methods for Field Studies},
publisher = {University Press},
address = {Boston},
year = {2018}
}
\end{filecontents*}
\documentclass{article}
\usepackage[numbers,sort&compress]{natbib}
\begin{document}
Two studies \citep{smith2020,garcia2018}; \citet{smith2020} measured carefully.
\bibliographystyle{unsrtnat}
\bibliography{refs}
\end{document}Common mistakes
\citep[p.~5]{key}with one optional argument is a note after the year; to put text before the citation, give two:\citep[see][]{key}.- For three or more authors
\citetprints "et al.";\citet*prints every name, and thelongnamesfirstoption prints every name at a work's first citation only. - Loading natbib in a class that already loads it (elsarticle, revtex, acmart) with different options gives "Option clash for package natbib". Use
\setcitestyleor the class's options. - Do not combine natbib with biblatex; biblatex has its own
natbib=trueoption for these commands.
In journal templates
- elsarticle loads natbib itself:
\documentclass[authoryear]{elsarticle}with\bibliographystyle{elsarticle-harv}for author-year, the defaultnumberoption withelsarticle-numfor numbers. - revtex loads natbib for numbered citations;
\citepand\citetwork as usual. - acmart loads natbib;
\citestyle{acmauthoryear}switches its citations to author-year. - IEEEtran uses numbered citations with
\cite; natbib's author-year commands do not suit IEEE journals.
Errors you may meet
- Package natbib Error: Bibliography not compatible with author-year citations.natbib wants author-year data, but the bibliography style gives only numbers. Use an author-year style such as plainnat, or load natbib with [numbers].
- LaTeX Warning: Citation `<key>' on page <n> undefinedA \cite key has no entry in the built bibliography: a key typo, a missing \bibliography line, a broken .bib entry, or BibTeX has not run yet.
- LaTeX Error: Option clash for package <name>A package is loaded twice with different options, often because the class or another package loaded it first. Load it once, with all options.
- I found no \bibdata commandBibTeX read the .aux file and found no \bibliography, no \cite or no \bibliographystyle. Add the missing command, or run biber for biblatex.
In Manulyx
Typing \cite{ lists your references by key, author, year and title, and every compile runs BibTeX and the extra passes, so new citations resolve straight away.
Write in Manulyx for free · Journal templates
Related
- BibTeX or biblatex: which to use, and how to set up eachBibTeX uses a journal's .bst style and \bibliography; biblatex uses biber, \addbibresource and \printbibliography. When to choose each.
The examples on this page were compiled with pdfLaTeX and BibTeX to check that they work as shown. LaTeX quick reference · LaTeX errors explained