Mathjax 显示数学前后的奇怪间距
Mathjax weird spacing before and after display math
我正在使用 MathJax 在我的网站上呈现数学并注意到 "display"/"block" 数学之前和之后的间距不等问题。
<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
如您所见,数学运算后的间距 (55px) 大于数学运算前的间距 (39px),但两者应该相等。
如何解决这个问题?
这不是来自 mathjax,而是来自您的 html。检查元素(F12),你看到只有一个 <br>
在 MMM... 行之后,两个在等式
之后
<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
我正在使用 MathJax 在我的网站上呈现数学并注意到 "display"/"block" 数学之前和之后的间距不等问题。
<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
如您所见,数学运算后的间距 (55px) 大于数学运算前的间距 (39px),但两者应该相等。
如何解决这个问题?
这不是来自 mathjax,而是来自您的 html。检查元素(F12),你看到只有一个 <br>
在 MMM... 行之后,两个在等式
<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