Reputation: 28529
I use latex to store the math formula, and use mathjax to render the math formula in a webpage.
<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}.$$
I crawl some math formula from other sites, and they don't use LaTeX. For example x<sup>2</sup>
and is a part of one formula, and I try have tried to save x<sup>2</sup>
in a LaTeX formula, but the LaTeX formula not supports it.
<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}.$$
I also tried to nesting formula, but it also not works.
<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}.$$
So how to nest math formula with LaTeX?
Upvotes: 1
Views: 364
Reputation: 965
You can’t nest formulas in this way. And you can’t mix HTML tags used for formatting in LaTeX code. Just use the LaTeX syntax.
If you don’t know the proper LaTeX syntax for some equations or constructs, ask at https://tex.stackexchange.com/.
Upvotes: 1