Math Equations

Write LaTeX in shadcn-docs-nuxt.

Install Plugins

npm
pnpm
bun
yarn
npm i -D remark-math rehype-katex

Add Plugins to Nuxt Config

nuxt.config.ts
export default defineNuxtConfig({
  devtools: { enabled: true },
  extends: ['shadcn-docs-nuxt'],
  css: [
    'katex/dist/katex.min.css',
  ],
  content: {
    markdown: {
      remarkPlugins: [
        'remark-math',
      ],
      rehypePlugins: {
        'rehype-katex': {
          output: 'html',
        },
      },
    },
  },
});

Write LaTeX

#### Inline
$E = mc^2$

#### Centered
When $a \ne 0$, there are two solutions to $(ax^2 + bx + c = 0)$ and they are
$$ x = {-b \pm \sqrt{b^2-4ac} \over 2a} $$

#### Math Block
```math
L = \frac{1}{2} \rho v^2 S C_L
```