diff --git a/README.md b/README.md index 336099f..510ca10 100644 --- a/README.md +++ b/README.md @@ -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) diff --git a/crates/texrra-core/src/document.rs b/crates/texrra-core/src/document.rs index 3fb4c47..2de2b5b 100644 --- a/crates/texrra-core/src/document.rs +++ b/crates/texrra-core/src/document.rs @@ -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`. diff --git a/crates/texrra-core/src/document_parser.rs b/crates/texrra-core/src/document_parser.rs index 189450f..b51f1ba 100644 --- a/crates/texrra-core/src/document_parser.rs +++ b/crates/texrra-core/src/document_parser.rs @@ -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; diff --git a/docs/STATUS.md b/docs/STATUS.md index 6dcf402..af74781 100644 --- a/docs/STATUS.md +++ b/docs/STATUS.md @@ -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. diff --git a/tests/typeset.rs b/tests/typeset.rs index 5e5cab1..1f1a0d1 100644 --- a/tests/typeset.rs +++ b/tests/typeset.rs @@ -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");