#!/usr/bin/env bash # Build report.pdf. Regenerates figures and tables first so the document can # never disagree with the raw results, then compiles with whichever LaTeX # engine is available. # # bash report/build.sh # # Requires: the project's Python env (for figures/tables) and a LaTeX # distribution. If no engine is found the script says what to install and # exits non-zero — the .tex, figures and tables are still produced. set -euo pipefail cd "$(dirname "$0")/.." PY="${PYTHON:-python}" # echo "== regenerating figures ==" # "$PY" report/make_figures.py # echo "== regenerating tables ==" # "$PY" report/make_tables.py # echo "== compiling ==" cd report if command -v latexmk >/dev/null 2>&1; then latexmk -pdf -interaction=nonstopmode report.tex latexmk -c elif command -v tectonic >/dev/null 2>&1; then tectonic report.tex elif command -v pdflatex >/dev/null 2>&1; then # twice, so \ref and the table of contents resolve pdflatex -interaction=nonstopmode report.tex pdflatex -interaction=nonstopmode report.tex else cat <<'EOF' No LaTeX engine found (looked for latexmk, tectonic, pdflatex). Figures (report/figures/*.pdf) and tables (report/tables/*.tex) were still regenerated, so report.tex is ready to compile anywhere. To build the PDF: Windows winget install MiKTeX.MiKTeX macOS brew install --cask mactex-no-gui Debian sudo apt install texlive-latex-recommended texlive-fonts-recommended Anywhere cargo install tectonic (single binary, fetches packages itself) Or upload report/ to Overleaf and compile there — it is self-contained. EOF exit 1 fi echo echo "wrote report/report.pdf"