使用 MathJax 显示数学
Displaying Math with MathJax
我正在尝试学习如何使用 MathJax 显示数学方程式。我从 codepen 调整了这段代码,效果很好:
`<!DOCTYPE html>
<head>
<script src='https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML'></script>
<style>
p {
font-size: 22px;
}
</style>
</head><body>
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
tex2jax: { inlineMath: [['$', '$']] },
elements: ['math']
});
</script>
<p id="math">
Find the value of:
$\Huge{\frac {3.41 \times 10^3}{1.80 \times 10^2}}$
and enter the answer within the box.
</p>
`
但是,当我再添加一段并在其中输入数学时,它不会显示为数学。它只是像文本一样显示。有什么建议么?谢谢。
在您的 MathJax 配置中的 elements: ['math']
数组中包含您的下一段 ID。
我正在尝试学习如何使用 MathJax 显示数学方程式。我从 codepen 调整了这段代码,效果很好:
`<!DOCTYPE html>
<head>
<script src='https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML'></script>
<style>
p {
font-size: 22px;
}
</style>
</head><body>
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
tex2jax: { inlineMath: [['$', '$']] },
elements: ['math']
});
</script>
<p id="math">
Find the value of:
$\Huge{\frac {3.41 \times 10^3}{1.80 \times 10^2}}$
and enter the answer within the box.
</p>
`
但是,当我再添加一段并在其中输入数学时,它不会显示为数学。它只是像文本一样显示。有什么建议么?谢谢。
在您的 MathJax 配置中的 elements: ['math']
数组中包含您的下一段 ID。