File size: 1,011 Bytes
1c08905
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
"""Rebuild the standalone PDF with pdflatex; no network calls or prior archive."""
from pathlib import Path
import shutil
import subprocess
import sys

root=Path(__file__).resolve().parent
folder=root/'manuscript'
engine=shutil.which('pdflatex')
if not engine:
    raise SystemExit('pdflatex is required to rebuild the PDF, but not to run the research code.')
for _ in range(3):
    result=subprocess.run([engine,'-interaction=nonstopmode','-halt-on-error',
                           'VELORYN_Manuscript.tex'],cwd=folder,
                          stdout=subprocess.PIPE,stderr=subprocess.STDOUT,text=True)
    if result.returncode:
        print(result.stdout,file=sys.stderr)
        raise SystemExit(result.returncode)
log=(folder/'VELORYN_Manuscript.log').read_text(errors='replace')
if 'There were undefined references' in log or 'Overfull \\hbox' in log:
    print('PDF built, but inspect the LaTeX log for unresolved references or line overflow.',file=sys.stderr)
print(folder/'VELORYN_Manuscript.pdf')