# Typst conversion fix guide (for sub-agents) You are repairing an automatically converted arXiv physics paper so that it compiles to a clean, idiomatic Typst document. Paper directory: `E:\phys\papers\\` with `main.typ`, `refs.bib`, `imgs/`, `src/` (original LaTeX), `figures/` (extracted TikZ). ## Deterministic first Before editing by hand, run the whole non-LLM repair chain and read what is left: ``` python -X utf8 E:/phys/scripts/drive.py papers/ # from E:\phys ``` It runs `latexblock → bibfix → keyfix → citefix → holes → bibclean → figtext → scaffold → spacekey → figwire → bibmerge → citeclose`, then compiles and prints the remaining `error:` lines. Every stage is idempotent and none of them delete document content, so re-running after a manual fix is always safe. Never run it on a paper another agent is still editing. ## Loop 1. `typst compile E:\phys\papers\\main.typ E:\phys\papers\\build\main.pdf` (run from the paper dir). 2. Read every reported error, open `main.typ` at the reported line, fix the root cause. 3. Repeat until the compiler reports **zero errors** and the PDF is > 20 KB and has a plausible page count (roughly `chars/3000`). ## Rules - Work on ONE paper per agent, and `cp main.typ main.typ.` before the first edit. - Errors that look far from their cause are almost always an unclosed `$`: scan per-line dollar parity instead of trusting the reported line number. - `#figure(...)` accepts a SINGLE positional argument. Several panels go in a content block — `#figure([\n#image("a.png")\n#image("b.png")\n], caption: […])` — not in `stack(dir: tt)` / `grid(...)`, which either fail or collide with pandoc's own `grid` helper. - A `