Skip to content

Phase 5e: the LaTeX emitter — the guide compiles into a real book - #16

Merged
NeoVand merged 1 commit into
mainfrom
phase5e-figures
Jul 2, 2026
Merged

Phase 5e: the LaTeX emitter — the guide compiles into a real book#16
NeoVand merged 1 commit into
mainfrom
phase5e-figures

Conversation

@NeoVand

@NeoVand NeoVand commented Jul 2, 2026

Copy link
Copy Markdown
Owner

The milestone

npm run book now walks the same chapterBlocks the app renders and produces a compiling, 61-page PDF of the entire guide — one source of truth, screen and print. This is the payoff the whole block migration was building toward, closed end to end.

What's in it

  • richToTex beside richToHtml — the token AST grew its second serializer: math passes through untouched (it was always LaTeX), prose escapes in a single character-level pass so no rule can mangle another's output, theme spans take the light branch, and the app's Unicode symbols (✓ ✗ ∞ ½ κ γ …) map to robust TeX commands. Five new tests.
  • Every block kind → a print environment. Displays become numbered equations labelled eq:<registry-key> (the registry key is the label, as planned); the honesty notes take the outer margin under an ∞ small-caps tag — the margin channel the plan called the book's intellectual integrity; concept/recipe/proof/frontier share one quiet box; proofs close with a QED rule; the optimizer cards print with year/author/idea/equation/✓✗ lines; the bestiary and further-reading lists come straight from their content modules; and every chapter ends with its live gradientlab.ai deep link.
  • Figures emit labelled placeholders until the compute/render split lands; interactive widgets (race, schedule gallery) point at the app.
  • Toolchain: memoir + unicode-math + tcolorbox under tectonic (self-contained, ~50MB, installed via brew — kaobook isn't in tectonic's bundle, and memoir was the plan's designated fallback). Chapter titles carry math via \texorpdfstring.
  • CI: a book workflow compiles the PDF artifact on every push to main touching content or the emitter — the printed book can never drift from the live guide.

Verified

Compiles locally with zero errors (two overfull-hbox warnings from long URLs — cosmetic); eyeballed the output: numbered chapters and equations, boxes, margin notes, working links. App untouched: 199 tests, svelte-check clean, build green.

What comes next

The figure compute/render split (pure geometry + themed SVG render, print palette, injectable canvas) replaces the placeholders one figure at a time; then the typographic pass (fonts, kaobook vendoring if wanted, QR shortlinks).

🤖 Generated with Claude Code

scripts/emit-latex.ts walks the same chapterBlocks the app renders and
prints book/gradient-lab.tex; tectonic compiles it to a 61-page PDF.
npm run book does both. One source of truth, screen and print — the
whole point of the block migration, now closed end to end.

- rich.ts gains richToTex/escapeTex: math passes through untouched,
  prose escapes in a single character pass (no rule can mangle another
  rule's output), theme spans take the light branch, the app's Unicode
  symbols map to robust TeX commands (5 new serializer tests)
- every block kind maps to a print environment: displays become
  numbered equations labelled eq:<registry-key>, honesty notes take the
  outer margin under an ∞ small-caps tag, concept/recipe/proof/frontier
  share one quiet box style, proofs close with a QED rule, the
  bestiary and further-reading lists come from their content modules,
  and every chapter ends with its live gradientlab.ai deep link
- figures emit labelled placeholders until the compute/render split;
  interactive widgets point at the app (print fallbacks later)
- memoir + unicode-math + tcolorbox under tectonic (kaobook isn't in
  tectonic's bundle; memoir was the plan's designated fallback);
  chapter titles carry math via texorpdfstring
- CI: .github/workflows/book.yml compiles the PDF artifact on every
  push to main that touches content or the emitter

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jul 2, 2026

Copy link
Copy Markdown

Deploying gradient-lab with  Cloudflare Pages  Cloudflare Pages

Latest commit: d20d5f0
Status: ✅  Deploy successful!
Preview URL: https://51ee6fb9.gradient-lab.pages.dev
Branch Preview URL: https://phase5e-figures.gradient-lab.pages.dev

View logs

@NeoVand
NeoVand merged commit 0d83890 into main Jul 2, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant