Math
Render mathematical equations using KaTeX
The Math component renders mathematical equations using KaTeX, supporting both inline and block math.
Usage
Inline Math
mdx
1The equation <Math>{"E = mc^2"}</Math> is famous.Block Math
mdx
1<Math block>2 {"\\int_{-\\infty}^{\\infty} e^{-x^2} dx = \\sqrt{\\pi}"}3</Math>Live Examples
Inline Math
Einstein's famous equationrelates energy and mass.
The quadratic formula is.
Block Math
Matrix
Summation
Props
| Prop | Type | Default | Description |
|---|---|---|---|
children | string | required | LaTeX math expression |
block | boolean | false | Display as block (centered) |
LaTeX Syntax
Tip
Remember to escape backslashes in JSX. Use `\\` instead of `\` for LaTeX commands.
Common Symbols
| Symbol | LaTeX | Result |
|---|---|---|
| Greek letters | \alpha, \beta, \gamma | |
| Fractions | \frac{a}{b} | |
| Square root | \sqrt{x} | |
| Exponents | x^{n} | |
| Subscripts | x_{i} | |
| Infinity | \infty | |
| Sum | \sum | |
| Integral | \int |