Back to Nextra

LaTeX

examples/docs/src/content/features/latex.mdx

2.0.0-beta.6711 B
Original Source
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex/dist/katex.css" />

LaTeX

Nextra uses KaTeX to render LaTeX expressions directly in MDX. To enable LaTeX support, you must add the following to your next.config.mjs:

js
import nextra from 'nextra'

const withNextra = nextra({
  latex: true
})

export default withNextra()

Using LaTeX within MDX is as simple as wrapping your expression in $$ or $. For example, the following code

latex
$\sqrt{a^2 + b^2}$

will be rendered as: $\sqrt{a^2 + b^2}$

To learn more about KaTeX and its supported functions, visit their documentation.