---
title: Math & LaTeX
description: Render math expressions and equations with KaTeX and LaTeX syntax. Requires styling.latex set to true in docs.json.
---

> **For AI agents:** the complete documentation index is at [llms.txt](/docs/llms.txt). Append `.md` to any page URL for its markdown version.

Jamdesk supports LaTeX for rendering mathematical expressions and equations using [KaTeX](https://katex.org/).

<Note>
Math support requires `styling.latex: true` in your `docs.json` file.
</Note>

## Enable Math Support

Add to your `docs.json`:

```json docs.json
{
  "styling": {
    "latex": true
  }
}
```

## Inline Math

Use single dollar signs for inline equations:

```md
The Pythagorean theorem states that $a^2 + b^2 = c^2$.
```

**Renders as:** The Pythagorean theorem states that $a^2 + b^2 = c^2$.

## Block Equations

Use double dollar signs for centered, display-style equations:

```md
$$
E = mc^2
$$
```

**Renders as:**

$$
E = mc^2
$$

## Complex Equations

KaTeX supports a wide range of LaTeX notation:

### Fractions

```md
$$
\frac{n!}{k!(n-k)!} = \binom{n}{k}
$$
```

### Integrals

```md
$$
\int_0^\infty e^{-x^2} dx = \frac{\sqrt{\pi}}{2}
$$
```

### Summations

```md
$$
\sum_{i=1}^{n} i = \frac{n(n+1)}{2}
$$
```

### Matrices

```md
$$
\begin{bmatrix}
a & b \\
c & d
\end{bmatrix}
$$
```

## Using the Latex Component

For more control, use the `<Latex>` component directly:

```mdx
<Latex>E = mc^2</Latex>
```

For block/display mode:

```mdx
<Latex block>
\int_0^\infty e^{-x^2} dx = \frac{\sqrt{\pi}}{2}
</Latex>
```

## Code Blocks Are Protected

Dollar signs inside code blocks are **not** treated as math:

```bash
echo $HOME
export PRICE=$100
```

This renders as normal code, not equations.

## Supported Commands

KaTeX supports most common LaTeX math commands. See the [KaTeX documentation](https://katex.org/docs/supported.html) for a complete list of supported functions.

<Tip>
For complex equations, test your LaTeX on [KaTeX's demo page](https://katex.org/) first.
</Tip>

## What's Next?

<Columns cols={2}>
  <Card title="SEO Optimization" icon="magnifying-glass-chart" href="/content/seo">
    Improve discovery and metadata
  </Card>
  <Card title="Frontmatter" icon="file-lines" href="/content/frontmatter">
    Define titles, descriptions, and SEO fields
  </Card>
</Columns>
