displaystyle="true" on "mfrace"

Q

How to prevent <mfrac> using compact style?

✍: FYIcenter.com

A

By default, <mfrac> element is rendered in compact style with smaller font size and less vertical space.

If you don't want this to happen, you can add the displaystyle="true" attribute explicitly. The example below shows that larger font sizes and more vertical spaces are used on the right hand.

<math><mfrac><mfrac><mfrac><mi>1</mi><mn>2</mn></mfrac>
  <mn>3</mn></mfrac><mn>4</mn></mfrac> <mo>=</mo> 
  <mfrac displaystyle="true"><mfrac><mfrac><mi>1</mi><mn>2</mn></mfrac>
  <mn>3</mn></mfrac><mn>4</mn></mfrac></math>
    12
      34 = 
      12
      34

Note that <mfrac displaystyle="true"> may not work on older browsers. In that case, you need to use <mstyle displaystyle="true"><mfrac>. The example below shows that both sides have the same result.

<math><mfrac><mfrac><mfrac><mi>1</mi><mn>2</mn></mfrac>
  <mn>3</mn></mfrac><mn>4</mn></mfrac> <mo>=</mo> 
  <mfrac displaystyle="true"><mfrac><mfrac><mi>1</mi><mn>2</mn></mfrac>
  <mn>3</mn></mfrac><mn>4</mn></mfrac></math>
    12
      34 = 
      12
      34

 

⇒ scriptlevel="0" on "msup"

⇐ scriptlevel="0" on "mfrace"

⇑ Subscripts, Fractions and "scriptlevel"

⇑⇑ MathML (Mathematical Markup Language)

2026-10-24, ∼1830🔥, 0💬