Files
texrra-engine/docs/ROADMAP.md
T

109 lines
5.7 KiB
Markdown

# Roadmap: remaining structural work
This file lists the concrete implementation plans for the foundational items that
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; page
styles (plain/fancy, `\thispagestyle`, fancyhdr headers/footers, `\thepage`);
geometry-aware `\textwidth`/`\textheight` named length registers; table of
contents and figure/table lists with dotted leaders; native PDF rectangles; unified pagination;
`\centering`/`\raggedright`/`\raggedleft` declarations and environments;
chapter headings with chapter-prefixed section numbering and page breaks;
deferred top-float queue for figures; document-level custom `\maketitle`;
abstract quotation formatting, unnumbered `\paragraph` headings, natbib-style
author-year citations and plainnat bibliography formatting with duplicate-year
`2014a`/`2014b` suffixes; hyperref-style green `\href`/`\url`/citation text;
`\vbox`/`\vtop` vertical-material capture with inline splicing
(`build_positioned_pages` is the only page builder and no separate break
planner remains); embedded Liberation fonts (no Base-14 dependency on the
reader) and natural-width centered table layout with preview/PDF coordinate
parity; `\multicolumn` column spans with alignment and partial
`\cmidrule(r){a-b}`/`\cline{a-b}` rules; footnote capture in figure/table
captions with the insertion area reserved on the caption page.
## 1. Float tuning and table queue
- Figures with `[t]` are queued and placed at the top of the next page while
following text fills the current page. Tables with `[t]` queue their caption
and rows the same way, and `[b]` pushes them to the page bottom. Remaining
work: queue table float-page placements, tune
`\textfraction`/`\topfraction`, and support more than a one-page lookahead.
## 2. Class title blocks (implemented for arXiv-style preprints)
- A document-level `\renewcommand{\maketitle}` works, and loading `arxiv.sty`
switches to a native preprint title block: title rules, small-caps title,
`\undertitle`, two-column author/affiliation blocks, long date, and an empty
first page style. Loading `sn-jnl` selects a structured journal title block
with numbered authors, affiliations, e-mail, abstract, and keywords.
Remaining work: two-column body layout (`iicol`), exact journal title
spacing, and class-specific author grids.
## 3. True vertical boxes (partial)
- `\vbox`/`\vtop` now capture nested vertical material (rules, skips,
paragraphs) and splice it into the surrounding column. A fully independent
VBox still needs its own natural width, baseline, and nested line/box
children in the positioned renderer.
## 4. Remaining arXiv alignment work
These are the three items still visible when the arXiv fixture is compared with
the XeLaTeX/Overleaf reference.
### PDF link annotations
`printpdf 0.3.4` has no annotation API. The implementation path is to vendor
`printpdf`, add a `LinkAnnotation { rect, url }` list to `PdfPage`, and write
`/Annots` arrays plus `/Type /Annot`, `/Subtype /Link`, `/A << /S /URI /URI (...) >>`
dictionaries when `PdfDocument::save` builds each page object. On the engine
side, `Run`/`LineItem::Glyph`/`PositionedSpan` need a `link_url: Option<String>`
in addition to the existing `link: bool`; `PositionedPages::render` can then
collect absolute rectangles (page index, x, y, width, height) and hand them to
the printpdf writer.
### ORCID author icon
Completed: `\orcidlink` and ORCID author URLs use the bundled official logo
`assets/orcid-logo.png` (rasterized from the template's `orcid.pdf`), embedded
at 2.2 mm before the author name. SVG preview keeps the rounded `rect` shape.
The PDF badge is positioned by `PositionedPageItem::Badge` and carries its
`/Link` annotation. No remaining template-specific icon path is needed.
### First-page paragraph break
Done: the paragraph now places against the full body goal and the title-note reserve is applied after it; `arxiv_fixture_is_three_letter_pages` asserts that page 1 contains the closing `See` line and keeps a 3 mm gap above the footnote.
- Fonts: pyftsubset bundles with retained glyph ids and filtered kern table bring the arXiv PDF to about 0.50 MB; exact per-document glyph subsetting remains a follow-up; font programs are Flate-compressed in the PDF and the unused FOGRA39 output intent is skipped.
## Two-column body builder (next)
The first attempt at `iicol` handled paragraphs and lists only. It reduced the
SIVP PDF from 17 to 15 pages, but was reverted because:
- display math, tables, figures, and bibliography blocks still assumed the full
text width and painted across both columns;
- the list line loop and the following paragraph could target the same column
cursor, producing overprinted text at the bottom of a column;
- switching columns inside one block was not coordinated with float placement
or footnote reserves.
The correct unit is a page-level column builder shared by every block arm:
1. Represent the body cursor as `(page, column, y)` with `column_width` and
`column_x`.
2. Give every positioned block a `span` (one column or full width). Full-width
blocks force both columns to close before placement.
3. Measure text, lists, display math, tables, and bibliography entries against
`column_width`; offset every emitted item by `column_x`.
4. Advance to the next column at the column goal, then start a new page after
the last column.
5. Keep footnote reserves and floats per column/page, not per document.
Do not re-enable the partial paragraph/list column code until all block arms
share this cursor.