Skip to Content
Nextra 2 Alpha

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:

next.config.mjs
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

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

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

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

Last updated on