#!/usr/bin/env bash
set -euo pipefail
HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
OUT="$HERE/build_sft2"
mkdir -p "$OUT"
cp "$HERE/../sft2/sft2_syncre_stability_modulus.tex" "$OUT/"
cp "$HERE/../sft2/sft2_bibliography.bib" "$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 sft2_syncre_stability_modulus.tex || true
if command -v bibtex >/dev/null 2>&1; then
  bibtex sft2_syncre_stability_modulus || true
fi
pdflatex -interaction=nonstopmode sft2_syncre_stability_modulus.tex || true
pdflatex -interaction=nonstopmode sft2_syncre_stability_modulus.tex || true
echo "Built in $OUT"
