When `math` is enabled in settings (default: `false`), you can render mathematical equations using KaTeX via the `<MathBlock>` JSX component.

[Dynamic content unavailable in text export]

`math: true` requires installing the optional peer `katex` (`pnpm add katex`) — `create-zudo-doc` does not add it for you. See [Configuration — math](https://zudo-doc.takazudomodular.com/docs/guides/configuration#content-and-i18n-math) for the full optional-peer contract (`katex` for math, `diff` for [Document History](https://zudo-doc.takazudomodular.com/docs/guides/doc-history)).



[Dynamic content unavailable in text export]

`$...$`, `$$...$$`, and `` ```math `` fences are **not supported** in zfb. The zfb Rust MDX emitter does not process those syntaxes — use `<MathBlock latex="..." />` instead (shipped as [`@takazudo/zudo-doc/math-block`](https://github.com/zudolab/zudo-doc/blob/main/packages/zudo-doc/src/math-block)).



## Inline Math

Use `<MathBlock latex="..." />` (without the `block` prop) to embed math within a line of text.

The formula [Dynamic content unavailable in text export] is inline.

```mdx
The formula <MathBlock latex="E = mc^2" /> is inline.
```

## Block Math

Add the `block` prop to render a centered display equation.

[Dynamic content unavailable in text export]

```mdx
<MathBlock latex="\int_{-\infty}^{\infty} e^{-x^2} dx = \sqrt{\pi}" block />
```

## Configuration

Math support is controlled by the `math` field in `zfb.config.ts`:

```ts title="zfb.config.ts"
export default defineConfig(
  zudoDoc({
    // ...
    math: true, // disabled by default; also `pnpm add katex`
  }),
);
```

## More Examples

### Quadratic Formula

[Dynamic content unavailable in text export]

```mdx
<MathBlock latex="x = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a}" block />
```

### Summation

[Dynamic content unavailable in text export]

```mdx
<MathBlock latex="\sum_{i=1}^{n} i = \frac{n(n+1)}{2}" block />
```

### Matrix

[Dynamic content unavailable in text export]

```mdx
<MathBlock latex="\begin{bmatrix} a & b \\ c & d \end{bmatrix} \begin{bmatrix} x \\ y \end{bmatrix} = \begin{bmatrix} ax + by \\ cx + dy \end{bmatrix}" block />
```