Compile LaTeX with a Bibliography

The correct command sequence for resolved references.

2020

latexmk -c main.tex; pdflatex main.tex; bibtex main; pdflatex main.tex;
  1. latexmk -c main.tex cleans the directory.
  2. pdflatex main.tex generates auxiliary files and figures out what bib entries it needs.
  3. bibtex main compiles the bibliography.
  4. pdflatex main.tex generates the final PDF.

View gist

Charles Lovering © 2026