一句话:大规模量化 TeX 生态跨引擎/跨版本输出不一致,并用自动化流水线发现 LaTeX 包缺陷。
TeX 被广泛用于学术出版,但其生态中的不规则性可能导致同一文档在不同引擎或不同发行版下渲染不一致,违反格式规范或产生意外输出。本文对 432 份文档开展大规模研究,构建自动化流水线评估跨引擎与跨版本兼容性。结果显示,不同 TeX 引擎输出差异显著:XeTeX 与 PDFTeX 仅 0.2% 的文档编译结果完全相同;2020 至 2023 年的 TeX Live 发行版也只有 42.1% 的文档保持一致。该流水线还辅助缺陷发现:从 10 个不同根因样本中识别出 LaTeX 包中的 2 个新缺陷和 5 个已有缺陷。作者期望该研究帮助用户理解 TeX 生态中常未记录的细微差异,避免意外输出,并帮助开发者定位实现不一致。
TeX is a widely-used typesetting system adopted by most publishers and professional societies. While TeX is responsible for generating a significant number of documents, irregularities in the TeX ecosystem may produce inconsistent documents. These inconsistencies may occur across different TeX engines or different versions of TeX distributions, resulting in failures to adhere to formatting specifications, or the same document rendering differently for different authors. In this work, we investigate and quantify the robustness of the TeX ecosystem through a large-scale study of 432 documents. We developed an automated pipeline to evaluate the cross-engine and cross-version compatibility of the TeX ecosystem. We found significant inconsistencies in the outputs of different TeX engines: only 0.2% of documents compiled to identical output with XeTeX and PDFTeX due to a lack of cross-engine support in popular LaTeX packages and classes used in academic conferences. A smaller—yet significant—extent of inconsistencies was found across different TeX Live distributions, with only 42.1% of documents producing the same output from 2020 to 2023. Our automated pipeline additionally reduces the human effort in bug-finding: from a sample of 10 unique root causes of inconsistencies, we identified two new bugs in LaTeX packages and five existing bugs that were fixed independently of this study. We also observed potentially unintended inconsistencies across different TeX Live distributions beyond the updates listed in changelogs. We expect that this study will help authors of TeX documents to avoid unexpected outcomes by understanding how they may be affected by the often undocumented subtleties of the TeX ecosystem, while benefiting developers by demonstrating how different implementations result in unintended inconsistencies.