"""Mechanical sanity check on report.tex. There is no LaTeX engine on this machine, so this catches the errors a compile would have caught: dangling \\ref, missing \\input or figure files, unbalanced braces or environments, and unclosed inline math. python report/check_tex.py """ import re import sys from collections import Counter from pathlib import Path HERE = Path(__file__).resolve().parent def main(): src = (HERE / 'report.tex').read_text(encoding='utf-8') # strip comments, so commented-out examples don't trip the checks body = '\n'.join(re.sub(r'(?