[0605] 修复 stack 结构的 LaTeX 导出为 \substack#3342
Merged
Merged
Conversation
…onment
- Implement tmtex-stack in tmtex.scm to export stack as \substack{... \\ ...}
- Register stack handler in tmtex-extra-methods% dispatch table
- Auto-add mathtools package dependency
- Add integration test 0605.scm with expected LaTeX output
- xmake run 0605 passes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
[0605] 修复 stack 结构的 LaTeX 导出为 \substack
相关文档
任务相关的代码文件
TeXmacs/progs/convert/latex/tmtex.scmTeXmacs/plugins/latex/progs/convert/latex/tmtex.scmTeXmacs/tests/0605.scmTeXmacs/tests/tex/0605_stack_export.texTeXmacs/tests/tmu/0605.tmu如何测试
确定性测试(单元测试)
非确定性测试(文档验证)
TeXmacs/tests/tmu/0605.tmu。\substack{... \\ ...}。如何提交
提交前执行以下最少步骤:
What
修复 stack 结构在导出 LaTeX 时错误地使用
array环境的问题,改为正确导出为\substack{... \\ ...}格式。tmtex.scm中新增tmtex-stack函数,将 stack 的表格内容转换为\substack参数格式tmtex-extra-methods%分发表中注册stack的处理函数mathtools包依赖(\substack需要此包)0605.scm和对应的预期输出文件Why
\substack是 LaTeX 中表示多行下标/上标的标准命令(由mathtools/amsmath提供),语义上与 TeXmacs 的 stack 结构完全对应。之前导出为array环境会导致:array嵌套有兼容性问题How
实现思路:
tmtex-table的实现,利用tmtable-parser解析 stack 的表格结构tmtex递归转换每个单元格\\\\(即 LaTeX 的\\)作为行分隔符连接各行(tex-apply 'substack ...)生成最终的 LaTeX AST 节点(latex-add-extra "mathtools")确保导出的 LaTeX 文档包含所需的宏包