Files
ML-Porosity/paper_cg/make_submission.sh
lamlvh 05f822bcb8 Add condensed C&G version, venue survey, loss rationale; declare bank-size ablation
- paper_cg/: self-contained condensed article in the Elsevier CAS template
  (17 pages) and a supplement that inputs paper/sections/ (S-prefixed numbers);
  Elsevier CAS bundle v2.4 vendored for the build; make_submission.sh.
- paper/sections: American spelling, "Why a Gaussian likelihood" paragraph
  (Sec. 4) and a "Loss family" limitation; nix1994meanvariance added.
- docs: venue survey (submission venue Geophysical Prospecting, fallback
  Mathematical Geosciences), loss-ablation plan (dropped, kept as a record),
  lecture rewritten to 12/11, plan/AGENTS/report synced (plan items 47-54).
- Bank-size ablation (exploratory): declaration docs/research/bank-size.md
  hashed before any computation (1a192127...), scripts/49_bank_size.py.
  The run is in progress; no results are included in this commit.

No verdict, threshold or locked protocol changed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-16 03:35:08 +00:00

40 lines
2.2 KiB
Bash
Executable File

#!/usr/bin/env bash
# Build a flat, self-contained submission folder for Computers & Geosciences in
# paper_cg/submission/ (gitignored): editable LaTeX source with the CAS class files,
# refs.bib and main.bbl, figures as separate files named Figure_1..Figure_N in order of
# appearance, the highlights file, the supplement PDF, and a test compile of the flat copy.
# Run from paper_cg/ after building supplement.pdf and main.pdf (see README.md).
set -euo pipefail
cd "$(dirname "$0")"
OUT=submission
rm -rf "$OUT"; mkdir -p "$OUT"
for f in supplement.aux supplement.pdf main.pdf main.bbl; do
[ -f "$f" ] || { echo "missing $f: build the supplement and main first" >&2; exit 1; }
done
cp els-cas-templates/cas-sc.cls els-cas-templates/cas-common.sty \
els-cas-templates/cas-model2-names.bst "$OUT"/
cp -r els-cas-templates/thumbnails "$OUT"/ # icons used by the class for e-mail/ORCID
cp ../paper/refs.bib main.bbl supplement.aux supplement.pdf highlights.txt "$OUT"/
python3 - "$OUT" <<'PY'
import re, shutil, sys
out = sys.argv[1]
s = open('main.tex').read()
figs = re.findall(r'\\includegraphics(?:\[[^\]]*\])?\{([^}]+)\}', s)
for n, f in enumerate(figs, 1):
shutil.copy(f'../paper/figures/{f}', f'{out}/Figure_{n}.pdf')
s = s.replace('{' + f + '}', '{' + f'Figure_{n}.pdf' + '}', 1)
s = s.replace(r'\graphicspath{{../paper/figures/}}', '')
s = s.replace(r'\bibliography{../paper/refs}', r'\bibliography{refs}')
code = '\n'.join(l.split('%')[0] for l in s.splitlines())
assert '../paper' not in code, 'unresolved ../paper path'
open(f'{out}/main.tex', 'w').write(s)
print('\n'.join(f'Figure_{n}.pdf <- {f}' for n, f in enumerate(figs, 1)))
PY
mv "$OUT/main.bbl" "$OUT/main.bbl.orig"
( cd "$OUT" && pdflatex -interaction=nonstopmode main >/dev/null && { bibtex main >/dev/null || true; } \
&& pdflatex -interaction=nonstopmode main >/dev/null && pdflatex -interaction=nonstopmode main >/dev/null )
cmp -s "$OUT/main.bbl" "$OUT/main.bbl.orig" && rm "$OUT/main.bbl.orig" || { echo "bbl differs from the main build" >&2; exit 1; }
if grep -q "undefined" "$OUT/main.log"; then echo "undefined references in the flat copy" >&2; exit 1; fi
rm -f "$OUT"/main.{aux,blg,log,out,abs}
echo "flat copy compiles: $OUT/main.pdf"