#!/usr/bin/env bash
set -euo pipefail
HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
OUT="$HERE/build_atlas"
mkdir -p "$OUT"
cp "$HERE/../witness_atlas/witness_atlas.tex" "$OUT/"
cd "$OUT"
if ! command -v pdflatex >/dev/null 2>&1; then
  echo "pdflatex not found; compile locally in $OUT"
  exit 0
fi
pdflatex -interaction=nonstopmode -halt-on-error -file-line-error witness_atlas.tex
pdflatex -interaction=nonstopmode -halt-on-error -file-line-error witness_atlas.tex
echo "Built in $OUT"
