-->

MathJax left align on render

2019-08-14 03:25发布

问题:

How do I left-align all MathJax equation "on-render". When you set displayAlign: "left", the equations would first be centered, then after 0.5s, they move to the left. So basically, it flashes to the left, which is visually unpleasant.

Is there a way to make it appear on the left on render? This is the code I have now.

<script type="text/x-mathjax-config">
MathJax.Hub.Config({
  config: ["MMLorHTML.js"],
  jax: ["input/TeX","input/MathML","input/AsciiMath","output/HTML-CSS","output/NativeMML", "output/CommonHTML"],
  extensions: ["tex2jax.js","mml2jax.js","asciimath2jax.js","MathMenu.js","MathZoom.js", "CHTML-preview.js"],
  TeX: {
    extensions: ["AMSmath.js","AMSsymbols.js","noErrors.js","noUndefined.js"]
  },
  displayAlign: "left"
});
</script>
<script src="//cdn.mathjax.org/mathjax/latest/MathJax.js"></script>

回答1:

The flash that you are seeing is due to the fast preview mode (chtml-preview.js), which uses the CommonHTML output introduced in v2.5. That mode is intentionally incomplete for better speed, which includes lack of alignment.

Disabling the fast preview is the straight forward way of resolving the problem.

(The CommonHTML output will become feature complete in the upcoming v2.6 release.)