File size: 1,730 Bytes
872cf4d | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 | #!/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"
|