Jeanluca Scaljeri
Jeanluca Scaljeri

Reputation: 29129

Incorrect formula rendering with MathJax

I'm trying to render some formulas without success. The formula in question is

\frac{\displaystyle \sum_{k=1}^N k^2}{a}

It must be something with how I configure MathJax, but I can't figure out what is wrong. Here it is:

window.MathJax.Hub.Config({
  config: ['MMLorHTML.js'],
  MMLorHTML: { prefer: { Firefox: 'MML', other:   'SVG' } },
  displayAlign: 'left',
  extensions: ['asciimath2jax.js', 'tex2jax.js', 'mml2jax.js', 'MathMenu.js', 'MathZoom.js'],
  jax: ['input/TeX', 'input/AsciiMath', 'input/MathML', 'output/SVG', 'output/NativeMML'],
  messageStyle: 'none',
  showMathMenu: false,
  showProcessingMessages: false,
  skipStartupTypeset: true,
  'HTML-CSS': {linebreaks: {automatic: true}}
});

Here is a DEMO which demonstrates the issue. The formula should be rendered as follows: enter image description here

Any suggestions what is missing in my configuration ?

Upvotes: 0

Views: 397

Answers (1)

konsumverweigerer
konsumverweigerer

Reputation: 271

For LaTex inline math you have to use \( and \) instead of backticks:

el2.html('\\(\\frac{\\displaystyle \\sum_{k=1}^N k^2}{a}\\)');

gives the desired result.

The backtick is per default the asciimath delimiter (see http://docs.mathjax.org/en/latest/asciimath.html) and \( the TeX delimiter (see http://docs.mathjax.org/en/latest/tex.html).

Alternatively you could reconfigure the delimiters with

  asciimath2jax: {delimiters: []},
  tex2jax: {inlineMath: [['`','`']]},

Upvotes: 1

Related Questions