我已将 MathJax 脚本设置为更大的字体。一切正常。但现在当我将代码放在 $.
之间时它不会显示
仅当代码在 $$ 之间时才起作用。我希望 $ 和 $$ 都渲染 MathJax。
这是我的代码:
<!-- MathJax CDN -->
<script type="text/x-mathjax-config">
MathJax.Hub.Config{
CommonHTML: {
scale: 120
}
});
</script>
<script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_CHTML">
</script>
最佳答案
在配置中添加 text2jax.js 扩展以设置内联分隔符。
请参阅此处了解详细信息: http://docs.mathjax.org/en/latest/configuration.html#using-in-line-configuration-options
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
extensions: ["tex2jax.js"],
tex2jax: {inlineMath: [["$","$"]]},
CommonHTML: {
scale: 120
}
});
</script>
<script type="text/javascript" async src=
"https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/latest.js?config=
TeX-MML-AM_CHTML"></script>
$x^y$
(请注意,您的配置中有一个拼写错误 - 缺少括号)
另请注意来自 mathjax doc 的警告:
By default, the tex2jax preprocessor defines the LaTeX math delimiters, which are \(...\) for in-line math, and \[...\] for displayed equations. It also defines the TeX delimiters $$...$$ for displayed equations, but it does not define $...$ as in-line math delimiters. That is because dollar signs appear too often in non-mathematical settings, which could cause some text to be treated as mathematics unexpectedly. For example, with single-dollar delimiters, “… the cost is $2.50 for the first one, and $2.00 for each additional one …” would cause the phrase “2.50 for the first one, and” to be treated as mathematics since it falls between dollar signs. For this reason, if you want to use single-dollars for in-line math mode, you must enable that explicitly in your configuration
关于Mathjax怎么做,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52261404/