Skip to content
✨ Publier v1 is live — a polished docs platform built for the open web.
On this page

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:

astro.config.ts
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 E=mc2E = mc^2.

∫0∞e−x2 dx=π2\int_0^\infty e^{-x^2} \, dx = \frac{\sqrt{\pi}}{2}

KaTeX reference

See the KaTeX supported functions for the full list of supported LaTeX commands.