LaTeX Generator Roadmap
Custom LaTeX Generator Roadmap
Last updated: 2026-03-10 (status snapshot) Owner: Generator + NowType integration
Companion analysis:
Status legend:
[x]done[ ] _(in progress)_started but incomplete[ ]not started / pending
Goal
Make the Hugo + NowType pipeline behave like a practical LaTeX book/article toolchain:
- predictable pagination
- stable counters and references
- high-quality print/PDF typography
- editable source-of-truth Markdown
Current Baseline (already in flight)
- PDF-style in-page editing mode (single + spread)
- A4 paper mode and print controls
- Book/article mode toggle
- header/footer and ToC UI support
- chapter/part/book scope editing + print flow
Missing Concepts (prioritized)
Phase 0: Core Pagination Correctness (highest priority)
- Replace fixed pixel slicing with explicit break offsets (
computeNowtypePdfPageBreaks()). - Break only at legal points (block boundaries + line-box boundaries).
- Never break inside a line box. (in progress)
- Enforce no-overlap invariant: page
i+1starts exactly at pageiend. - Add widow/orphan guards (minimum lines at top/bottom) with line-cut penalties.
- Keep headings with next block when possible.
- Keep figure/table blocks together where possible.
- Fix list-container overcapture so
ul/olno-break ranges do not absorb following paragraphs. - Allow structurally legal list breaks between items when a whole list will not fit on one page.
Acceptance:
- No repeated lines across adjacent pages.
- No cut titles/headings at page bottom.
- Bullet lists never “own” following non-list paragraphs.
- Bullet-list pages do not collapse into artificial half pages because of false no-break ranges.
- Stable page content under hover/click/scroll.
Phase 1: Counter + Cross-Ref Model
- Unified counter registry:
part,chapter,section,figure,table,equation,footnote. - Configurable numbering schemes:
- equations:
(n)/(chapter.n)/(part.chapter.n)(in progress) - figures/tables by chapter.
- equations:
- Deterministic counter reset rules (chapter/part transitions).
- Multi-pass label resolution for
\label/\ref/\eqref/\pageref. - Forward-reference placeholder + second-pass fixup.
Acceptance:
- Same equation/reference numbers in view mode, PDF mode, and print output.
- No numbering drift when switching chapter/part/book scopes.
Phase 2: Float Placement Engine
- Introduce float classes: inline, top, bottom, page-float, margin-float. (in progress)
- Parse
place/placement/floathints into browser paginator penalties and hard breaks. - Placement policy with penalties (
h/t/b/p-style behavior). (partial:topandpage-floatnow survive into committed compose-root page starts; queue-feasiblebottomfloats can now pull earlier prep breaks and land materially lower in the page; a bounded handoff path can now honor the commontop -> bottom -> page-floatsequence when legal breakpoints exist between those floats; there is still no true global deferred float queue yet.) - Figure/table keep-together + caption keep-with-parent rules (best-effort in paginator/CSS).
- Smart shrink-to-fit policy before defer-to-next-page. (in progress)
- Float queue diagnostics in dev mode. (partial: committed pagination now records float queue outcomes in the smoke API, including honored vs deferred status and simple blocked-by-earlier-float attribution.)
Acceptance:
- Large figures/tables do not split or duplicate across pages.
- Placement remains stable during edits unless content truly changes.
Phase 3: Footnotes, Margin Notes, Citations
- Footnote extraction and per-page placement model. (in progress: pagination
now records per-page note-load diagnostics and penalizes candidate breaks that
would overflow the note lane, and committed note assignments can now spill
onto later pages in screen/print preview. The runtime also now repairs
footnote refs back into the canonical markdown buffer during
nt_changedsync, resolves misparsed livepreviewciteanchors against source footnote definitions, and can render committed footnotes into a real bottom deck in both spread/print page shells and single-page PDF viewport mode; the live editor DOM still lacks native.footnotes, and pagination still does not build line/page breaks jointly with footnote height the way TeX does.) - Margin-note lane with collision avoidance and leader markers. (in progress: the compositor now estimates per-page note load and exposes overflow/fill telemetry in the smoke API, with stable spill-forward note ownership across committed pages, but it still lacks leader markers and true note reflow.)
- Optional full citation expansion in margin mode.
- Citation style layer (numeric/author-year) from one source model.
- Bibliography pass with deterministic sort/order.
Acceptance:
- Margin notes mode does not overlap body text.
- Footnotes and citations match print/PDF output consistently.
Phase 4: Typography + Composition Quality
- Hyphenation dictionaries and soft-hyphen pipeline.
- Better justification strategy (decent badness metric).
- Micro-typography options (protrusion/spacing approximations).
- Better math baseline and display spacing harmonization. (in progress)
- Consistent print font sizing against LaTeX targets. (in progress)
Acceptance:
- Visual rhythm close to LaTeX reference pages for same content.
- Reduced rivers/overfull lines in dense text.
Phase 5: Tables and Multi-Page Structures
- Long-table pagination with repeated headers.
- Keep row integrity (avoid split row fragments).
- Column width balancing per page.
- Better handling for wide tables (scale/rotate/fallback policy). (in progress)
Acceptance:
- Long tables flow over pages without cutoff or duplicated chunks.
Phase 6: Book Semantics + Front/Back Matter
- Recto/verso rules and optional blank-page insertion. (in progress)
- Frontmatter modes: title page, abstract, ToC, LoF, LoT. (in progress)
- Running heads from section/chapter marks.
- Backmatter conventions: bibliography, appendix, index.
Acceptance:
- Book mode follows expected recto/verso + first-page behavior.
Phase 7: Performance and Responsiveness
- Incremental pagination (reflow affected region only).
- Background worker for break scoring where feasible.
- Debounced recomposition in spread mode.
- Instrumentation: pagination time, DOM nodes, repaint hotspots.
Acceptance:
- Spread mode interaction responsiveness close to single-page mode.
Phase 8: Test Harness (must-have regression gate)
- Browser smoke tests:
- click-to-type focus
-
---section/page-break behavior - spread navigation and editing parity (in progress)
- no duplicate figure/table between pages
- equation numbering format correctness
- Snapshot tests for key chapter fixtures.
- Debug overlay toggle for breakpoints and penalties.
Acceptance:
- Regressions are caught before shipping editor changes.
Implementation Notes (architecture constraints)
- Keep Hugo as render authority.
- Keep Markdown as source of truth.
- Keep NowType as editing surface; do not duplicate Hugo render hooks in client JS.
- Reuse existing pipeline entry points:
layouts/partials/preprocess.htmllayouts/_default/_markup/render-passthrough.htmlcdn/custom/toggleMarkdown.jscdn/editor/src/*.js+ rebuild tonowtype.min.js
Immediate Next 3 Tasks
- Finish strict no-line split behavior (hard guarantee, not just scored preference).
- Add smoke checks for duplicate figure/table and equation numbering format.
- Implement spread editing parity validation (edit on either page and verify canonical root sync).
Progress Log
- 2026-03-10: Roadmap created.
- 2026-03-10: Status snapshot added (done/in-progress/pending) against current implementation.
- 2026-03-10: Paginator hardened to avoid raw-pixel fallback breaks; break selection now snaps to legal candidates and avoids inside-line cuts.
- 2026-03-10: Smoke checks added for equation numbering format and cross-page block splits (headings/figures/tables).
- 2026-03-10: Smoke check added for spread edit parity (activate spread side + type into canonical root).
- 2026-03-10: Smoke runner hardened with explicit stage logs and hard timeouts around
firefox.launch,browser.newContext,context.newPage, andbrowser.closeto fail fast in degraded browser-worker conditions. - 2026-03-27: Heading keep-with-next no longer captures an entire
ul/ol; list-following headings now anchor to the firstliso page breaks can still occur between later list items.