Write the LaTeX.See the formula.
DotMD draws the LaTeX in your Markdown files as real formulas, on your Mac and without a connection. Here is the syntax, a cheat sheet and what to do about dollar signs.
macOS 14 or later. Reading is free; editing and reviews are one payment.
Quick answer
DotMD renders LaTeX in Markdown with KaTeX, offline: $…$ inside a line, $$…$$ on its own line. Prices like "$5 and $10" stay text. Formulas appear in the reader, the live preview, Quick Look and PDF export.
Inline and display formulas
Wrap a formula in single dollar signs to put it inside a line of text, or in double dollar signs to centre it on a line of its own.
| You type | Where it shows |
|---|---|
$E = mc^2$ | inside the line |
$$ … $$ | centred, on its own line |
A complete example:
The area of a circle is $A = \pi r^2$.
$$
\int_0^1 x^2\,dx = \frac{1}{3}
$$
Open the file in DotMD and the first line shows a small formula inside the sentence, and the integral appears centred below it.
LaTeX cheat sheet
The commands you will use most, as you type them:
| For | You type |
|---|---|
| Powers and indices | x^2, x_i, x_{i+1}^{2n} |
| Fractions | \frac{a}{b} |
| Roots | \sqrt{x}, \sqrt[3]{x} |
| Sums and products | \sum_{i=1}^{n} i, \prod_{k=1}^{n} k |
| Integrals and limits | \int_a^b f(x)\,dx, \lim_{x \to 0} \frac{\sin x}{x} |
| Greek letters | \alpha, \beta, \gamma, \pi, \Omega |
| Comparison and operators | \le, \ge, \ne, \approx, \pm, \times |
| Sets | \in, \subset, \cup, \cap, \infty |
| Arrows | \to, \Rightarrow, \iff |
| Accents | \vec{v}, \hat{x}, \bar{y} |
| Special letters | \mathbb{R}, \mathcal{L} |
| Text inside a formula | \text{if } x > 0 |
| Brackets that grow | \left( \frac{a}{b} \right) |
For several lines, use aligned inside a $$ block, and \\ to end a line:
$$
\begin{aligned}
(a + b)^2 &= a^2 + 2ab + b^2 \\
(a - b)^2 &= a^2 - 2ab + b^2
\end{aligned}
$$
Matrices use pmatrix for round brackets, bmatrix for square ones and vmatrix for a determinant, and cases gives a formula with conditions. The full list of supported commands is on katex.org.
Dollar signs that are not math
Prices are safe. In "$5 and $10" nothing is turned into a formula, because the dollar sign of a formula cannot be followed by a digit, and cannot be preceded by a space on the inside. Anywhere else, write \$ for a literal dollar sign.
Where the formulas show
- In the reader, when you open the file.
- In the editor's live preview, redrawn as you type. Insert → Formula and Insert → Inline Formula start one for you.
- In Quick Look, when you press Space on the file in Finder: Quick Look.
- In PDF, from Export as PDF…: Markdown to PDF. An exported HTML file loads KaTeX from the internet when you open it.
Does GitHub render it too?
Yes. GitHub supports the same $…$ and $$…$$ delimiters, and a code block marked math as well. A README or a spec written with formulas looks right in DotMD and on GitHub.
Matrices and conditions
Larger formulas work the same way. A matrix and a formula with two cases, in one block:
$$
A = \begin{pmatrix} 1 & 2 \\ 3 & 4 \end{pmatrix}
\qquad
|x| = \begin{cases} x & x \ge 0 \\ -x & x < 0 \end{cases}
$$
If a formula does not draw, check the braces first: every { needs its }. A formula with a mistake in it is shown as red text instead of breaking the page, so you can see which one to fix. You can write formulas in a README, a spec, a lecture note or a plan an AI agent wrote, and read them all the same way.
Questions about math in Markdown
Does it work offline?
Yes. KaTeX is built into DotMD, so formulas are drawn on your Mac with no internet connection. Only an exported HTML file loads it from the internet.
Is it free?
Yes. Reading Markdown with formulas is free. Editing with a live preview is part of DotMD Editor; see pricing.
Can I number equations?
Yes, in a $$ block. Add \tag{1} inside it and the equation gets the number (1). \tag works only in display formulas, not inline ones.
Does GitHub render the same syntax?
Yes. GitHub also renders $…$ and $$…$$, so a README with formulas reads the same there.