Renderer support
| Package | MathJax | KaTeX | XeTeX |
|---|---|---|---|
ams | MathJax: Full | KaTeX: Full | XeTeX: Full |
base | MathJax: Full | KaTeX: Full | XeTeX: Full |
Syntax#
\fracm{a}math contentm{b}math contentArgspec m m — two mandatory arguments. Same argspec in ams and base. Reading argspecs
Common tasks#
How to write a compact inline fraction#
How to write a nested fraction#
How to write a derivative as a fraction#
Examples#
Package variants#
In TeXForm#
TeXForm parses this entry as prefix syntax; the package determines its argument specification.
Equivalent forms#
\genfrac{}{}{}{}{#1}{#2}exactThis is the AMS mapping's fixed-parameter specialization of
\genfracwith empty delimiters, empty thickness, and empty style.a \over bapproximate\overis an infix primitive with different grouping scope;\fracis preferred in LaTeX{a \over b}exactPrimitive infix form (discouraged in modern LaTeX)
\dfrac{a}{b}approximateForces display style
See also#
Test cases#
| Input | Case | MathJax | KaTeX | XeTeX |
|---|---|---|---|---|
\frac{a}{b} | Positive · baseline | Pass | Pass | Pass |
\frac a{b} | Positive · bare[0] | Pass | Pass | Pass |
\frac{a}b | Positive · bare[1] | Pass | Pass | Pass |
| Input | Case | MathJax | KaTeX | XeTeX |
|---|---|---|---|---|
\frac{a}{b} | Positive · baseline | Pass | Pass | Pass |
\frac a{b} | Positive · bare[0] | Pass | Pass | Pass |
\frac{a}b | Positive · bare[1] | Pass | Pass | Pass |