Skip to content

Mathematics

Math uses standard LaTeX notation — no Keystone-specific syntax. Wrap inline math in single dollar signs, and display math (set off on its own centered line) in double dollar signs:

The mass–energy equivalence is $E = mc^2$.

$$\int_{0}^{1} x^2 \, dx = \frac{1}{3}$$

Use the dollar-sign delimiters — Keystone doesn't recognize the \(…\) and \[…\] shorthands and passes them through as literal text.

Fractions, integrals, sums, roots, Greek letters, subscripts and superscripts — the usual notation works.

How each format renders math

Format Rendering
PDF Typeset by XeLaTeX with amsmath — the same engine and quality as a native LaTeX document.
DOCX Native Word equations (OMML) — live and editable in Word's equation editor.
ODT Native LibreOffice formula objects — live and editable.
EPUB MathML embedded in the page, with the original LaTeX kept as a fallback.

PDF is the most complete: anything XeLaTeX and amsmath can typeset will render. The other formats convert your math through a translator that handles a broad — but not complete — slice of LaTeX, so a few constructs that typeset in PDF don't carry over. Sticking to standard notation keeps an equation working everywhere.

Writing portable math

Structured math works too — fractions over stacked rows, aligned steps, matrices. Compose them from the standard building blocks:

$$
\frac{
  \begin{array}{r}
    \left( x_1 x_2 \right)\\
    \times \left( x'_1 x'_2 \right)
  \end{array}
}{
  \left( y_1 y_2 y_3 y_4 \right)
}
$$

Two habits keep an equation converting cleanly into every format:

  • Don't wrap math in extra environments. $$…$$ is already display math, so there's no need for \begin{equation} or \[ … \] inside it — and not every such wrapper survives the conversion. References written for LaTeX documents often suggest them; you don't need them here.
  • Drop optional positioning arguments — write \begin{array}{r}, not \begin{array}[b]{r} (details below).

If a construct doesn't convert, Keystone stops the build and names the offending equation rather than letting raw LaTeX leak into the output — so you find out at publish time, not from a reader. Pare the equation back to standard notation and rebuild. (PDF still renders it exactly as written.)

Optional positioning arguments

In \begin{array}[pos]{cols}, the {cols} column spec is required; the [pos] argument — [t], [c], or [b] — is optional and only sets where the array meets the surrounding line (its top, centre, or bottom row on the baseline; centred by default). It typesets in PDF, but the converter doesn't implement it, so it won't render in the other formats. Inside a fraction — where it most often turns up — it rarely changes anything, so drop it.

EPUB reader support

How well an EPUB equation displays depends on the reading app, because MathML — the e-book standard Keystone uses — has uneven support:

  • Renders well — Apple Books, and any reader built on a current browser engine.
  • Limited or none — Kindle (its formats don't support MathML) and some older e-ink devices.

Keystone stores the original LaTeX alongside the MathML, so a reader that can't render the markup falls back to the source rather than showing nothing.

When every EPUB reader must show your equations

If your audience includes Kindle or older devices and the equations are essential, you can render them yourself as images and include them with an epub-only block — an image displays anywhere a reader can show a picture. It's manual work, worth it only when universal coverage outweighs the effort. For most books, MathML is the better default.