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$\unicode{x2014}$yet significant$\unicode{x2014}$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.
翻译:TeX是一种广泛使用的排版系统,已被大多数出版商和专业学会采用。尽管TeX负责生成大量文档,但TeX生态系统中的不规范性可能导致文档不一致。这些不一致可能出现在不同的TeX引擎或不同版本的TeX发行版之间,导致无法遵循格式规范,或同一文档在不同作者处呈现不同效果。本研究通过对432份文档的大规模分析,调查并量化了TeX生态系统的鲁棒性。我们开发了一个自动化流程来评估TeX生态系统的跨引擎和跨版本兼容性。研究发现不同TeX引擎的输出存在显著不一致:由于学术会议中常用的LaTeX宏包和文档类缺乏跨引擎支持,仅有0.2%的文档在XeTeX和PDFTeX中编译出完全相同的输出。在不同TeX Live发行版之间也发现了较小但显著的不一致程度:从2020年到2023年,仅有42.1%的文档能产生相同输出。我们的自动化流程还减少了人工查找错误的工作量:从10个不一致性的独特根本原因样本中,我们识别出LaTeX宏包中的两个新错误和五个已独立修复的既有错误。此外,我们观察到TeX Live不同发行版之间可能存在变更日志未列出的非预期不一致现象。本研究期望通过揭示TeX生态系统中常未记录的微妙差异如何影响文档输出,帮助TeX文档作者避免意外结果,同时通过展示不同实现如何导致非预期不一致性,为开发者提供参考。