分页: 1 / 1

解决 mathjax 数学公式渲染的字体大小问题

发表于 : 2022年 6月 12日 22:46
BobMaster
mathjax 这个库的默认选项会自动匹配字体大小

代码: 全选

matchFontHeight: true,         // true to match ex-height of surrounding font
按官方的说法,一般是113.1%,但我得到的是51%左右的一个数值,公式渲染后的样式很小,最后根据官方文档的说明解决了,只需要在引用库的时候,将matchFontHeight改为false即可。

代码: 全选

<script>
MathJax = {
  chtml: {
    matchFontHeight: false
  }
};
</script>
<script src="https://polyfill.io/v3/polyfill.min.js?features=es6"></script>
<script id="MathJax-script" async src="https://quanquan.space/assets/javascript/tex-mml-chtml.js"></script>
参考资料:
1. inline "font-size" style for mjx-container
2. https://docs.mathjax.org/en/latest/opti ... chtml.html