Citing References in LaTeX

Citing references in LaTeX takes three parts: a .bib file with your sources, \cite{key} in the text, and \bibliography{file} where the list should go. Compile with LaTeX, then BibTeX, then LaTeX twice more.

example.tex
\documentclass{article}
\begin{filecontents*}[overwrite]{refs.bib}
@book{knuth1984,
  author    = {Donald E. Knuth},
  title     = {The {\TeX}book},
  publisher = {Addison-Wesley},
  year      = {1984}
}
@book{lamport1986,
  author    = {Leslie Lamport},
  title     = {{\LaTeX}: A Document Preparation System},
  publisher = {Addison-Wesley},
  year      = {1986}
}
\end{filecontents*}
\begin{document}
\TeX{} is described in \cite{knuth1984}, and \LaTeX{} in \cite{lamport1986}.
\bibliographystyle{plain}
\bibliography{refs}
\end{document}
Page 1A page citing two books as [1] and [2], followed by a References list with Knuth, The TeXbook, and Lamport, LaTeX: A Document Preparation System.

filecontents* writes refs.bib from inside the document so the example is one file. In your project, keep refs.bib as its own file and leave this part out.

What goes in the .bib file?

One entry per source: a type such as @article or @book, a key you choose (knuth1984), and fields like author, title and year. Put names as Last, First and Last, First, and wrap words that must keep their capitals in braces: {LaTeX}. You rarely type entries by hand: the DOI to BibTeX tool builds them from a DOI, and the RIS to BibTeX converter turns exports from EndNote or Mendeley into a .bib file.

Why do my citations show as [?] or ??

BibTeX hasn't run yet, or ran before LaTeX had seen the citations. The log says Citation `knuth1984' on page 1 undefined. Run LaTeX, BibTeX, LaTeX, LaTeX in that order; Overleaf and latexmk do this for you. Check also that the key in \cite matches the .bib exactly, including case.

What is the difference between \cite, \citep and \citet?

\cite is the standard command and prints whatever the style gives, such as [1]. \citep and \citet come from natbib for author-year styles: \citet is for the sentence, "Knuth (1984)", and \citep for the parenthesis, "(Knuth, 1984)".

example.tex
\documentclass{article}
\begin{filecontents*}[overwrite]{refs.bib}
@book{knuth1984,
  author    = {Donald E. Knuth},
  title     = {The {\TeX}book},
  publisher = {Addison-Wesley},
  year      = {1984}
}
\end{filecontents*}
\usepackage{natbib}
\begin{document}
\citet{knuth1984} wrote the manual \citep{knuth1984}.
\bibliographystyle{plainnat}
\bibliography{refs}
\end{document}
Page 1A page with the sentence Knuth (1984) wrote the manual (Knuth, 1984), followed by the reference list.

Should you use BibTeX or biblatex?

Use what your journal's template uses; many still ship a BibTeX .bst style. For your own documents, biblatex with the biber program handles Unicode names, sorting and styles more easily. There, \addbibresource{refs.bib} goes in the preamble, \textcite and \parencite replace \citet and \citep, and \printbibliography prints the list.

example.tex
\documentclass{article}
\begin{filecontents*}[overwrite]{refs.bib}
@book{knuth1984,
  author    = {Donald E. Knuth},
  title     = {The {\TeX}book},
  publisher = {Addison-Wesley},
  year      = {1984}
}
\end{filecontents*}
\usepackage[style=authoryear]{biblatex}
\addbibresource{refs.bib}
\begin{document}
\textcite{knuth1984} wrote the manual \parencite{knuth1984}.
\printbibliography
\end{document}
Page 1A page using biblatex with an author-year citation and the reference list printed by printbibliography.

How do you change the citation style?

With BibTeX, change \bibliographystyle{…}: plain numbers and sorts by author, unsrt keeps the order of citation, plainnat works with natbib, and IEEEtran gives IEEE style. With biblatex, set style= when loading the package; APA 7 needs style=apa from the biblatex-apa package.

How do you list sources you didn't cite?

Only cited entries are printed. Add \nocite{key} for one more entry, or \nocite{*} for every entry in the .bib file. For a reference list in Word instead of LaTeX, the BibTeX to APA converter formats the same .bib entries. To link each citation to its entry, load hyperref. Journals often leave the reference list out of the word limit; count the rest with the word counter.

Text drafted with AI from the cited documentation; every example compiled with TeX Live 2026, BibTeX and Biber; checked by Cem Demir. See the editorial policy.