Citing basics

“Knuth (1986) describes how a paragraph is broken into lines” and “how a paragraph is broken into lines is described in detail (Knuth, 1986)” point at the same book, yet the two citations are entirely different grammatical objects. The first is the subject of its sentence; the second is a note parked outside it. That is why LaTeX does not stop at a single \cite: natbib pairs \citet with \citep, biblatex pairs \textcite with \parencite, and the pairing exists because the output has to know which role was meant. This page follows one test from printing a citation mark through page numbers, multiple works, and repairing a citation that came out as [?]: read the sentence aloud and check that it is still a sentence.

How to write \cite{key}: keys, several works, page numbers

\cite{knuth} prints [1] in the text and, in the same stroke, registers that work for the reference list. knuth is the citation key, a short name you choose yourself. The key never appears in the output; what appears is the number or label the list side assigns. Several works go into one command, comma-separated: \cite{knuth,lamport} gives [1, 2]. To attach a note such as a page, use the optional argument — \cite[p.~5]{knuth} prints [1, p. 5]. The ~ is a space that refuses to break, so p. and 5 never end up on different lines.

Plain LaTeX accepts exactly one such note, and its position is fixed: it comes after the reference. A request like “(see Knuth, 1986, p. 94)”, with a lead-in before the name, simply cannot be expressed. natbib and biblatex lift that restriction by taking two optional arguments instead of one — the section on page and chapter locators below. Knowing the limit early is useful: the range of what bare \cite can say is narrower than it first looks.

latex
% \cite prints the mark and registers the work
The algorithm is described in detail~\cite{knuth}.

% several keys in one command, comma separated
Both accounts agree on this point~\cite{knuth,lamport}.

% one optional argument = a note printed after the reference
The rule appears on page 5~\cite[p.~5]{knuth}.

% register a work in the list without printing a mark
\nocite{lamport}

For a work you do not cite in the text but still want listed, use \nocite{key}. No mark is printed; only the registration happens. The special form \nocite{*} includes every entry of the .bib file. It only means something when BibTeX or biber is the one assembling the list, though: a hand-written thebibliography prints every \bibitem you wrote regardless, so adding \nocite{*} there changes nothing. Think of it as the tool for displaying a whole bibliography database, and nothing else.

\citet vs \citep, \textcite vs \parencite: two grammatical roles

One test decides it: is the author’s name doing grammatical work in the sentence? If it is, reach for natbib’s \citet{knuth} (→ Knuth (1986)) or biblatex’s \textcite{knuth} (same output). If it is not, use \citep{knuth} (→ (Knuth, 1986)) or \parencite{knuth} (→ (Knuth 1986)). The biblatex manual states the distinction outright: \textcite exists to sit in the flow of the text, taking the place of the subject, and the manual warns that \autocite belongs only where the citation is not part of the sentence in a grammatical sense. The two families track sentence structure, not visual taste.

latex
% natbib: \citet is textual, \citep is parenthetical
\citet{knuth} describes how a paragraph is broken into lines.
The procedure is described in detail~\citep{knuth}.

% biblatex: same split, different names
\textcite{knuth} describes how a paragraph is broken into lines.
The procedure is described in detail~\parencite{knuth}.

Swap them and the output stops being English. Put \citep where the subject belongs and you get “(Knuth, 1986) describes how a paragraph is broken into lines” — a sentence whose subject is a parenthesis. Use \citet at the end of a clause and you get “the procedure is described in detail Knuth (1986)”, a proper name with nowhere to go. These are surprisingly hard to catch in proofreading, and no journal style checker will flag them, because the mistake is grammatical, not typographic.

Why not let plain \cite decide, then? Because \cite never looks at grammar. In natbib it is merely an alias for the mode: under the authoryear option it is \citet, under numbers it is \citep. What settles it is one word in the preamble, not the shape of your sentence. biblatex’s \cite is blunter still — a bare label with no additions, so style=authoryear prints just Knuth 1986, a form that fits neither the running text nor a parenthesis. The command has no access to your syntax. Only you do, which is exactly why explicit commands for the two roles exist.

It is tempting to file this under “author–year problems”, but the split survives numbering. In natbib’s numeric mode \citet{knuth} prints Knuth [1] while \citep{knuth} prints [1], and biblatex’s \textcite under style=numeric likewise gives Knuth [1]. That is why “write everything with \cite now and switch styles later” is a trap: the moment you switch, every citation that was meant to carry a subject collapses into a bracket, leaving sentences with a hole where the name was. Record the role while writing. It is the only safe order of operations.

Command (natbib)Output (authoryear)Role
\citetKnuth (1986)textual; the name is part of the sentence
\citep(Knuth, 1986)parenthetical; a note outside the sentence
\citeKnuth (1986)alias; \citet under authoryear, \citep under numbers
\citealtKnuth 1986textual without parentheses, for building your own
\citealpKnuth, 1986the parenthetical form with the parentheses stripped
\citeauthorKnuththe author alone, for second and later mentions
\citeyear1986the year alone, after you have typed the name yourself
\citeyearpar(1986)the year in parentheses, to pair with \citeauthor
\citenum1the bare number; never set as a superscript
\citetext(priv. comm.)free text placed in the citation parentheses

\citet and \citep also have starred forms that expand an author list the style would otherwise abbreviate to et al. For a three-author paper, where \citep{jbw} gives (Jones et al., 1990), \citep*{jbw} prints (Jones, Baker, and Williams, 1990). Journals that ask for the full list at first mention are the usual reason to reach for it. Whether the expansion is possible depends on the .bst style carrying the full names; with a style that does not, the star changes nothing and the abbreviated form stands.

biblatex keeps the same two roles and adds commands for where the citation goes. \footcite sends the whole citation into a footnote; \supercite sets the number as a superscript. \autocite is one level more abstract: it becomes \cite, \parencite, \footcite or \supercite according to the value of the autocite package option (plain, inline, footnote, superscript). Write the body with \autocite and you can move a whole document between parenthetical and footnote citation by editing one word in the preamble — but it cannot stand in for \textcite, because a citation that is part of a sentence cannot be mechanically dropped into a footnote. The most charming of the set is \smartcite, which behaves like \footcite in the body and like \parencite inside a footnote: it looks at where it has landed and changes shape.

Command (biblatex)Output (style=authoryear)Role
\textciteKnuth (1986)textual; takes the place of the subject
\parencite(Knuth 1986)parenthetical; square brackets in numeric styles
\citeKnuth 1986the bare label; nothing is added around it
\autocite(Knuth 1986)follows the autocite package option
\footcitefootnote: Knuth 1986.the whole citation goes into a footnote, with a final period
\smartcitefootnote: Knuth 1986.like \footcite in the body, like \parencite inside a footnote
\supercitea superscript number, no bracketsnumeric styles only; pre- and post-notes are discarded
\cite*1986the year alone in author–year styles, the title alone in author–title

Page and chapter locators: [p.~5] and the pre-note [see][p.~94]

natbib and biblatex both take two optional arguments: the first is a pre-note, the second a post-note. \citep[see][p.~94]{knuth} prints (see Knuth, 1986, p. 94), and \citet[chap.~2]{lamport} prints Lamport (1994, chap. 2). Locators other than pages — chapters, sections, figures, lines — go in the post-note exactly the same way. The lead-in that plain \cite could not express becomes available here.

Here is the trap that catches even experienced users. When only one optional argument is given, it is read as the post-note. So writing \citep[e.g.,]{knuth} with a lead-in in mind produces (Knuth, 1986, e.g.,), with the “e.g.,” stranded behind the reference. biblatex behaves identically: \parencite[see]{knuth} gives (Knuth 1986, see). The correct form keeps an empty second argument — \citep[e.g.,][]{knuth}. Two square brackets in a row look like a mistake, but that is the right shape.

biblatex adds a small courtesy here. When the post-note is nothing but a number, it is read as a page number and biblatex supplies the p. itself: \parencite[25]{knuth} gives (Knuth 1986, p. 25). The prefix is not fixed, either — a pagination field on the .bib entry retargets it. With pagination = {verse} the same [17] comes out as v. 17; with section it becomes § 17. For a manuscript dealing with classical works or scores that are not counted in pages, that one field aligns every citation at once.

latex
% one optional argument is always the post-note
\citep[p.~94]{knuth}       % -> (Knuth, 1986, p. 94)

% two optional arguments are pre-note and post-note
\citep[see][p.~94]{knuth}  % -> (see Knuth, 1986, p. 94)

% a pre-note alone still needs the empty second bracket
\citep[e.g.,][]{knuth}     % -> (e.g., Knuth, 1986)
\citep[e.g.,]{knuth}       % -> (Knuth, 1986, e.g.,)  <- wrong

% biblatex reads a bare number as a page and adds "p."
\parencite[25]{knuth}      % -> (Knuth 1986, p. 25)

Citing several works at once, and keeping the numbers tidy

Always hand several works to one command. \citep{knuth,lamport} gives (Knuth, 1986; Lamport, 1994), or [1, 2] in a numeric style. Writing \cite{knuth}\cite{lamport} instead leaves them as [1][2], separate and unsortable: the style cannot tidy what it never saw together. The same holds for textual citations — biblatex’s \textcite{knuth,lamport} prints Knuth (1986) and Lamport (1994), supplying the conjunction, so the sentence stays a sentence.

When each work needs its own page number, use biblatex’s plural forms — the qualified citation lists. \textcites[59]{knuth}[12]{lamport} prints Knuth (1986, p. 59) and Lamport (1994, p. 12), each key carrying its own pre- and post-note. The full set exists: \parencites, \footcites and the rest. natbib has no equivalent, so when the notes differ per work you place \citep[p.~59]{knuth} and \citep[p.~12]{lamport} side by side and write the connecting words yourself.

To keep numeric citations but polish how they look, Donald Arseneau’s cite package is the easy route. Loading \usepackage{cite} alone makes the standard \cite smarter: it sorts the numbers into ascending order and compresses consecutive runs into ranges. If \cite{c,a,b,e} points at entries 2, 3, 4 and 6, the output is [2–4, 6]. Its options are superscript (alias super) for raised numbers, nosort to stop sorting, nocompress to stop range compression, nospace to tighten the gaps, and nobreak to forbid line breaks. natbib and biblatex bring their own sorting and compression, though — natbib has sort and sort&compress options — so with either of them cite is redundant.

Where the number comes from: thebibliography and \bibitem

The number \cite{key} prints comes from the \bibitem carrying the same key. The most basic way to write the list out by hand is the thebibliography environment, in which each \bibitem{key} ... is one reference. They are numbered 1, 2, 3 … in the order they appear, and \cite fetches the matching number. The {99} in \begin{thebibliography}{99} is the widest label argument, and the width of the label column is derived from it: pass {99} for ten or more entries and {9} for nine or fewer. Get it wrong and the numbers fail to line up, leaving the indentation ragged. For a label of your own instead of a number, write \bibitem[KL94]{lamport}; [KL94] becomes the label and \cite{lamport} prints it too.

document.tex
\begin{thebibliography}{99}
\bibitem{knuth}
Donald E. Knuth, \emph{The \TeX book}, Addison-Wesley, 1986.

% an optional argument replaces the automatic number
\bibitem[KL94]{lamport}
Leslie Lamport, \emph{\LaTeX: A Document Preparation System},
2nd ed., Addison-Wesley, 1994.
\end{thebibliography}

A hand-written thebibliography suits two situations: a handful of references, or a layout you want to control down to the comma. Past that, storing bibliographic data in a .bib file as unformatted records and letting BibTeX or biber build the list is faster, more accurate and reusable. Numbering, sorting and styling are automated to match a journal’s rules, and the same .bib can be shared across several manuscripts. What matters here is that nothing changes on the writing side: \cite{knuth} simply looks for a .bib entry instead of a \bibitem, and every command on this page carries over unchanged.

Citations printing as [?]: Citation ... undefined

[?] means that when the page was set, the .aux file held no label for that key. The log shows LaTeX Warning: Citation 'nosuchkey' on page 1 undefined on input line 4. and, at the end of the run, the summary LaTeX Warning: There were undefined references. There are only two causes: too few passes, or a key that does not match.

The pass count works exactly as it does for numbering and cross-references. The first run writes each \bibitem’s number into the .aux file; the second reads it back and drops it into each \cite. With BibTeX or biber in the loop the order is latex → bibtex (or biber) → latex → latex, and skipping the middle step leaves [?] in place. On the key side, besides a plain typo, editing the .bib without re-running BibTeX produces the same symptom. Deleting the .aux and starting over is the quickest way to tell the two apart.

biblatex does not print a question mark; it prints the key itself. \parencite{nosuchkey} comes out as (nosuchkey), and the log carries Package biblatex Warning: The following entry could not be found .... It looks alarming on the page, but since the missing key is written out in the text, tracking down the cause is actually faster.

One more symptom belongs to natbib alone: you use \citet, the output reads (author?) [1], and the log says Package natbib Warning: Author undefined for citation 'knuth'. The fault is not in the citation command but in the .bst style. A style that knows nothing of natbib, such as the one selected by \bibliographystyle{plain}, does not write author-and-year labels into its \bibitem lines. Switching to a natbib-aware style — \bibliographystyle{plainnat}, for instance — fixes it. When \citet seems not to work, suspect the .bst first.

natbib or biblatex: which citation commands to use

Load one of them and only one, all the way through — that is the whole practical answer. The two solve the same problem with different designs, and loading both makes their command names collide. If your target venue ships a class file or style, follow what it asks for first; a great many society classes assume natbib. Where the choice is yours, biblatex is ahead on Unicode handling, multilingual documents, footnote citations and the breadth of discipline-specific styles. natbib has been in use since 1993 and has an enormous stock of matching .bst files, which is why older templates keep choosing it.

Whichever you pick, the order of decisions is the same. First settle whether the citation is part of the sentence and choose \citet/\textcite or \citep/\parencite. Then add a locator through the optional arguments if you need one, and group multiple works with a comma-separated list or a qualified list. Appearance — bracket shape, numeric or author–year, the separators — comes last, and that layer belongs to package options and to the .bst or style file. Write in this order and changing venue only ever costs you the final layer.