Track textwidth and textheight from page geometry

This commit is contained in:
gloamxun committed 2026-10-19 13:46:25 +08:00
1 parent ed1da06685
commit 269433abdb
7 files changed
+153 -28

No files matched your search

+4 -6
View File
@@ -6,8 +6,9 @@ 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; inline box geometry (`\fbox`, `\makebox`,
`\raisebox`), `\minipage`, `\vbox`/`\vtop` block approximations;
footnotes/`\thanks`; figure/table `[htbp]` placement approximations; and page
styles (plain/fancy, `\thispagestyle`, fancyhdr headers/footers, `\thepage`).
footnotes/`\thanks`; figure/table `[htbp]` placement approximations; page
styles (plain/fancy, `\thispagestyle`, fancyhdr headers/footers, `\thepage`);
and geometry-aware `\textwidth`/`\textheight` named length registers.
## 1. Unified pagination
@@ -16,11 +17,8 @@ styles (plain/fancy, `\thispagestyle`, fancyhdr headers/footers, `\thepage`).
ordered list of placed items, then use it for both page-break decisions and
final painting. This is the prerequisite for a true deferred float queue.
## 2. Lengths and base font size
## 2. Base font size
- Emit geometry changes into named length registers so `\textwidth`,
`\textheight`, `\linewidth`, and `\columnwidth` track `\geometry` and
paper-size options instead of fixed A4 defaults.
- Thread the `10pt`/`11pt`/`12pt` class option through the parser, line metrics,
headings, and the PDF so the base size changes consistently.
+3 -4
View File
@@ -23,7 +23,8 @@ the source changes; the SVG preview is refreshed per page.
centering, first-line `\parindent` (17pt default, group-scoped, `\setlength`/
`\addtolength`/`\noindent` aware), and `\hfill`/`\hfil` infinite glue.
- Pages: A4/A5/B5/Letter/Legal/Executive, landscape, geometry margins and
text block, automatic pagination, `\newpage`/`\pagebreak`; figures/tables
text block, geometry-aware `\textwidth`/`\textheight`/`\linewidth`/
`\columnwidth` (as live named length registers), automatic pagination, `\newpage`/`\pagebreak`; figures/tables
honor `[htbp]` hints with top/bottom/page/here approximations. Page styles:
default `plain` page numbers, `\pagestyle{empty|plain|fancy}`,
`\thispagestyle`, fancyhdr `\fancyhead`/`\fancyfoot` (L/C/R) and
@@ -53,8 +54,6 @@ See `docs/ROADMAP.md` for concrete implementation plans.
- Notes: footnotes inside captions, floats, or arbitrary boxes are not
collected; the insertion area currently follows the page where the paragraph
ends rather than the exact reference line.
- Lengths: `\textwidth`/`\textheight`/`\linewidth`/`\columnwidth` are fixed
A4-content defaults, not geometry-aware.
- Miscellaneous: `\tableofcontents`/list commands are no-ops; base font-size
class options (10/11/12pt) are parsed but unused; rules are painted with 1x1
images in PDF; a document-level `\renewcommand{\maketitle}` is ignored in
@@ -64,7 +63,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 --offline` (26 tests: 22 compiler
- `cargo fmt --check` passes; `cargo test --offline` (28 tests: 24 compiler
integration tests + 4 server tests) covers the three examples, the arXiv
fixture, floats/newpage, page styles and `\thispagestyle`, SVG/PDF output,
project API, static frontend assets, path traversal, the legacy