Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
为 Mogan STEM 的 Julia 交互式会话增加对符号计算对象(Symbolics / SymbolicUtils / SymPy 等)的 LaTeX 优先渲染与容器自适应转换能力,使符号表达式在会话中能以公式形式输出。
Changes:
- 调整
tm_mimetypes顺序并优先处理text/latex,同时对 LaTeX 输出做外层数学定界符剥离与包装。 - 新增符号对象侦测
is_symbolic_object/is_symbolic_type,并在容器对象不支持原生text/latex时尝试Latexify.latexify。 - 新增开发文档
devel/0804.md,记录测试步骤与用例。
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| TeXmacs/plugins/julia/julia/MoganJulia.jl | 提升 LaTeX 渲染优先级、规范化 LaTeX 文本边界,并对符号对象/容器启用 Latexify 转换路径 |
| devel/0804.md | 增加该功能的手工测试说明与示例 |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
[0804] Julia 会话支持符号计算
如何测试
using Symbolics, Latexify, LaTeXStrings应输出一个渲染好的下x^2
应输出一个渲染好的此单行公式
应输出一个渲染好的列向量
应输出一个渲染好的列向量
应输出一个渲染好的矩阵
应输出一个矩阵形势的字典
L"\int_{0}^{\infty} e^{-x^2} dx = \frac{\sqrt{\pi}}{2}"应输出一个渲染好的行内 latex 公式
应输出一个渲染好的$2x\sin(x) + x^2\cos(x)$
应输出一个渲染好的$x + y$
应输出一个渲染好的$x^2 + 2xy + y^2$
非符号计算,应输出一个普通的数字 3
非符号计算,应输出一个普通的提示信息文本
2026/6/17
What
支持 Julia 会话的符号计算,可以直接在会话中生成公式,类似于 Python 的 SymPy
How
MoganJulia.jl交互式会话中text/latexMIME 类型的匹配优先级,确保text/latex优先于text/html/text/markdown导出is_symbolic_object(x),通过动态反射检查并自适应对象的类型,并在非原生 LaTeX 格式的容器上自适应激活Latexify转换$$、$、\[ \]或\( \)等外部数学边界符,对非\begin起始的代数公式两端注入标准的$\rmfamily{...}$包裹