#!/usr/bin/env bash # Compile the arXiv fixture into a trustworthy TeX Live reference PDF. # # The checked-in template.pdf is stale (its references.bib snapshots differ # from the checked-in .bib). The fixture also loads cleveref but never uses # \cref, and the current TeX Live cleveref/hyperref socket pair fails; dropping # that unused package makes the reference reproducible without changing any # visible content. lipsum's language hook needs \languagename in this TeX Live. set -euo pipefail root=$(cd "$(dirname "$0")/.." && pwd) source_dir=${1:-"$root/fixtures/arxiv-template"} out=${2:-/tmp/texrra-arxiv-reference} rm -rf "$out" mkdir -p "$out" cp "$source_dir"/template.tex "$source_dir"/references.bib \ "$source_dir"/arxiv.sty "$source_dir"/orcid.pdf "$out"/ sed -i '/\\usepackage{cleveref}/d' "$out/template.tex" cd "$out" for pass in 1 2 3; do pdflatex -interaction=nonstopmode \ '\def\languagename{english}\input{template.tex}' \ >"pass-$pass.log" 2>&1 if [ "$pass" -eq 1 ]; then bibtex template >bibtex.log 2>&1 fi done if grep -q '^!' template.log; then echo "TeX reference still has errors; see $out/template.log" >&2 exit 1 fi echo "$out/template.pdf"