from research import *
s=begin(1401,"Prepare the reproducible reader rendering","How will the final equations and tables be preserved in printable files?",{},["C1396–C1397"])
t=json.loads("\"#!/usr/bin/env python3\\n\\\"\\\"\\\"Render the frozen Markdown readers with exact TeX mathematics.\\\"\\\"\\\"\\nfrom pathlib import Path\\nimport argparse, hashlib, json, re, subprocess\\nROOT=Path(__file__).resolve().parent.parent\\nparser=argparse.ArgumentParser()\\nparser.add_argument('kind',choices=['main','technical'])\\nargs=parser.parse_args()\\nstem={'main':'490d_Chronological_Families_Explanation_C1431','technical':'490d_Technical_Companion_C1431'}[args.kind]\\nsource=ROOT/'deliverables'/(stem+'.md')\\nout=ROOT/'deliverables'/(stem+'.pdf')\\nwork=ROOT/'prep'/'render';work.mkdir(exist_ok=True)\\ntext=source.read_text()\\ntitle=text.splitlines()[0].removeprefix('# ')\\ntext='\\\\n'.join(text.splitlines()[1:]).lstrip()\\ntext=re.sub(r'sandbox:/workspace/scratch/1b40da62dcbd/c1132_c1431/',str(ROOT)+'/',text)\\nprepared=work/(args.kind+'.md');prepared.write_text(text)\\nheader=work/'header.tex'\\nheader.write_text(r'\\\\usepackage{etoolbox}'+'\\\\n'+r'\\\\AtBeginEnvironment{longtable}{\\\\small}'+'\\\\n'+r'\\\\emergencystretch=3em'+'\\\\n')\\ncmd=['pandoc',str(prepared),'-f','markdown+tex_math_single_backslash','--standalone','--pdf-engine=xelatex','--toc','--toc-depth=2','-V','mainfont=DejaVu Serif','-V','sansfont=DejaVu Sans','-V','mathfont=Latin Modern Math','-V','monofont=DejaVu Sans Mono','-V','fontsize=10pt','-V','geometry:margin=0.7in','-V','linestretch=1.08','-V','papersize=a4','-M','title='+title,'-M','date=September 28, 2026','--include-in-header='+str(header),'-o',str(out)]\\nresult=subprocess.run(cmd,text=True,capture_output=True)\\nlog=work/(args.kind+'_pandoc.log');log.write_text(result.stdout+result.stderr)\\nif result.returncode:raise SystemExit(result.returncode)\\nprint(json.dumps({'source':str(source),'source_sha256':hashlib.sha256(source.read_bytes()).hexdigest(),'pdf':str(out),'pdf_sha256':hashlib.sha256(out.read_bytes()).hexdigest(),'bytes':out.stat().st_size,'log':str(log)}))\\n\"")
a=artifact("evidence/render_readers.py",t)
finish(s,{'artifact':a,'words':len(t.split())},"The print pipeline uses the frozen Markdown, exact TeX math and the reviewed PNG, with explicit fonts and page settings. It keeps preparation files separate from reader sources.","Render the main explanatory reader.",{'nonempty':len(t)>100,'both_readers':all(x in t for x in ['490d_Chronological_Families_Explanation_C1431','490d_Technical_Companion_C1431'])})
