是的,我又造轮子了,不是 mathtype,不是 axmath,也不是 aurora,是自己造的
为什么呢
某插件居然卖四百块,于是想自己造一个看看到底有多难
当然,我把最难的交互编辑和渲染绕开了,直接调用 latex 编译
# ...
subprocess.run(["latex", "-interaction", "nonstopmode", "-output-directory", ".", "tmp.tex"])
print("latex done")
result = subprocess.run(
["dvipng", "--depth", "-D", str(dpi), "-T", "tight", "-bg", "Transparent", "tmp.dvi"],
capture_output=True,
text=True,
)
# ...
结果就是,一下午就实现了
效果如下
公式有正确对齐,基线是正确的哦