BibTeX Bibliography Management in LaTeX

Organize, cite, and format references with BibTeX for professional academic documents.

What is BibTeX?

BibTeX is a reference management system that works alongside LaTeX. Instead of manually formatting citations and bibliographies, you store your references in a separate .bib file and let BibTeX generate a properly formatted bibliography automatically. This approach separates content from formatting -- you can switch between citation styles (APA, IEEE, Chicago, etc.) by changing a single line, and BibTeX handles the rest.

Creating a .bib File

A .bib file is a plain text file containing bibliography entries. Each entry has a type (article, book, etc.), a unique citation key, and a set of fields. Here are the most common entry types:

% Journal article
@article{einstein1905,
    author  = {Albert Einstein},
    title   = {On the Electrodynamics of Moving Bodies},
    journal = {Annalen der Physik},
    volume  = {322},
    number  = {10},
    pages   = {891--921},
    year    = {1905}
}

% Book
@book{knuth1984,
    author    = {Donald E. Knuth},
    title     = {The TeXbook},
    publisher = {Addison-Wesley},
    year      = {1984},
    isbn      = {0-201-13447-0}
}

% Conference paper
@inproceedings{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},
    booktitle = {Advances in Neural Information Processing Systems},
    volume    = {30},
    year      = {2017}
}

Create multi-file projects with separate .bib files in our editor.

Try it in our editor

Citing References

With basic LaTeX, use \cite{key} to insert a citation. The natbib package provides additional commands for author-year citation styles:

% Basic citation (works without any extra package):
Einstein showed that \cite{einstein1905} ...

% With the natbib package:
\usepackage{natbib}

% Parenthetical citation: (Einstein, 1905)
This result is well established \citep{einstein1905}.

% Textual citation: Einstein (1905)
\citet{einstein1905} demonstrated this effect.

% Multiple citations:
Several studies \citep{einstein1905, knuth1984, vaswani2017} ...

% Citation with page number:
\citep[p.~42]{knuth1984}

Bibliography Styles

The bibliography style determines how references are formatted. Common built-in styles include:

% Choose a style (in the preamble or before \bibliography):
\bibliographystyle{plain}

% For author-year style with natbib:
\usepackage{natbib}
\bibliographystyle{apalike}

Adding Bibliography to Your Document

At the end of your document (before \end{document}), add two commands to specify the style and the .bib file:

\documentclass{article}
\usepackage{natbib}

\begin{document}

\section{Introduction}
The transformer architecture \citep{vaswani2017} has
revolutionized natural language processing. Earlier work
by \citet{knuth1984} laid the foundation for modern
typesetting systems.

\bibliographystyle{apalike}
\bibliography{refs}  % loads refs.bib

\end{document}

Note that the \bibliography command takes the filename without the .bib extension. To generate the bibliography, you need to run pdflatex, then bibtex, then pdflatex twice more. Our online editor handles this compilation sequence automatically.

Our editor runs the full pdflatex + bibtex pipeline for you automatically.

Try it in our editor

Multi-file Projects

For any non-trivial document, you should keep your bibliography in a separate .bib file. This has several advantages:

In our editor, you can create multi-file projects. Add a new file called refs.bib and paste your BibTeX entries there, then reference it from your main .tex file with \bibliography{refs}.

Tips for Managing Large Bibliographies