本文介绍了使用MathJax生成Sigma的问题(1次成功和1次失败)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
因此,我尝试使用类似于
So I am trying to generate a lower case sigma using a HTML code similar to
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>MathJax example</title>
<script type="text/javascript" async src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/latest.js?config=TeX-MML-AM_CHTML" async>
</script>
</head>
<body>
<p id="This_Is_What_I_Want"> $$ \sigma^2 $$</p>
<p id="Output"></p>
<p id="Activate"><button onclick="RUN()">Test This out</button></p>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js?config=TeX-AMS_HTML,http://myserver.com/MathJax/config/local/local.js">
function RUN() {
document.getElementById("Output").innerHTML = "$$ \sigma^2 $$";
MathJax.Hub.Queue(["Typeset", MathJax.Hub]);
}
</script>
</body>
第一个sigma正确加载,但是当我按下按钮时,第二个sigma无法正确加载
The first sigma loads correctly but when I hit the button the second one will not load correctly
推荐答案
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>MathJax example</title>
<script type="text/javascript" async src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/latest.js?config=TeX-MML-AM_CHTML" async>
</script>
</head>
<body>
<p id="This_Is_What_I_Want"> $$ \sigma^2 $$</p>
<p id="Output"></p>
<p id="Activate"><button onclick="RUN()">Test This out</button></p>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js?config=TeX-AMS_HTML,http://myserver.com/MathJax/config/local/local.js">
function RUN() {
document.getElementById("Output").innerHTML = "$$ \\sigma^2 $$";
MathJax.Hub.Queue(["Typeset", MathJax.Hub]);
}
</script>
</body>
显然我没有阅读文档中的说明,但是默认情况是您需要两个\而不是一个
apparently I did not read instructions on the documentation but the default is you need two \ as opposed to one
这篇关于使用MathJax生成Sigma的问题(1次成功和1次失败)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!