【问题标题】:Selectively render equations with MathJax使用 MathJax 选择性地渲染方程
【发布时间】:2015-01-26 17:28:10
【问题描述】:

我试图在我的整个文档中使用 MathJax 排版方程,特定的 div 除外。现在,我的 HTML 文档具有以下设置:

 <script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"> </script>

以及在

中指定的一堆其他配置
<script type="text/x-mathjax-config" > //options </script>

假设正文包含:

<div id="one"> $A^x$ </div>
<div class="two"> $B_x$ </div>

当页面加载时,A^x 和 B_x 都会被排版。但是,我想告诉 MathJax 不要在页面加载时呈现 div.two 中的方程(仅稍后)。有没有简单的方法来做到这一点?

请注意,我并不想做类似的事情

MathJax.Hub.Queue(["Typeset",MathJax.Hub,document.getElementsById('one')[0]])();

而是“渲染所有内容,减去 'two' 类的 div”。

谢谢。

【问题讨论】:

标签: javascript mathjax


【解决方案1】:

由于您使用的是 TeX-input,因此您可以在 tex2jax 预处理器的配置中指定类,例如,

<script type="text/x-mathjax-config">
  // ...
  tex2jax: {ignoreClass: "class2"}
</script>

See the MathJax documentation 了解更多详情。

【讨论】:

猜你喜欢
  • 2019-04-21
  • 2013-09-22
  • 2019-03-09
  • 1970-01-01
  • 1970-01-01
  • 2016-03-20
  • 1970-01-01
  • 1970-01-01
  • 2013-02-11
相关资源
最近更新 更多