MathLayout.astro
Page layout with KaTeX CSS and section navigation. Use for any math page or blog template.
KaTeX + Astro
A complete reference for publishing mathematical notation on the web. KaTeX renders LaTeX at build time with no client-side JavaScript — fast, accessible, and beautiful.
Quick start
npm install katex remark-math rehype-katex astro.config.mjs:
import remarkMath from 'remark-math';
import rehypeKatex from 'rehype-katex';
export default defineConfig({
markdown: {
remarkPlugins: [remarkMath],
rehypePlugins: [rehypeKatex],
},
}); MathLayout.astro or add
KatexHead.astro to your layout:
---
import KatexHead from '../components/math/KatexHead.astro';
---
<KatexHead slot="head" /> $...$ for inline and $$...$$ for display math,
or use the <Math /> component in .astro files.
Included components
MathLayout.astroPage layout with KaTeX CSS and section navigation. Use for any math page or blog template.
Math.astro
Renders arbitrary LaTeX at build time. Pass tex and optional display prop.
MathComparison.astroSide-by-side source and rendered output — ideal for tutorials showing Markdown syntax next to the final math.
KatexHead.astroMinimal head fragment that imports KaTeX styles. Drop into any existing layout.
On this site
This section lives at airomatic.ai/math as part of the main Airomatic site. Browse the formula gallery, the Markdown comparison, or read The Beauty of Mathematics.