我正在使用MathJax在我的网站上渲染数学,并发现在"显示" /"阻止"之前和之后存在间距不等的问题。数学。
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
displayAlign: "left",
tex2jax: {
inlineMath: [ ['\\(','\\)'] ],
displayMath: [ ['\\[','\\]'] ],
},
CommonHTML: { linebreaks: { automatic: true } },
"HTML-CSS": { linebreaks: { automatic: true } },
SVG: { linebreaks: { automatic: true } },
TeX: {extensions: ['AMSmath.js', 'AMSsymbols.js']}
});
</script>
<script async src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.4/latest.js?config=default"></script>
MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
<br>
<br>
\[ R_{\mu \nu }-{\tfrac {1}{2}}R\,g_{\mu \nu }+\Lambda g_{\mu \nu }={\frac {8\pi G}{c^{4}}}T_{\mu \nu } \]
<br>
<br>
MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
&#13;
正如你可以看到数学后的间距(55px)大于之前的间距(39px),它应该相等。
如何解决这个问题?
答案 0 :(得分:2)
这不是来自mathjax,而是来自你的HTML。检查元素(F12),您会看到在MMM ...行之后只有一个<br>
,并且在等式之后取两个{/ p>
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
displayAlign: "left",
tex2jax: {
inlineMath: [ ['\\(','\\)'] ],
displayMath: [ ['\\[','\\]'] ],
},
CommonHTML: { linebreaks: { automatic: true } },
"HTML-CSS": { linebreaks: { automatic: true } },
SVG: { linebreaks: { automatic: true } },
TeX: {extensions: ['AMSmath.js', 'AMSsymbols.js']}
});
</script>
<script async src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.4/latest.js?config=default"></script>
MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM<br>
<br>
<br>
\[ R_{\mu \nu }-{\tfrac {1}{2}}R\,g_{\mu \nu }+\Lambda g_{\mu \nu }={\frac {8\pi G}{c^{4}}}T_{\mu \nu } \]
<br>
<br>
MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM