From 297431a547713007f37f66255b1cb56256d7851c Mon Sep 17 00:00:00 2001 From: GloamXun Date: Sat, 21 Nov 2026 03:56:17 +0800 Subject: [PATCH] Retain signed glue in native display lists --- .../src/execution/engine/display.rs | 9 ++----- .../tests/execution_display.rs | 4 +-- docs/P2_M1_PROGRESS.md | 27 +++++++++++++++++++ 3 files changed, 31 insertions(+), 9 deletions(-) diff --git a/crates/texrra-tex-core/src/execution/engine/display.rs b/crates/texrra-tex-core/src/execution/engine/display.rs index 71cc75c..9bbe5bf 100644 --- a/crates/texrra-tex-core/src/execution/engine/display.rs +++ b/crates/texrra-tex-core/src/execution/engine/display.rs @@ -205,13 +205,8 @@ impl Executor { let separate_right = !left && e == 0 && number.is_some(); let above_glue = (!separate_left).then(|| self.read_parameter(above).glue()); let below_glue = (!separate_right).then(|| self.read_parameter(below).glue()); - for g in [above_glue, below_glue].into_iter().flatten() { - if g.stretch.amount < 0 || g.shrink.amount < 0 || g.shrink.order != 0 { - return self.fail( - "unsupported negative flexibility or infinite shrink in native display skip", - ); - } - } + // Keep the original glue spec. Packing a box can use every order, + // while the page builder diagnoses infinite shrink on contributions. // hpack diagnostics are actual packaging results, not page costs. let threshold = self.read_parameter(Parameter::Hbadness).width(); let fuzz = self.read_parameter(Parameter::Hfuzz).width() as i64; diff --git a/crates/texrra-tex-core/tests/execution_display.rs b/crates/texrra-tex-core/tests/execution_display.rs index 4f8dad0..8b7587b 100644 --- a/crates/texrra-tex-core/tests/execution_display.rs +++ b/crates/texrra-tex-core/tests/execution_display.rs @@ -158,8 +158,6 @@ fn display_assignments_scopes_and_strict_boundaries_have_real_consumers() { r"$$x\limits$$", r"$$\message{\the\prevdepth}x$$", r"$$\message{\the\spacefactor}x$$", - r"\noindent$$\abovedisplayshortskip=0pt plus-1fil x$$", - r"\noindent$$\belowdisplayshortskip=0pt minus1fil x$$", ] { assert!( Executor::new(State::initex().with_etex(), Limits::default()) @@ -343,6 +341,8 @@ fn display_lists_pre_width_baselines_depth_and_hanging_state_match_initex() { cases.push(format!(r"\noindent A$${inside} x$$After\par")); } cases.extend([ + r"\noindent$$\abovedisplayshortskip=0pt plus-1fil x$$".into(), + r"\noindent$$\belowdisplayshortskip=0pt minus1fil x$$".into(), r"\noindent$$x$$$$y_2$$After\par".into(),r"$$x$$After\par".into(),r"\noindent$$x$$\par After\par".into(), r"\noindent$$\mkern300mu x$$After\par".into(),r"\noindent$$x\mskip0mu plus1fil y$$After\par".into(), r"\baselineskip=5pt \lineskip=2pt \lineskiplimit=3pt \noindent A$$x_2$$After\par".into(), diff --git a/docs/P2_M1_PROGRESS.md b/docs/P2_M1_PROGRESS.md index 627dc72..c0c99bf 100644 --- a/docs/P2_M1_PROGRESS.md +++ b/docs/P2_M1_PROGRESS.md @@ -1260,6 +1260,33 @@ schema43。 回执为 `target/p3-pdf-math-extensions-native/receipt.json`,SHA-256 为 `2eb409028f556ded23ebf69a457a3e9512bfde7113263377fbd9f3a0df8b90db`。 +### 陈列公式保留原始胶水伸缩量 + +普通陈列公式将所选的四类陈列间距之一作为原始命名胶水加入纵向列表。 +有符号伸缩量和收缩量进入现有 \vpack,按真实阶和累计伸缩决定各元素位置。 +盒内可以使用高阶收缩。当前页的构建器和竖向拆分器仍在实际消费带非零无限 +收缩的节点时诊断错误。本阶段以 halt-on-error 对照该失败,普通 TeX +交互模式下的继续恢复行为仍待实现。 +[pdfTeX 的陈列间距和页胶水消费者](https://github.com/TeX-Live/texlive-source/blob/trunk/texk/web2c/pdftexdir/pdftex.web#L28236-L28258) +[pdfTeX 的纵向盒收缩](https://github.com/TeX-Live/texlive-source/blob/trunk/texk/web2c/pdftexdir/pdftex.web#L21392-L21409) + +原来的两条拒绝输入保留为 INITEX 列表正向对照。五项已有陈列公式对照 +全部通过。补充对照覆盖固定高度盒内的负伸缩与负收缩、高阶收缩、以及实际 +页面的有符号胶水。三个输出页面的144 DPI灰度像素一致, +两个盒的命名胶水和打包比率与参考日志一致。实际页面无限收缩的输入 +两端均失败,原生保留页消费处诊断。 +最小样例补入实际 cmmi10 数学字体,原先缺失字体及验证脚本将 +\showbox 状态码视为致命错误的证据保留。 + +编辑第二页的伸缩量复用833步,第二页 SVG 更新,第一页保留。 +PDF、SVG 和归一化来源映射与独立零复用编译一致,同一格式与资源可复查。 +本轮格式结构未变,原样复验继续使用冻结 schema43。 + +回执在 `target/p2-native-display-flexibility`。 + +- `receipt.json` 为 `b4100de1a529f99f870539b79f1e3661e49bdc403faffff593e8678fa404aa08`。 +- `checkpoint/receipt.json` 为 `3292cbbb221fc0c4d82261a322b73c12bc777ab3f9be1ad66369bfc78326def0`。 + ### PDF 字面中的矩阵与来源映射 来源映射与 PDF 写入共用设备原点的取整。实际字面中的 `q`、`Q` 和