Match the reference table width for math cells

This commit is contained in:
gloamxun committed 2026-10-19 18:41:47 +08:00
1 parent 0c615c8e82
commit 247893282b
4 files changed
+14 -2

No files matched your search

+2 -1
View File
@@ -376,7 +376,8 @@ by the current PDF dependency. `tabular` rows use natural column widths
paragraph (`p{...}`) columns are supported. `\multicolumn{n}{align}{...}` paragraph (`p{...}`) columns are supported. `\multicolumn{n}{align}{...}`
spans columns, `\cmidrule(r){a-b}` and `\cline{a-b}` draw partial rules over spans columns, `\cmidrule(r){a-b}` and `\cline{a-b}` draw partial rules over
a column range, and spanning cells distribute their width over the covered a column range, and spanning cells distribute their width over the covered
natural columns. Multi-page table headers are not implemented. Figures honor `[htbp]` natural columns; the resulting width matches the reference XeLaTeX output.
Multi-page table headers are not implemented. Figures honor `[htbp]`
placement hints (`[t]` is deferred to the top of the next page, `[b]` to the placement hints (`[t]` is deferred to the top of the next page, `[b]` to the
page bottom, `[p]` to a float page, `[h]` stays in the flow); tables honor page bottom, `[p]` to a float page, `[h]` stays in the flow); tables honor
`[t]` by deferring the caption and rows to the next page, `[b]` at the page `[t]` by deferring the caption and rows to the next page, `[b]` at the page
+3
View File
@@ -67,6 +67,9 @@ the source changes; the SVG preview is refreshed per page.
metadata, `\paragraph` run-in headings, citations/references, tables/lists/images. metadata, `\paragraph` run-in headings, citations/references, tables/lists/images.
- Tables: natural column widths, centered tables, `\multicolumn` spans with - Tables: natural column widths, centered tables, `\multicolumn` spans with
per-span alignment, and partial `\cmidrule`/`\cline` rules over a column range. per-span alignment, and partial `\cmidrule`/`\cline` rules over a column range.
The arXiv table's full-width rule measures ~61.6mm, matching the XeLaTeX
reference's ~61.2mm; math-containing cells are measured from a character
estimate because inline math is painted as vector paths.
- Citations: numeric citations by default; `natbib`/`arxiv.sty` selects author-year - Citations: numeric citations by default; `natbib`/`arxiv.sty` selects author-year
`\citet`/`\citep` from `.bib` metadata, formats bibliography entries in `\citet`/`\citep` from `.bib` metadata, formats bibliography entries in
plainnat order (`First Last`, `In ...`, `pages`, publisher/year), adds plainnat order (`First Last`, `In ...`, `pages`, publisher/year), adds
+1 -1
View File
@@ -626,7 +626,7 @@ fn layout_table(
.map(|run| run.text.chars().count()) .map(|run| run.text.chars().count())
.sum::<usize>() as f64 .sum::<usize>() as f64
* f64::from(cell_font_size) * f64::from(cell_font_size)
* 0.6 * 0.45
* 25.4 * 25.4
/ 72.27; / 72.27;
let mut width = 0.0_f64; let mut width = 0.0_f64;
+8
View File
@@ -1062,6 +1062,14 @@ fn arxiv_table_rules_follow_a_narrow_centered_table() {
.all(|(x, width)| *x > 20.0 && *width < 140.0), .all(|(x, width)| *x > 20.0 && *width < 140.0),
"table rules should be centered and narrower than the text block: {table_rules:?}" "table rules should be centered and narrower than the text block: {table_rules:?}"
); );
let widest = table_rules
.iter()
.map(|(_, width)| *width)
.fold(0.0_f64, f64::max);
assert!(
(60.5..62.5).contains(&widest),
"natural-width table should match the reference width (~61.2mm), got {widest:.2}mm"
);
} }
#[test] #[test]