How to Add Citations and References in LaTeX with BibTeX
To add citations in LaTeX, store your references in a .bib file, cite them in your text with \cite{key}, and print the bibliography with \bibliography{yourfile}. BibTeX then formats and orders your entire reference list automatically. You can do all of this — including the extra compile passes — without any local setup in LetX.
Managing references by hand is a nightmare: renumbering, reformatting, and matching styles wastes hours. BibTeX solves this completely. Write each reference once, cite it anywhere, and let LaTeX handle the rest.
1. Create a .bib File
Make a file called references.bib and add entries. Each entry has a type, a citation key, and fields:
@article{smith2025,
author = {Smith, Jane and Doe, John},
title = {A Study of Everything},
journal = {Journal of Important Results},
year = {2025},
volume = {12},
pages = {45--67}
}
@book{knuth1984,
author = {Knuth, Donald E.},
title = {The TeXbook},
publisher = {Addison-Wesley},
year = {1984}
}The key (smith2025) is how you'll refer to each source in your document.
2. Cite in Your Text
Reference any entry by its key:
The results were significant \cite{smith2025}.
This builds on foundational work \cite{knuth1984, smith2025}.3. Print the Bibliography
At the end of your document, choose a style and point to your .bib file:
\bibliographystyle{plain} % or 'ieeetr', 'apalike', 'unsrt'
\bibliography{references}BibTeX generates a formatted, correctly ordered reference list — and renumbers everything if you add or remove a citation.
BibTeX requires multiple passes: LaTeX → BibTeX → LaTeX → LaTeX. Miss a pass and you'll see [?] where citation numbers should be. Editors like LetX run the full sequence automatically, so your citations always resolve.
Using natbib for Author-Year Styles
For author-year citations like (Smith, 2025), load natbib:
\usepackage{natbib}
% ...
\citet{smith2025} % Smith (2025)
\citep{smith2025} % (Smith, 2025)
\bibliographystyle{plainnat}
\bibliography{references}The Modern Approach: BibLaTeX
biblatex with the biber backend is the modern, more flexible option, with better Unicode support and easier customization:
\usepackage[style=authoryear, backend=biber]{biblatex}
\addbibresource{references.bib}
% ...
\cite{smith2025}
% at the end:
\printbibliographyCommon Citation Problems
- Citations show as
[?]— you missed a BibTeX/biber pass, or the key is misspelled. Undefined control sequence— you used anatbibcommand like\citetwithout loadingnatbib.- References not appearing — make sure the entry is actually cited, or use
\nocite{*}to include everything.
Getting the BibTeX pipeline right locally is fiddly. In LetX the compile chain is automatic — you just cite and your bibliography appears.
Get It Working in Seconds
Citations are one of LaTeX's biggest advantages over word processors — once they're set up, they maintain themselves. The fastest way to see it working is a preconfigured cloud editor.
Try BibTeX citations for free at LetX.app.