返回
创建于
状态公开

mathjax 报错 '_' allowed only in math mode

https://github.com/mathjax/MathJax/issues/2566

The reason for this is that the -full version includes all the extensions, including the textmacros extension. Normally, the contents of \text{} and other text-mode material is not processed further by MathJax (other than any math-mode material that it contains), but the textmacros extension enables processing of (some) macros within the text-mode material. That also enables processing of special characters, like the underscore (which is only allowed in math mode).

You can either use \_ in place of the underscore, or remove the textmacros extension from the TeX packages to use. To do the latter, use

js
1<script>
2window.MathJax = {
3  tex: {
4    packages: {'[-]': ['textmacros']}
5  }
6}
7</script>