Lay out table-cell images as grid placeholders

This commit is contained in:
gloamxun committed 2026-10-20 02:20:59 +08:00
1 parent b1b633636a
commit 54f610445b
5 files changed
+34 -2

No files matched your search

+1 -1
View File
@@ -527,7 +527,7 @@ advisory breaks, starred `\vspace`/`\hspace`, `center`, `\hrule`, `\fbox`,
## New-template compatibility
The SIVP class (`sn-jnl.cls`) loads completely and `sn-article.tex` previews and exports a 17-page PDF; the Huawei E fragment (`projects/e/问题一.tex`) compiles to 16 A4 pages. This required generic TeX conditionals (`\if`, `\ifx`), `\newcount`/`\newdimen`, `\char`, 64-bit dimension scanning, `tabular*`/`tabularx` environments, and the math accent/operator/arrow vocabulary used by both documents. Both are covered by integration tests.
The SIVP class (`sn-jnl.cls`) loads completely and `sn-article.tex` previews and exports a 14-page PDF; the Huawei E fragment (`projects/e/问题一.tex`) compiles to 16 A4 pages. This required generic TeX conditionals (`\if`, `\ifx`), `\newcount`/`\newdimen`, `\char`, 64-bit dimension scanning, `tabular*`/`tabularx` environments, and the math accent/operator/arrow vocabulary used by both documents. Both are covered by integration tests.
## Capability matrix (current)
+2
View File
@@ -431,6 +431,8 @@ pub struct RuleBox {
pub raise: common::Scaled,
/// Thickness of the rule.
pub height: common::Scaled,
/// Optional fill colour; means the regular black rule.
pub color: Option<[u8; 3]>,
}
/// Paragraph-level alignment requested by `\raggedright` or `\raggedleft`.
+16
View File
@@ -1718,6 +1718,7 @@ impl Parser {
width,
raise,
height,
color: None,
}),
box_run: None,
unresolved_reference: None,
@@ -2310,6 +2311,21 @@ impl Parser {
// ORCID icons inside \author) are dropped here.
return;
}
if let Some(table) = &mut self.table {
// Table-cell images are represented as grey boxes until the cell
// image renderer lands. This still preserves the reference grid.
let width = (0.138_f64 * 160.0 * 72.27 / 25.4 * 65536.0).round() as i32;
let height = (width as f64 * 1.35).round() as i32;
let mut run = Run::plain(String::new());
run.rule = Some(RuleBox {
width: common::Scaled(width),
raise: common::Scaled(0),
height: common::Scaled(height),
color: Some([170, 170, 170]),
});
table.cell.push(run);
return;
}
self.flush_paragraph();
if !self.figure_active {
self.figure_number += 1;
+1 -1
View File
@@ -150,7 +150,7 @@ See `docs/ROADMAP.md` for concrete implementation plans.
since printpdf 0.3.4 has no annotation API.
- Fonts: bundled reserved-glyph subsets in `assets/fonts-subset/` are used when the document charset is covered; arXiv PDF is about 0.29 MB.
- New-template compatibility: the SIVP class file loads fully and `sn-article.tex` previews and exports a 17-page PDF (PDF figures render as placeholders). Its journal title block captures title, author/affiliation, corresponding-author stars, both e-mails, abstract, and keywords; class declaration option leakage is consumed. The Huawei E fragment compiles to 16 A4 pages. Generic support added for TeX `\if`/`\ifx`, `\newcount`, `\newdimen`, `\char`, `tabular*`/`tabularx`, math accents/operators/arrows, a 64-bit dimension scanner, and `geometry` `text={width,height}` blocks. Both fixtures are regression tests (`sivp_project_previews_and_exports_a_pdf`, `e_fixture_compiles`).
- New-template compatibility: the SIVP class file loads fully and `sn-article.tex` previews and exports a 14-page PDF; PDF figures render as placeholders and table-cell images are emitted as placeholder blocks that preserve the reference grid geometry instead of becoming page-sized strips. Its journal title block captures title, author/affiliation, corresponding-author stars, both e-mails, abstract, and keywords; class declaration option leakage is consumed. The Huawei E fragment compiles to 16 A4 pages. Generic support added for TeX `\if`/`\ifx`, `\newcount`, `\newdimen`, `\char`, `tabular*`/`tabularx`, math accents/operators/arrows, a 64-bit dimension scanner, and `geometry` `text={width,height}` blocks. Both fixtures are regression tests (`sivp_project_previews_and_exports_a_pdf`, `e_fixture_compiles`).
- Lines whose justification ratio exceeds 3 fall back to natural spacing instead of stretching inter-word gaps across the measure.
+14
View File
@@ -1927,6 +1927,20 @@ fn sivp_project_previews_and_exports_a_pdf() {
let value = fresh_preview(&source, "projects/_sivp__/sn-article.tex");
assert_eq!(value["status"], "ok", "{value}");
assert!(!pages(&value).is_empty());
assert!(
pages(&value).len() <= 15,
"SIVP should stay near the reference page count, got {}",
pages(&value).len()
);
let all_svg: String = (0..pages(&value).len())
.map(|page| page_svg(&value, page))
.collect();
for needle in [">Hazy<", ">GT<", ">C2PNet<"] {
assert!(
all_svg.contains(needle),
"missing table image label {needle}"
);
}
let pdf = CompilerSession::default()
.compile(&source, "projects/_sivp__/sn-article.tex")
.expect("SIVP PDF");