= Typeset fraction
A \b[typeset fraction] is a two-dimensional layout that places one expression above another, commonly with a horizontal rule between them. The components are laid out as <typesetting boxes> before they are assembled. In <MathML>, an `mfrac` element supplies the two components; <mathematical typesetting style> affects their presentation.<MathML Core by World Wide Web Consortium>[Fractions, mfrac: child layout and display/compact style]{ref}
For example,
$$
\frac{x^2+1}{\sqrt{y}}
$$
has a <superscript> in its upper component and a <square root> in its lower component. Their dimensions influence the space above and below the fraction rule. The expression's algebraic meaning and its geometry are related but distinct: the layout can contain arbitrary expressions, including ones whose values are not <rational numbers>.
A simple own box model makes the horizontal placement explicit. Suppose the component widths are $w_1=18$ and $w_2=10$, and the layout adds a chosen side allowance $p=2$. If both components are centred in width
$$
\boxed{W=\max(w_1,w_2)+2p=22,}
$$
their left offsets are $(22-18)/2=2$ and $(22-10)/2=6$. This is an illustrative centring model; real layouts also use vertical clearances, rule thickness and font data from an <OpenType MATH table>.
Back to article page