Generate table of contents and figure/table lists

This commit is contained in:
gloamxun committed 2026-10-19 14:01:35 +08:00
1 parent 477e2124c8
commit 4aa1714923
11 files changed
+353 -29

No files matched your search

+6 -5
View File
@@ -25,13 +25,14 @@ and geometry-aware `\textwidth`/`\textheight` named length registers.
tables, block boxes, footnotes, and the default `\parindent` (15pt for
10/12pt, 17pt for 11pt).
## 3. Table of contents and lists
## 3. Table of contents and lists (implemented)
- Record section/figure/table entries while parsing, then generate
`\tableofcontents`, `\listoffigures`, and `\listoftables` blocks with
resolved page numbers after pagination.
- Parser placeholders are expanded after parsing into headings plus entries
from numbered sections and captions; entry runs carry a `TocPage` reference
that is resolved by re-laying out once page numbers are known. Dotted
leaders are not implemented.
## 4. PDF painting and title blocks
## 4. PDF painting and title blocks (remaining)
- Paint rules and frames as native PDF rectangles (`printpdf` operators)
instead of 1x1 image XObjects.
+12 -7
View File
@@ -32,6 +32,12 @@ the source changes; the SVG preview is refreshed per page.
resolved at paint time.
- Notes: `\footnote{...}` page-bottom insertion area with separator rule,
superscript markers, and title/author `\thanks`.
- Contents: `\tableofcontents`, `\listoffigures`, and `\listoftables`
generate headings plus entries from numbered sections and captioned
figures/tables; page numbers are resolved after pagination.
- Class sizes: 10pt/11pt/12pt set the body size and propagate through
headings, title material, lists, tables, block boxes, footnotes, and the
default paragraph indent (10/12pt use 15pt; 11pt uses 17pt).
- Classes/packages: built-in classes, local `.cls`/`.sty`, paper options,
`\DeclareOption`/`\ProcessOptions`/`\ExecuteOptions`/option passing.
- Compatibility: spacing macros (quad/qquad/thin/en/med/thick, `\vspace*`,
@@ -54,18 +60,17 @@ 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.
- Class sizes: 10pt/11pt/12pt set the body size and propagate through
headings, title material, lists, tables, block boxes, footnotes, and the
default paragraph indent (10/12pt use 15pt; 11pt uses 17pt).
- Miscellaneous: \tableofcontents/list commands are no-ops; rules are
painted with 1x1 images in PDF; a document-level \renewcommand{\maketitle}
is ignored in favor of the engine title block.
- Contents: entries use infinite glue instead of dotted leaders and only
numbered headings plus captions are listed; per-chapter contents in
book/report are not distinguished.
- Miscellaneous: rules are painted with 1x1 images in PDF; a document-level
\renewcommand{\maketitle} is ignored in favor of the engine title block.
## Verification
- `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` (28 tests: 24 compiler
- `cargo fmt --check` passes; `cargo test --offline` (32 tests: 28 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