How to Use BibTeX in LaTeX and Overleaf: The Complete 2026 Guide
Master citing references in LaTeX and Overleaf with BibTeX. Step-by-step guide covering \cite{}, \bibliography{}, .bib file management, and troubleshooting.
Introduction: Why BibTeX is the Standard for Scientific Writing
When writing academic papers, conference submissions, or doctoral dissertations in LaTeX or Overleaf, managing references manually with inline text or basic footnotes quickly becomes unmanageable. Bibliographies must adapt to different journal citation styles (such as APA, IEEE, or Chicago), author names must be consistently sorted, and citations must automatically re-number when text is reorganized.
BibTeX solves this by separating the citation data from the document presentation. Your citations live in an external plaintext file (typically named references.bib), while your .tex file cites sources using unique alphanumeric keys via the \cite{...} command.
In this comprehensive guide, you will learn:
.bib file..bib file to your .tex document.[?]).---
1. Anatomy of a .bib File
A BibTeX database is a plain text file ending in the extension .bib. Each reference in this file begins with an entry type (prefixed by an @ symbol), followed by an opening curly brace {, a unique citation key, and comma-separated field-value pairs.
Here is an example of an article entry citing the foundational Transformer architecture paper:
@article{Vaswani2017,
author = {Vaswani, Ashish and Shazeer, Noam and Parmar, Niki and Uszkoreit, Jakob and Jones, Llion and Gomez, Aidan N and Kaiser, Lukasz and Polosukhin, Illia},
title = {Attention Is All You Need},
journal = {Advances in Neural Information Processing Systems},
volume = {30},
pages = {5998--6008},
year = {2017},
doi = {10.5555/3295222.3295349}
}
Critical Rules for .bib Syntax:
Vaswani2017 above) is the identifier you pass to \cite{Vaswani2017}. Every entry in your .bib file must have a unique key.and, never commas or semicolons. Example: author = {Knuth, Donald E. and Rivest, Ronald L.}.-- (e.g., pages = {101--115}), which compiles to a typographical en-dash in the generated PDF.title = {Deep Learning for {DNA} Sequencing on {NVIDIA} {GPUs}}.---
2. Linking BibTeX to Your .tex Document
To connect your .bib file to your LaTeX manuscript, add two commands where you want the bibliography to appear (usually right before \end{document}):
\documentclass[11pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage{hyperref}\begin{document}
\title{My Research Paper}
\author{Jane Doe}
\maketitle
\section{Introduction}
Transformers have revolutionized artificial intelligence and natural language processing \cite{Vaswani2017}.
\bibliographystyle{plain} % Specifies the bibliography formatting style
\bibliography{references} % Links references.bib (omit the .bib extension)
\end{document}
---
3. Standard Bibliography Styles
The \bibliographystyle{...} command determines how citations look in the text and how references are formatted at the end:
plain[1])ieeetr[1])alpha[Vas17])abbrv[1])natbibVaswani et al. (2017))---
4. Using BibTeX in Overleaf
Overleaf makes BibTeX integration effortless because its cloud servers automatically run all intermediate compilation steps:
.bib file: In your Overleaf project pane on the left, click the New File icon and select Upload, or create a new file named references.bib.references.bib.main.tex, type \cite{. Overleaf will show an auto-complete dropdown of all available citation keys in your project.---
5. The 4-Step Local Compilation Workflow
If you compile your LaTeX documents locally using command-line tools, VS Code (LaTeX Workshop), or TeXstudio, you must run the compiler four times in sequence to resolve all references:
pdflatex main.tex: Scans the document, notes where citations occur, and writes an auxiliary file (main.aux).bibtex main.aux: Reads main.aux and references.bib, formats the cited references, and generates main.bbl.pdflatex main.tex: Reads main.bbl and inserts the formatted bibliography into the PDF.pdflatex main.tex: Re-checks cross-references and updates in-text citation numbers.---
6. Common BibTeX Errors and How to Fix Them
Error 1: Question marks [?] instead of citation numbers
\cite{...} does not match the key in references.bib.pdflatex, then bibtex, then pdflatex twice. Double-check for spelling and case sensitivity in the citation key.Error 2: "I couldn't open file name 'references.bib'"
\bibliography{references} command includes the .bib extension (e.g. \bibliography{references.bib}), or the file is in a different folder.\bibliography{references} without the extension, or specify the relative path: \bibliography{chapters/references}.Error 3: Acronyms losing capitalization in rendered PDF
.bib file: title = {Accelerating {LLM} Inference on {FPGA} Systems}. Use our free BibTeX Case Preserver to automate this across your entire bibliography.Need to generate BibTeX citations right now?
Use our free client-side converters for DOIs, ISBNs, arXiv, and PubMed.