Matt
Matt

Reputation: 13

MathJax <msup> font modificaion

I am trying to implement some math expressions/equations in html5 using mathjax. When using an <msup> tag I get inconsistent behavior in font style depending on what the exponent/power is. Is there an attribute I can implement on the <msup> tag or the <mi> / <mn> tag that will keep the power the same font as its base? Or another option to keep the font styles consistent?

<math><mrow><msup><mi></mi><mi>x</mi></msup></mrow></math>

<math><mrow><msup><mi></mi><mi>-x</mi></msup></mrow></math>

I was unsuccessful implementing mathjax in this question so here is a link to a jsfiddle that illustrates my issue

http://jsfiddle.net/ez5kqv7x/

Upvotes: 1

Views: 66

Answers (1)

Peter Krautzberger
Peter Krautzberger

Reputation: 5285

It's not quite clear from the OP but it probably refers to the fact that <mi>x</mi> will be typeset italic whereas <mi>-x</mi> will be rendered normal/upright.

This is the expected result as the MathML Spec says for <mi>:

The default is "normal" (non-slanted) unless the content is a single character, in which case it would be "italic".

For identifiers, one would probably mark this up as <mo form="prefix">-</mo><mi>x</mi> in which case the x would end up italic again; but perhaps the x is really a number in which case <mn>x</mn> and <mn>-x</mn> would both be typset normal/upright.

Upvotes: 1

Related Questions