MathJax: hide math expression while processing

百般思念 提交于 2019-12-11 04:46:47

问题


Im developing an application that shows a mathematical expression in function of the content of a form.

The webpage show the different states of the expression while its rendering, and I would like to show only the last state.

I have already hidden the mathematical expression while its shown in Tex language while MathJax is rendering.

But there are still two states more:

  • Processing: The expression is in a bigger font.
  • Typesetted: The final version, in a smaller font.

Im trying to hide one of them through:

Stopping MathJax before typesetting

or

Hide the expression while processing it

Is it possible?

This is the code to create the mathematial expression.

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 = "";
}
);
}
})();

Full code here: http://jsfiddle.net/AqDCA/888/


回答1:


You want to turn off preprocessor previews and the fast previews. Try setting your configuration to this

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

This should make things work a bit more like what you want.



来源:https://stackoverflow.com/questions/39159953/mathjax-hide-math-expression-while-processing

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!