[0628] 修复 frame 和 framed 结构 LaTeX 导出的递归转译问题#3557
Open
JackYansongLi wants to merge 5 commits into
Open
Conversation
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.
[0628] 修复 frame 递归转译问题,并重构 framed 块级与行内 LaTeX 导出
相关文档
任务相关的代码文件
TeXmacs/progs/convert/latex/tmtex.scmTeXmacs/plugins/latex/progs/convert/latex/tmtex.scmTeXmacs/progs/convert/latex/latex-drd.scmTeXmacs/plugins/latex/progs/convert/latex/latex-drd.scmTeXmacs/progs/convert/latex/latex-command-drd.scmTeXmacs/plugins/latex/progs/convert/latex/latex-command-drd.scmTeXmacs/tests/0628.scmTeXmacs/tests/tex/0628_frame_export.texTeXmacs/tests/tmu/0628.tmu如何测试
确定性测试(单元与集成测试)
非确定性测试(文档验证)
TeXmacs/tests/tmu/0628.tmu。frame与framed(包含块级和行内装饰)均能完美、安全地导出。如何提交
提交前执行以下最少步骤:
一个 PR 至少分为两个 commit:
devel/0628.md任务文档What
frame结构在导出 LaTeX 时其内部子节点没有被递归转译的问题。framed的 LaTeX 导出,在行内时自动输出为标准的\fbox,在块级(段落)时直接输出为标准的mdframed环境(\begin{mdframed} ... \end{mdframed})。tmframed及其\newmdenv定义)。Why
frame:原本的实现直接把(car l)作为fbox的内容输出,而没有调用(tmtex (car l))进行递归转译。当 frame 内包含数学公式等标签时,子节点的内容会被直接输出为原始 s-expression tree,导致生成的 LaTeX 代码报错崩溃。framed:以往的实现会为framed创建自定义的tmframed宏并通过\newmdenv定义在 LaTeX 导言区。然而,这对于 LaTeX 用户来说极其不友好(污染了导言区且代码冗余)。同时,如果将framed作为行内标签使用,生成块级环境\begin{tmframed}会导致段落换行破坏排版。How
tmtex-frame,使其对子节点使用(tmtex (car l))进行正确的递归转译:tmtex-ornamented。当匹配到"framed"时,如果其子节点不以document或para等块级标记开头,则识别为行内并转译为标准的行内fbox;如果是块级,则直接翻译为标准的mdframed环境,剔除自定义tmframed的生成:latex-command-drd.scm中注册begin-mdframed作为合法环境,并在latex-drd.scm的latex-needs%依赖映射表中注册其与"mdframed"宏包的关联,使得导出时能够完美、自动地在导言区引入\usepackage{mdframed}。