Skip to main content

Math Equations in Confluence: LaTeX & KaTeX via Markdown

· 5 min read

Ask an engineer to document an algorithm in Confluence and watch what happens to the math: O(n log n) typed as plain text, pasted from a character map, and — for anything real — a screenshot from an online equation editor, blurry and already out of date. Confluence has no native LaTeX support, so every formula becomes either a compromise or an image.

It does not have to. With a Markdown macro on the page, Confluence renders real LaTeX — inline $...$, display $$...$$, fenced blocks with full align environments — and the equation stays text: searchable, theme-consistent, editable in seconds. This guide gives you the syntax and copy-paste examples for all three routes.

Quick answer: To write math in Confluence, install Enhanced Markdown for Confluence and use its Markdown macro. Inline math goes in $...$, display equations in $$...$$, and fenced blocks — ```katex for fast CSS rendering or ```math for full LaTeX via bundled MathJax, including \begin{align} and AMS packages. All examples below are copy-paste ready. Free for up to 10 users.

Why Equations-as-Images Fails Engineering Docs

A screenshot of a formula is where documentation goes to die:

  • It is not text. Search cannot find it, an AI assistant summarizing the space cannot read it, and a copy-paste into a ticket loses it.
  • It is instantly stale. The doc changes, the screenshot does not. Nobody re-runs the export toolchain for a sign flip.
  • It looks wrong. Different sizes, different fonts, white boxes on dark theme — every one a small tax on the reader's trust.

Rendered math fixes all three at once, because it is typeset text. The formula participates in the page — it inherits the theme, it edits like everything else, and grep-style tools (and LLMs) can see it.

Inline Math — the $...$ Workhorse

Anything you would set in prose goes in single dollars. Here is a real spec sentence — paste it into the macro:

The p95 latency SLO is $300\,\text{ms}$ at the edge. The retry budget is
$2n + 1$ attempts per request, and the scheduler stays $O(n \log n)$
with $k$ workers.

Inline math typesets everywhere Markdown flows — sentences, table cells, list items, even headings. That last part is the spec-doc unlock: a requirements table can carry $O(n \log n)$ or $p < 0.05$ beside the prose with no images and no alignment hacks.

Display Equations — $$...$$ for the One That Matters

When the equation is the paragraph, double dollars center it. Say your section explains an availability SLO and what it implies:

A 99.9% availability SLO over a 30-day month allows

$$
2{,}592{,}000\,\text{s} \times (1 - 0.999) = 43.2\,\text{min}
$$

of total downtime — everything else in the section is about spending it well.

That paragraph renders as:

Display equation rendered in Confluence: a 99.9% SLO allows 43.2 minutes of downtime per month

Use display math for the one formula a section exists to explain, and keep it rare — a page where every line is a display equation reads like a textbook, not a spec.

Fenced Blocks — KaTeX for Speed, MathJax for Full LaTeX

For multi-line work, the macro takes fenced blocks, and the fence keyword chooses the engine:

FenceEngineUse when
```katexKaTeX (CSS-based)Instant rendering, everyday equations
```math / ```tex / ```latexMathJax (bundled, no CDN)Full LaTeX grammar — align, AMS packages, exotic symbols

The aligned derivation is the workhorse: an error-budget check after an incident. Paste this into a ```math fence:

\begin{align}
\text{monthly budget} &= 43.2\,\text{min} \quad (99.9\%\ \text{SLO}) \\
\text{Sep 18 outage} &= -31.6\,\text{min} \\
\text{remaining} &= 43.2 - 31.6 = 11.6\,\text{min} \\
\text{budget left} &\approx 27\% \;\Rightarrow\; \text{freeze risky deploys}
\end{align}

And here is that block rendered on the page:

Aligned derivation rendered in Confluence: error budget after an outage, ending at a deploy freeze

Every step on its own row, the relations running down one column — the derivation reads top-to-bottom like a whiteboard photo taken by someone organized. Swap in your own SLO numbers and it edits in plain text — no re-exporting anything when the outage math changes.

Copy-Paste Starter Kit

Three patterns that cover most engineering docs:

SLO bound in a sentence (inline): Error rate stays below $0.1\%$ while the burn rate is $< 2\times$.

Model quality (KaTeX fence) — precision and F1 for an eval report:

P = \frac{TP}{TP + FP} \qquad
F_1 = \frac{2 \cdot P \cdot R}{P + R}

Precision and F1 formulas rendered in Confluence

Aligned derivation (MathJax fence): the error-budget block above — swap in your own numbers.

All three survive copy-paste between pages, which is more than any screenshot can say.

Which Route for Which Equation?

NeedSyntaxRenders via
Symbol in a sentence, table cell, or heading$...$KaTeX inline
The one centered formula of a section$$...$$KaTeX display
Multi-line derivation with aligned operators```math + alignMathJax
Quick common equations, fastest render```katexKaTeX

The pattern to remember: dollars for prose, fences for blocks, katex for speed, math for the full LaTeX grammar. Install Enhanced Markdown for Confluence, paste the align example into your next spec, and retire the screenshot pipeline.

Try Enhanced Markdown for Confluence

Write Markdown with live split preview, Mermaid diagrams, KaTeX/LaTeX math, and 190+ code languages — all in one macro, free for up to 10 users.

Get it on the Atlassian Marketplace