Add minipage and vbox block boxes

This commit is contained in:
gloamxun committed 2026-10-19 13:05:43 +08:00
1 parent 2552008d4b
commit 5fa301fdcd
7 files changed
+116 -20

No files matched your search

+7 -11
View File
@@ -4,15 +4,11 @@ This file lists the concrete implementation plans for the foundational items tha
are still missing. Each item names the files/functions to touch.
Completed: paragraph indentation (`\parindent`) and `\hfill`/`\hfil`; sans
family and true scaled small caps (see `docs/STATUS.md`).
family and true scaled small caps; inline box geometry (`\fbox`, `\makebox`,
`\raisebox`), `\minipage`, and `\vbox`/`\vtop` block approximations (see
`docs/STATUS.md`).
## 1. `\minipage` and VBox
- Reuse the block `FramedBox` measurement with an explicit width and vertical
stacking; add `\begin{minipage}{width}` environment parsing.
- Add VBox material for `\vbox`/`\vtop` and nested vertical lists.
## 2. Footnotes
## 1. Footnotes
- Parser: capture `\footnote{...}`/`\thanks{...}` into a per-paragraph list
with a number marker run (superscript approximation via smaller raised text
@@ -21,7 +17,7 @@ family and true scaled small caps (see `docs/STATUS.md`).
text height and place footnotes with a separator rule at the bottom.
- Paint footnotes as normal positioned lines after the page's content.
## 3. Floats
## 2. Floats
- Classify figure/table blocks as floats with `[htbp]` placement hints.
- Planner: maintain pending floats and try top/bottom/page placements; keep
@@ -29,13 +25,13 @@ family and true scaled small caps (see `docs/STATUS.md`).
- Renderer: place deferred floats at the saved slots; page keys must include
float placement decisions.
## 4. Page styles / headers-footers
## 3. Page styles / headers-footers
- `DocumentModel` fields for header/footer runs and `\pagestyle`/`\thispagestyle`.
- Paint headers/footers in the page margins in both PDF and SVG; page numbers
need a page index placeholder resolved at paint time.
## 5. Unified pagination
## 4. Unified pagination
- Extract the current duplicated planner (`build_page_break_plan`) and renderer
(`build_positioned_pages`) vertical logic into one page builder returning an
+6 -4
View File
@@ -13,8 +13,9 @@ the source changes; the SVG preview is refreshed per page.
- Headings: numbered `\section`/`\subsection`/`\subsubsection` and starred
`\section*` variants (starred headings do not advance the counter).
- Box material: `\rule` (raise/width/height), inline framed `\fbox`, block
`\parbox`, inline `\mbox`, `\makebox[width][align]`, `\raisebox`, `center`,
`\hrule` with `width`/`height`.
`\parbox`/`\minipage`, `\vbox`/`\vtop` (full-width block approximation),
inline `\mbox`, `\makebox[width][align]`, `\raisebox`, `center`, `\hrule`
with `width`/`height`.
- Fonts: Liberation Serif/Sans/Mono faces, bold/italic/monospace/sans
declarations with group scoping, grouped text-style commands, true small caps
(lowercase uppercase glyphs at 80% size), and sans/serif/mono small caps.
@@ -37,7 +38,8 @@ See `docs/ROADMAP.md` for concrete implementation plans.
## Known approximations / gaps
- Boxes: `\parbox` is block-level; `\minipage` and VBox material are missing.
- Boxes: `\parbox`/`\minipage` are block-level; `\vbox`/`\vtop` map to a
full-width block rather than true nested VBox material.
- Pages: no footnote insertion area, no floats, no headers/footers (fancyhdr
commands are accepted as no-ops), planner and renderer are separate.
- Lengths: `\textwidth`/`\textheight`/`\linewidth`/`\columnwidth` are fixed
@@ -50,7 +52,7 @@ See `docs/ROADMAP.md` for concrete implementation plans.
- `examples/hello.tex`, `examples/boxes.tex`, `examples/compat.tex` compile to
one A4 page each; the arXiv template project compiles to 3 Letter pages.
- `cargo fmt --check` passes; `cargo test --workspace` (20 tests) covers the three
- `cargo fmt --check` passes; `cargo test --workspace` (21 tests) covers the three
examples, the arXiv fixture, SVG/PDF output, project API, static frontend
assets, path traversal, the legacy `/texrra` endpoint, and page-hash cache
stability.