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 editorCiting 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:
plain-- numbered references, sorted alphabetically by authorabbrv-- like plain, but with abbreviated first namesalpha-- uses labels like [Ein05] instead of numbersunsrt-- numbered in the order they are citedapalike-- author-year format (use with natbib)ieeetr-- IEEE Transactions style
% 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 editorMulti-file Projects
For any non-trivial document, you should keep your bibliography in a separate .bib file. This has several advantages:
- You can reuse the same
.bibfile across multiple papers - You can share your bibliography database with collaborators
- Tools like Google Scholar, Zotero, and Mendeley can export directly to
.bibformat
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
- Use consistent citation keys. A common convention is
authorYear(e.g.,einstein1905) orauthor:year. Pick one scheme and stick with it. - Export from Google Scholar. Search for a paper, click "Cite," then "BibTeX" to get a ready-made entry you can paste into your
.bibfile. - Use a reference manager. Tools like Zotero, Mendeley, and JabRef can manage your library and export to
.bibformat. - Only cited entries appear. BibTeX only includes entries that are actually cited with
\cite. If you want to include an uncited entry, use\nocite{key}or\nocite{*}for all entries. - Watch for encoding issues. Use LaTeX commands for special characters in names (e.g.,
{\"o}for o-umlaut,{\'{e}}for e-acute).