Preserve alignment boundaries when matching hash-brace macros
This commit is contained in:
1 parent
307303d596
commit
862801ee5f
5 files changed
+57
No files matched your search
@@ -1735,6 +1735,7 @@ impl Executor {
|
||||
if self.required_raw(files)?.token.kind != *expected {
|
||||
return self.fail("macro prefix does not match");
|
||||
}
|
||||
self.consume_macro_delimiter(expected);
|
||||
}
|
||||
let mut arguments = Vec::new();
|
||||
for (index, delimiter) in definition.parameters.iter().enumerate() {
|
||||
@@ -1773,6 +1774,7 @@ impl Executor {
|
||||
// became argument text when the match shifted.
|
||||
matched += 1;
|
||||
if matched == delimiter.len() {
|
||||
self.consume_macro_delimiter(&next.kind);
|
||||
argument.truncate(argument.len() + 1 - matched);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -94,6 +94,13 @@ impl Executor {
|
||||
_ => 0,
|
||||
}
|
||||
}
|
||||
pub(super) fn consume_macro_delimiter(&mut self, kind: &TokenKind) {
|
||||
// The final literal brace of a hash-brace delimiter is appended to the
|
||||
// replacement. Count it when that replacement reaches the alignment.
|
||||
if kind.begin_group() && !self.alignments.is_empty() {
|
||||
self.alignment_balance -= 1;
|
||||
}
|
||||
}
|
||||
pub(super) fn alignment_brace(&mut self, token: &Token) -> i64 {
|
||||
match self.meaning(token) {
|
||||
Meaning::Character(TokenKind::Character(_, CatCode::BeginGroup)) => 1,
|
||||
|
||||
@@ -135,6 +135,17 @@ fn templates_execute_macros_groups_assignments_hooks_and_nested_lists() {
|
||||
compare(body);
|
||||
}
|
||||
}
|
||||
#[test]
|
||||
fn hash_brace_macro_delimiters_preserve_alignment_cell_boundaries() {
|
||||
compare(
|
||||
r"\def\prefix#{\relax}\def\argument#1:#2#{#2#1}
|
||||
\setbox0=\vbox{\halign{#&#\cr
|
||||
A\prefix{B}&C\cr
|
||||
D\argument A:B{C}&DEF\cr
|
||||
}}",
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn vertical_alignment_uses_vertical_cells_and_horizontal_rows() {
|
||||
for spec in ["", "to40pt", "spread5pt"] {
|
||||
|
||||
@@ -1126,6 +1126,27 @@ schema28 更新。schema 1至26和29仍拒绝,27与28缺少必需 Unicode
|
||||
[原样模板记录](PUBLISHER_TEMPLATE_MATRIX.md#aps-revtex-原样双栏样稿)
|
||||
[pdfTeX 的重音布局](https://github.com/TeX-Live/texlive-source/blob/trunk/texk/web2c/pdftexdir/pdftex.web#L28084-L28143)
|
||||
|
||||
### 宏的左花括号分隔符与表格行边界
|
||||
|
||||
带 `#{` 的 TeX 宏把字面左花括号匹配为分隔符,再将同一括号放回替换
|
||||
文本。对齐深度现在只在读到替换文本中的括号时计入一次。无参数的宏
|
||||
前缀和有参数的最后一个分隔符都按这条规则处理。
|
||||
[pdfTeX 的宏分隔符对齐状态](https://github.com/TeX-Live/texlive-source/blob/trunk/texk/web2c/pdftexdir/pdftex.web#L9429-L9441)
|
||||
|
||||
原样 arXiv 作者表格的换行差异用普通 `article`、原版 `hyperref` 和
|
||||
单列表格复现。移除图片或脚注仍复现,保留图片、移除实际链接后可编译。
|
||||
新增核心对照验证两种宏分隔形式生成的完整盒列表与 pdfTeX 相同。
|
||||
对齐测试文件11项通过,最后另外核对了在单元格已有文本后读取分隔符
|
||||
的情况。编辑第二页的表格时复用945步,只替换第二页,PDF、SVG 和
|
||||
来源映射与独立零复用一致。来源映射只归一化会话修订号和测试项目根。
|
||||
|
||||
`target/p3-arxiv-title-alignment` 的回执:
|
||||
|
||||
- `bisect/result.json` 为 `af39b0de752d7a66b28e4ea8833238633ef2eeafb66b1e6fd38508c5e0413b9c`。
|
||||
- `alignment-test.log` 为 `4aa21ddf1c71e7d028bf13d0fba93a2937842c0fafcf4e137b8dd69f167f97c2`。
|
||||
- `hash-brace-test.log` 为 `a388b5874e0eacb92ffbb9f3beda6d7ce97c2a88bbcf395e8524c8c72222cbe3`。
|
||||
- `checkpoint/receipt.json` 为 `1cf6357762f1641b1849523abe29c3b8b56410d0c376fefe1c53a42b3d516761`。
|
||||
|
||||
### 原生 PDF 页对象引用
|
||||
|
||||
`\pdfpageref` 展开出同一作业内稳定的页对象编号,可以在对应物理页出页前
|
||||
|
||||
@@ -452,6 +452,13 @@ alignment command。回溯显示 `\reserved@c` 展开为 `\ifnum 0=` 加
|
||||
`target/p3-pdf-random-native/arxiv-first-blocker/receipt.json` 的 SHA-256
|
||||
为 `05432989407b5d9ea8a592de5998a6ea81788fedc359fe1f24444d19836214ef`。
|
||||
|
||||
修正宏分隔符的对齐深度后,新代码使用同一只读原样格式、同一组六份
|
||||
输入和同一字体映射执行。原样标题通过,`template.tex:119` 的
|
||||
`\end{equation}` 展开至 microtype 的 `\MT@suspend@tagging` 后,
|
||||
实际首个缺失原语是 `\partokencontext`。该轮未生成 PDF。
|
||||
`target/p3-arxiv-title-alignment/original-arxiv/receipt.json` 的 SHA-256
|
||||
为 `75a1803375d875d710427f6cf8e36a972657728d0890f5ab96026c9c0ac41762`。
|
||||
|
||||
### Elsevier CAS 双栏首轮输出
|
||||
|
||||
通用展开调度改动通过了实际图像高度与 LaTeX 浮点公式的差分。
|
||||
@@ -540,6 +547,15 @@ SHA-256 为 `0f9082ccfabbd34895b95abe9a20011c68cd9669a5cc69c2068e97b7aa3ae631`
|
||||
- `acm-format/receipt.json` 为 `b19359f4af8aacce9087c3713def1878b4915ed8226cf34e4f2ebd87322a728e`。
|
||||
- `acm-acmtog/receipt.json` 为 `e9a87f4eac0299c01fa85f0ebe1b478f630cb074b705dd526848e267627e3f5d`。
|
||||
|
||||
schema36 优化版在冻结输入上生成的原样格式耗时211.1秒。原样双栏
|
||||
越过 PDF 页对象引用,完成文档类及导言区执行。首次出页期间,LaTeX
|
||||
后端展开 `\tex_pdfliteral:D shipout page{...}` 时停止,该轮未生成
|
||||
PDF。同一作业中,`cmap` 的 `\pdffontattr` 能力检查发出退出告警。
|
||||
`target/p3-pdf-page-reference-native` 保留两份回执。
|
||||
|
||||
- `acm-format/receipt.json` 为 `e9580f5a2aa3fa0665d29fbd42650230b7dcf4203daed946a6170767d0b506df`。
|
||||
- `acm-acmtog/receipt.json` 为 `56956692e4524398200b6fbbbd7a0d96d030d5dc3c27975b8dde743473e4ab09`。
|
||||
|
||||
最终矩阵 `target/publisher-template-matrix/acm-official/matrix-schema29-utf8/report.json`
|
||||
SHA-256 为 `d914d7c7dfa1ee28dff20e77231fef35e390041cde6180bcc361de83288ec9e1`。其 `preparation/acmart` 保存
|
||||
DocStrip 记录。同目录的前序依赖失败、补充包指纹和原样源均保留。用现有
|
||||
|
||||
Reference in new issue
Block a user