Math Equations
Render mathematical expressions using KaTeX — enabled via the Publier integration.
Math support renders LaTeX expressions via KaTeX. It is on by default.
Setup
There is nothing to install: @publier/shell ships remark-math, rehype-katex and katex, and docsShell() turns math on unless you pass math: false:
import tailwind from '@tailwindcss/vite';import { defineConfig } from 'astro/config';import { docsShell } from '@publier/shell/integration';
export default defineConfig({ integrations: [docsShell({ math: false })], // turns math off vite: { plugins: [tailwind()] },});If the math plugins cannot be loaded (for example after a broken install), Publier logs a warning instead of failing your build.
Usage
Inline math — wrap in single dollar signs:
The energy–mass equivalence is $E = mc^2$.Block math — wrap in double dollar signs on their own lines:
$$\int_0^\infty e^{-x^2} \, dx = \frac{\sqrt{\pi}}{2}$$Display result:
The energy–mass equivalence is .
KaTeX reference
See the KaTeX supported functions for the full list of supported LaTeX commands.