LaTeX Bibliography and Citations

One of LaTeX's most powerful features is automatic bibliography management. Write \cite{key} anywhere in your document and LaTeX builds the complete References section automatically — sorted, numbered, and formatted to any style you choose.

How BibTeX Works

The workflow involves two files: your main .tex document and a .bib database file containing all your references.

  1. 1
    Create a .bib file

    Add all your references as BibTeX entries. Each entry has a type (@article, @book, etc.), a citation key, and fields like author, title, year.

  2. 2
    Cite in your document

    Use \cite{key} at the point in your text where you want to reference a source.

  3. 3
    Tell LaTeX where the bibliography goes

    Add \bibliography{filename} (without .bib extension) and \bibliographystyle{stylename} at the end of your document.

  4. 4
    Compile twice

    Run compile → BibTeX → compile → compile. LaTeX needs multiple passes to resolve all references correctly.

Skozin note: The online editor handles multiple compilation passes automatically. Simply press compile and all citations resolve correctly.

The .bib File Format

% references.bib

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

% Conference paper
@inproceedings{lecun1989,
  author    = {LeCun, Yann and others},
  title     = {Backpropagation Applied to Handwritten Zip Code Recognition},
  booktitle = {Neural Computation},
  year      = {1989},
  pages     = {541--551}
}

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

% Website
@misc{latexproject,
  author       = {{The LaTeX Project}},
  title        = {LaTeX -- A document preparation system},
  howpublished = {\url{https://www.latex-project.org}},
  year         = {2024},
  note         = {Accessed: 2024-01-15}
}

% Thesis
@phdthesis{turing1936,
  author = {Turing, Alan},
  title  = {On Computable Numbers},
  school = {University of Cambridge},
  year   = {1936}
}

Entry Types Reference

Entry typeUse for
@articleJournal or magazine article
@bookPublished book with a publisher
@inproceedingsPaper in conference proceedings
@phdthesis / @mastersthesisDoctoral or masters thesis
@techreportTechnical report from an institution
@miscAnything that doesn't fit other types (websites, datasets)
@incollectionChapter in an edited book
@proceedingsThe whole conference proceedings volume

Citing in Your Document

% Single citation
As Einstein showed \cite{einstein1905}, energy and mass are equivalent.

% Multiple citations
Several studies \cite{lecun1989, knuth1984} support this claim.

% Citation with page number
This was later formalised \cite[p.~45]{knuth1984}.

% At end of document:
\bibliographystyle{plain}     % or: ieeetr, apalike, unsrt, alpha
\bibliography{references}     % references.bib (no extension)
StyleOutput format
plain[1] numbered, sorted alphabetically by author
unsrt[1] numbered, sorted by order of appearance
alpha[Ein05] abbreviated author+year key
apalike(Einstein, 1905) author-year format
ieeetr[1] IEEE style, sorted by appearance

Modern Alternative: biblatex

biblatex is a more modern and flexible bibliography system. It supports more entry types, better Unicode handling, and a wider range of citation styles out of the box.

% Preamble:
\usepackage[style=authoryear, backend=biber]{biblatex}
\addbibresource{references.bib}

% In document body:
\cite{einstein1905}
\textcite{knuth1984}      % "Knuth (1984) states that..."
\parencite{lecun1989}     % "(LeCun et al., 1989)"

% Where bibliography should appear:
\printbibliography

Manage your citations in the editor

Create a references.bib file alongside your document and compile — Skozin handles all BibTeX passes automatically.

Start Writing

Continue Learning