latexmk locally, a Makefile for project-specific tasks, and CI that compiles the paper on every push so a broken build can never hide until the night before a deadline.
Step 1: latexmk — the Standard Nobody Told You About
latexmk ships with TeX Live and solves the multi-pass problem completely: it runs pdfLaTeX, BibTeX/biber, and cross-reference passes as often as needed, in the right order, until the document is stable.
.latexmkrc file next to the document:
pdflatex by hand and use latexmk. Everything below builds on it.
Step 2: A Makefile for the Project-Specific Parts
latexmk handles compilation; a Makefile handles everything around it — the diff PDF for reviewers, the arXiv bundle, the word count:
make diff answers the reviewer question “what changed since submission?” in one command, and make arxiv produces the upload bundle without a checklist. The $(MAIN).bbl in the arXiv target matters: arXiv compiles your source but does not run BibTeX, so the generated .bbl must ship inside the bundle.
Step 3: CI — Compile on Every Push
With the project in Git, a small GitHub Actions workflow compiles the paper on every push and fails loudly when someone commits a broken reference or a missing figure:- Treat warnings you care about as errors.
latexmkreturns non-zero on errors, but undefined references are only warnings by default — grep the log in CI (grep -q "undefined references" && exit 1) if you want them to fail the build. - Pin your TeX environment. The action above uses a containerized TeX Live; avoid “latest” drift by pinning the action version, so this year’s paper still compiles next year.
Where the Browser Editor Fits
Automation and a cloud editor are not competing choices — they meet in the repository. With GitHub sync the same repo that CI compiles is the project your co-authors edit in the browser: writers who never touch a terminal work in the editor, the Makefile-and-CI machinery runs against every push, and Git remains the single source of truth for both. Connect a repository and try it →Related Guides
- LaTeX Collaboration Best Practices - The conventions that make the Git flow calm
- Bibliography Management - Why those extra passes exist at all
- Common LaTeX Errors - What to do when CI goes red
