我使用latex存储数学公式,并使用mathjax在网页中呈现数学公式。
<script type="text/javascript" src="http://cdn.bootcss.com/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
tex2jax: {inlineMath: [['$', '$']]},
messageStyle: "none"
});
</script>
When $a \ne 0$, there are two solutions to \(ax^2 + bx + c = 0\) and they are
$$x = {-b \pm \sqrt{b^2-4ac} \over 2a}.$$
我从其他网站抓取了一些数学公式,他们不使用LaTeX。例如x<sup>2</sup>
并且是一个公式的一部分,我尝试将x<sup>2</sup>
保存在LaTeX公式中,但是LaTeX公式不支持它。
<script type="text/javascript" src="http://cdn.bootcss.com/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
tex2jax: {inlineMath: [['$', '$']]},
messageStyle: "none"
});
</script>
$$x = {-b \pm \sqrt{b<sup>2</sup>-4ac} \over 2a}.$$
我也尝试过嵌套公式,但它也不起作用。
<script type="text/javascript" src="http://cdn.bootcss.com/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
tex2jax: {inlineMath: [['$', '$']]},
messageStyle: "none"
});
</script>
$$x = {-b \pm \sqrt{$$b^2$$-4ac} \over 2a}.$$
那么如何在LaTeX中嵌套数学公式?
如果您不了解某些方程式或构造的正确LaTeX语法,请在https://tex.stackexchange.com/处提问。