【问题标题】:MathJax: hide math expression while processingMathJax:处理时隐藏数学表达式
【发布时间】:2016-08-26 06:46:43
【问题描述】:

我正在开发一个应用程序,该应用程序根据表单内容显示数学表达式。

网页在渲染时显示表达式的不同状态,我只想显示最后一个状态。

我已经隐藏了数学表达式,而它在 MathJax 渲染时以 Tex 语言显示。

但还有两种状态:

  • 处理中:表达式的字体更大。
  • 排版:最终版本,字体较小。

我试图通过以下方式隐藏其中一个:

在排版之前停止 MathJax

在处理时隐藏表达式

有可能吗?

这是创建数学表达式的代码。

JAVASCRIPT

window.UpdateMath = function () {

values = document.getElementsByClassName('level');
arrayvalues = toArray(values);

var formula = "$10 \log (";
for (i = 0; i < arrayvalues.length; i++) {
if (i == 0){
 formula = formula + " 10^{ &#92;frac{" + arrayvalues[i] + "}{10}} ";
}else{
 formula = formula + " + 10^{ &#92;frac{" + arrayvalues[i] + "}{10}} ";
}
}
formula = formula + ")$";

document.getElementById('MathOutput').style.visibility = "hidden";
document.getElementById("MathOutput").innerHTML = formula;

//reprocess the MathOutput Element
MathJax.Hub.Queue(["Typeset",MathJax.Hub,"MathOutput"]);
MathJax.Hub.Queue(
function () {
document.getElementById('MathOutput').style.visibility = "";
}
);
}
})();

完整代码在这里: http://jsfiddle.net/AqDCA/888/

【问题讨论】:

    标签: javascript mathjax


    【解决方案1】:

    您想关闭预处理器预览和快速预览。尝试将您的配置设置为此

      MathJax.Hub.Config({
        "fast-preview": {disabled:true},
        tex2jax: {
          preview: "none",
          inlineMath: [["$","$"],["\\(","\\)"]]
        }
      });
    

    这应该会让事情更像你想要的那样工作。

    【讨论】:

    • 完美。正是我想要的 :) 谢谢!
    猜你喜欢
    • 2017-05-06
    • 1970-01-01
    • 2011-06-05
    • 2021-08-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-10-08
    相关资源
    最近更新 更多