Search code examples
javascriptequationmathjax

how to display asciimath equation in displaystyle (MathJax)


I 'm trying to display an AsciiMath formula in display mode, but whatever I try its still inline

Here is my MathJax configuration:

MathJax.Hub.Config({
    AsciiMath: {
        fixphi: true,
        useMathMLspacing: true,
        displaystyle: true,
        decimalsign: "."
    },
    extensions: ['asciimath2jax.js'],
    jax: ['input/TeX', 'input/AsciiMath', 'output/HTML-CSS']
});

And the HTML

<p>Once upon a time ... <span>`f(x) = x^2`</span> which ... </p>

JSFIDDLE As you can see the Latex formula $$f(x) = x^2$$ is in display style which is what I'm looking for. So, the question is, why is the config option displaystyle: true not working ?


Solution

  • AsciiMath does not have a built-in way to do this, i.e., generate <math> elements with display="block" (and thus neither does MathJax).

    The displaystyle setting adds displaystyle="true" to the math. As per the MathML spec display="block" entails displaystyle="true" but not vice versa; the main difference is that the former is set as block element while displaystyle controls the layout behavior (so you can choose that independently).

    In this MathJax User discussion you can find some code to add additional delimiters; this would probably fit well on the MathJax Third Party extensions repo.