---
title: "A Markdown editor with equations and PDF export, on the Mac"
author: Pedro Thomaz
source: https://coffeetext.app/blog/markdown-equations-pdf-export
---

# A Markdown editor with equations and PDF export, on the Mac

> Checked 28 November 2026 against the [pandoc manual](https://pandoc.org/MANUAL.html) and Coffee's own help. I make Coffee, so weigh what I say about it. Coffee isn't affiliated with pandoc.

To write equations in Markdown and export them to PDF on a Mac, you need an editor that reads LaTeX maths between `$` and `$$` marks, draws it while you write, and carries the drawn formulas into the PDF. Coffee does all three without a LaTeX install: you type `$$ \frac{a}{b} $$`, the formula appears in the note, and ⌘E exports a PDF with it set as you saw it. The other common route is pandoc with LaTeX, which is free and very capable but needs a large install and some setup.

This post covers what to look for, the TeX you'll use most, the two ways to get a PDF, and the problems that usually spoil one.

## What to look for in an editor for maths

- **Standard syntax.** `$…$` inside a sentence and `$$…$$` for a formula on its own. It's what GitHub, pandoc, Obsidian and most editors read, so your notes stay portable.
- **Drawn as you type.** Seeing the formula as you write catches a missing brace straight away, not at export time.
- **Everyday TeX covered.** Fractions, roots, sums and integrals with limits, matrices, cases and aligned lines. Anything less and you'll hit a wall in the first week.
- **Clear errors.** A formula that can't be drawn should say why, not vanish.
- **Exports that keep the maths.** PDF first, but Word and HTML matter too if you hand work to others.
- **Plain files.** The TeX stays in the `.md` file, so another editor, or pandoc later, can read it.

## The TeX you'll use most

Inline, in a sentence:

```
The area of the garden is $\pi r^2$.
```

On its own:

```
$$
x = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a}
$$
```

A few more that cover a lot of ground:

| You want | You write |
|---|---|
| Fraction | `\frac{a}{b}` |
| Root | `\sqrt{x}`, `\sqrt[3]{x}` |
| Sum with limits | `\sum_{i=1}^{n} i` |
| Integral | `\int_0^1 x^2 \, dx` |
| Greek | `\alpha`, `\beta`, `\Delta` |
| Sets | `\mathbb{R}`, `\in`, `\subseteq` |
| Brackets that grow | `\left( \frac{a}{b} \right)` |
| Words in maths | `\text{if } x > 0` |
| Matrix | `\begin{pmatrix} a & b \\ c & d \end{pmatrix}` |
| Cases | `\begin{cases} 1 & x > 0 \\ 0 & \text{otherwise} \end{cases}` |

[Writing maths in Markdown](https://coffeetext.app/blog/math-equations-in-markdown) goes through more, including the dollar-sign trap when you mean money.

## Two ways to get a PDF with equations

### pandoc and LaTeX

pandoc reads the same `$` syntax and sends the maths to LaTeX, which typesets it:

```
pandoc notes.md -o notes.pdf
```

The results are excellent, because LaTeX is the standard for maths. The costs are the install, which runs to gigabytes for a full TeX distribution, and the time spent on errors: one unknown command or a character the engine can't set, and you get an error instead of a PDF. pandoc's [manual](https://pandoc.org/MANUAL.html) lists the engines; `xelatex` and `lualatex` cope better with accented letters and symbols than the default.

You also write blind. Most editors that use pandoc show you the TeX, not the formula, until you run the export.

### An editor that sets maths itself

The other route is an editor that draws the formulas and makes the PDF itself. Coffee, which I make, works this way on the Mac:

1. Write the TeX between `$` or `$$` marks.
2. Move the caret away. A `$$` block shows only its formula until you click back into it, and inline maths is drawn in its sentence.
3. Press ⌘E, pick a template and a page size, and choose Export PDF.

[Markdown to PDF in Coffee](https://coffeetext.app/markdown-to-pdf) shows what the pages look like. Formulas are drawn natively, not by a web page, so there's nothing to wait for and no LaTeX to install. They carry into PDF, print, HTML, Word and EPUB. Maths works inside tables too.

Coffee covers everyday TeX: Greek letters, operators, scripts, fractions, roots, sums and integrals with limits, `\left` and `\right`, accents, `\text`, `\mathbb`, matrices, cases and aligned lines. Anything it can't read stays as TeX, and a formula that can't be drawn shows a plain hint with the line number. If you need a LaTeX package Coffee doesn't know, the note still has the TeX, and you can export LaTeX from the same menu and finish it with pandoc.

## Chemistry and numbered equations

For chemistry, write the reaction inside `\ce{}`:

```
$$
\ce{2H2 + O2 -> 2H2O} \tag{1}
$$
```

`\tag{1}` puts a number beside a display equation. In Coffee numbers are only ever written by hand, so `\tag{2}` is up to you. That's a deliberate trade: the number in the file is the number on the page, in any app.

## The look of the formulas

Coffee sets formulas in STIX Two by default. If you prefer the Computer Modern look of a LaTeX paper, choose Latin Modern under Maths in Settings › Look on the Mac, or Settings › Maths on iPhone and iPad. Only how the formulas look changes; the TeX in your notes stays the same.

The PDF template sets the rest: the body type, the margins, a title page, page numbers and the date. [Markdown to PDF with headers, footers and page numbers](https://coffeetext.app/blog/markdown-to-pdf-headers-footers-mac) shows what each template can do, and [the templates directory](https://coffeetext.app/templates) has layouts such as Journal paper, in two columns, and Cornell notes with a cue column.

## When the equations don't make it into the PDF

- **The PDF shows raw TeX.** On the web-page route, the page was printed before the maths script finished. Wait for the preview, or use an export that draws formulas itself. [Why a Markdown PDF export is blank](https://coffeetext.app/blog/why-is-my-markdown-pdf-blank) has the full list of causes.
- **A formula stays as code.** Check the fence: a block needs a line of `$$` above and below it, or `$$ … $$` on one line. Then look for an unmatched `{`.
- **Prices turn into maths.** `$5 and $10` can read as a formula in some editors. Write `\$5`, or keep prices away from a second dollar sign on the line.
- **The formula is too wide.** Break a long equation over lines with `aligned`, or move it to its own block.

## Where else it works

On iPhone and iPad, Coffee draws the same maths, with the same typeface choice, so lecture notes you write on the Mac read the same on the train. If you're taking notes in class, [lecture notes with maths in Markdown](https://coffeetext.app/blog/lecture-notes-maths-markdown) has a routine for keeping up, and [Coffee's help on maths](https://coffeetext.app/help/maths) lists everything it reads.

## Questions

### Can I export Markdown equations to PDF without installing LaTeX?

Yes, with an editor that sets the maths itself. Coffee draws formulas natively and puts them in the PDF as they look in the note, so nothing else needs installing.

### Which LaTeX maths does Coffee support?

Everyday TeX: Greek letters, operators, scripts, fractions, roots, sums and integrals with limits, `\left` and `\right`, accents, `\text`, `\mathbb`, matrices, cases and aligned lines, plus `\ce{}` for chemistry and `\tag{}` for numbers.

### Do equations carry into Word export?

In Coffee, yes. Formulas carry into PDF, print, HTML, Word and EPUB.

### Can I still use pandoc later?

Yes. The TeX stays in the Markdown file, so pandoc reads the same note. Coffee can also export LaTeX.

### Why does my formula show as code instead of being drawn?

Usually a missing `$$` line or an unmatched brace. In Coffee, a formula that can't be drawn shows a hint with its line number.

---

Written by Pedro Thomaz, who makes Coffee, a Markdown editor for the Mac on macOS 15 or later, and for iPhone and iPad. It's free for 14 days with no card or account, then €3 a month, €29 a year, or €79 once with two years of updates. More at https://coffeetext.app/llms-full.txt
