Documentation/References & Citations/How to Create a Bibliography with BibTeX in LaTeX
References & Citations

How to Create a Bibliography with BibTeX in LaTeX

BibTeX is the standard tool for managing references in LaTeX. You store your references in a .bib file and LaTeX automatically formats them according to your chosen style.

Create a .bib File

A .bib file contains your reference entries. Each entry has a type (@article, @book, etc.), a citation key, and fields:

% refs.bib
@article{vaswani2017attention,
  author  = {Vaswani, Ashish and Shazeer, Noam and Parmar, Niki},
  title   = {Attention Is All You Need},
  journal = {Advances in Neural Information Processing Systems},
  year    = {2017},
  volume  = {30}
}

@book{knuth1984texbook,
  author    = {Knuth, Donald E.},
  title     = {The TeXbook},
  publisher = {Addison-Wesley},
  year      = {1984}
}
Output: A .bib file with article and book entries ready to cite.

Cite References in Your Document

Use \cite{key} to insert citations. The key matches the first field in your .bib entry:

\\documentclass{article}
\\begin{document}

Transformers revolutionized NLP \\cite{vaswani2017attention}.
For a deep dive into TeX, see \\cite{knuth1984texbook}.

\\bibliographystyle{plain}
\\bibliography{refs}

\\end{document}
Output: Citations appear as [1], [2] and a formatted reference list is generated at the end.

Common Bibliography Styles

Change the style with \bibliographystyle{}:

\\bibliographystyle{plain}    % numbered [1], sorted alphabetically
\\bibliographystyle{unsrt}    % numbered [1], in order of citation
\\bibliographystyle{abbrv}    % numbered, abbreviated names
\\bibliographystyle{alpha}    % labels like [Vas17]
\\bibliographystyle{apalike}  % author-year (Smith, 2020)

Compile with BibTeX

BibTeX requires multiple compilation passes:

% Run in this order:
% pdflatex main.tex    (1st pass — finds \\cite commands)
% bibtex main          (processes .bib and generates .bbl)
% pdflatex main.tex    (2nd pass — inserts citations)
% pdflatex main.tex    (3rd pass — resolves cross-references)
Output: All citations resolve correctly and the bibliography appears.

💡 Tips

  • Use Google Scholar's 'Cite' button to export BibTeX entries directly
  • For author-year citations like (Smith, 2020), use the natbib package
  • biblatex + biber is a more modern alternative with greater customization
  • Keep one master .bib file for all your projects

Try This in Bibby AI

Write LaTeX faster with AI auto-complete and instant compilation.

Start Writing Free

Related Tutorials

How to Create a Bibliography with BibTeX in LaTeX | Bibby AI | Bibby AI