Mathjax怎么做

标签 mathjax


我已将 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/

相关文章:

mathjax - 在批处理脚本中从 MathJax 代码生成 HTML

javascript - Mathjax 在 ajax 调用后不排版方程

mathjax - 如何将 textup 与 MathJax 一起使用?

javascript - 使用 mathjax 或类似工具将 Latex/MathML 转换为 SVG 或图像?

javascript - 如何在 MathJax 中左对齐某些方程式

mathjax - 如何在MathJax中定义新函数('operator')?

latex - MD with Latex to HTML with MathJax with Pandoc

python - 我可以将 MathJax 集成到 Python 程序中吗?

javascript - 使用 JavaScript 为 MathJax 方程制作动画