V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX  ›  awehook  ›  全部回复第 1 页 / 共 1 页
回复总数  2
问题已经解决了,不是通过改字体等手段解决的,katex 导出的更号丢失,可以通过
const svgElements = exportDiv.querySelectorAll('svg');
svgElements.forEach(function(item) {
item.setAttribute('width', item.getBoundingClientRect().width);
item.setAttribute('height', item.getBoundingClientRect().height);
item.style.width = null;
item.style.height = null;
}); 这段代码来解决,但是矩阵的大括号导出时依然会位置错乱。

后来换了个库 mathjax3, 通过 mathjax3 把公式渲染成图片,通过 html2canvas 将带公式的 markdown 导出为图片,解决了上面的问题
@zeromake 问题已经解决了,初次发帖,没有经验
关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   4869 人在线   最高记录 6543   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 12ms · UTC 09:58 · PVG 17:58 · LAX 02:58 · JFK 05:58
Developed with CodeLauncher
♥ Do have faith in what you're doing.