Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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 ?

like image 273
Jeanluca Scaljeri Avatar asked Sep 13 '25 07:09

Jeanluca Scaljeri


1 Answers

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.

like image 50
Peter Krautzberger Avatar answered Sep 14 '25 22:09

Peter Krautzberger