Skip to content

Math that can't convert

An equation can be valid LaTeX yet use a construct your target format's math engine doesn't support. Rather than leak raw TeX into the book, Keystone stops and points at the exact spot.

What it looks like

$$\begin{array}[b]{r} a \\ b \end{array}$$
ERROR: 1 equation(s) cannot be converted for epub output.

These equations are valid LaTeX — they typeset in PDF — but use constructs
Pandoc's math converter does not support, so they would leak into the
output as raw TeX. Simplify each to standard notation, then rebuild.

  1. Could not convert TeX math \begin{array}[b]{r} a \\ b \end{array}, rendering as TeX:
     \begin{array}[b]{r} a \\ b \end{array}
                  ^
     unexpected "["
     …

See https://keystone.knight-owl.dev/writing/math/#writing-portable-math

What it means

PDF typesets LaTeX directly, so it accepts almost anything. EPUB, DOCX, and ODT convert math through Pandoc's converter, which supports a large but not complete subset. The caret (^) marks the token the converter rejected — here the optional [b] positioning argument. This is fatal by design: a silent fallback would drop raw \begin{array}… into the reader's book.

How to fix

Rewrite the flagged construct in the portable subset — for the example above, drop the [b]:

$$\begin{array}{r} a \\ b \end{array}$$

Writing portable math covers which constructs convert and which don't.