Math Equations
Write LaTeX in shadcn-docs-nuxt.
Install Plugins
npm
pnpm
bun
yarn
npm i -D remark-math rehype-katex
pnpm i -D remark-math rehype-katex
bun add -d remark-math rehype-katex
yarn add -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
```
Install Plugins
npm
pnpm
bun
yarn
npm i -D remark-math rehype-mathjax
pnpm i -D remark-math rehype-mathjax
bun add -d remark-math rehype-mathjax
yarn add -D remark-math rehype-mathjax
Add Plugins to Nuxt Config
nuxt.config.ts
export default defineNuxtConfig({
devtools: { enabled: true },
extends: ['shadcn-docs-nuxt'],
content: {
markdown: {
remarkPlugins: [
'remark-math',
],
rehypePlugins: [
'rehype-mathjax',
],
},
},
});
Write LaTeX
$E = mc^2$
$$
E = mc^2
$$
```math
E = mc^2
```