Mathjax 在模式中打开时自动换行

Mathjax automatic linebreak when opened in a modal

对于数学项目,问题的解决方案应以 Sweetalert2 模式显示。不幸的是,虽然使用

<script type="text/x-mathjax-config"> 
MathJax.Hub.Config({
tex2jax: {
     inlineMath: [['$','$'], ['\(','\)']]
},
"HTML-CSS": { 
     linebreaks: { automatic: true }
},
SVG: { 
     linebreaks: { automatic: true } 
}
}); 
</script>

自动换行在 Sweetalert2 模态中不起作用(见图)。有没有解决办法。

最诚挚的问候,莱昂

看起来您的代码是在不同于 HTML-CSS 和 SVG 处理器(很可能是 Common HTML)中呈现的。尝试添加更多配置,例如:

CommonHTML: { 
  linebreaks: { automatic: true }
}, 
PreviewHTML: { 
  linebreaks: { automatic: true }
}

编辑

您还可以使用

手动指定输出处理器
MathJax.Hub.Register.StartupHook("End Jax", function () {
 return MathJax.Hub.setRenderer("HTML-CSS");
});

您可以检查更多可能性来确定正确的处理器here