FormaTeX
FatalMath Mode

Bad Math Environment Delimiter

! LaTeX Error: Bad math environment delimiter.

What this error means

A display math delimiter (\[ or \]) was used in an invalid context — such as closing a display math block that was never opened, or opening display math inside inline math.

Common causes

  • A \] without a preceding \[ to open display math
  • A \[ inside an equation or align environment
  • Unbalanced or nested math delimiters

How to fix it

Ensure every \[ is paired with exactly one \]. Do not nest display math inside other math environments. Use \( and \) for inline math, \[ and \] for unnumbered display math, or \begin{equation} for numbered equations.

Code examples

Causes the error
\documentclass{article}
\begin{document}

\] x = 5 \[  % Delimiters in wrong order

\end{document}
Fixed
\documentclass{article}
\begin{document}

\[ x = 5 \]  % Correct order

\end{document}

Related errors

Test the fix live

Paste your LaTeX into the playground and compile instantly.

One quick thing

We track anonymous usage — page views, feature usage, compilation events — to understand what works and what doesn't. No ads, no personal data, no third-party sharing.

Cookie policy