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
  │ 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 "["
  │ …
  These equations are valid LaTeX and typeset in PDF, but they 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.
  See https://keystone.knight-owl.dev/errors/unconvertible-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 lines behind the │ bar are Pandoc's own, reproduced as it wrote them: 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.

Rewrite it in the portable subset

For the example above, drop the [b]. Writing portable math covers which constructs convert and which don't.

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