LaTeX Error: Bad math environment delimiter.

\[ or \( was used inside maths, or \] or \) without its opening. Close one formula before opening the next, and pair each delimiter.

Help centre › LaTeX errors › Maths · Error: the build stops or the output is wrong

What the log says

! LaTeX Error: Bad math environment delimiter.

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
l.4 \[

What it means

LaTeX's maths delimiters check the mode they are used in: \( and \[ may only start maths from text, and \) and \] may only end the matching kind of maths. One of them appeared in the wrong place, typically a display opened inside an equation that is already maths, or a closing delimiter with no opening one.

Causes and fixes

Most common first. Each example is a complete document; the first fails with this message, the second is the same document fixed.

1. \[ … \] inside an equation environment

An equation, align or $ … $ is already maths, so \[ inside it is an error. Remove the inner \[ and \].

Fails
\documentclass{article}
\begin{document}
\begin{equation}
\[ a = b \]
\end{equation}
\end{document}
Fixed
\documentclass{article}
\begin{document}
\begin{equation}
a = b
\end{equation}
\end{document}

2. Mismatched opening and closing delimiters

\[ must be closed by \], \( by \), and $ by $. A display opened with \[ and closed with \) is reported here.

Fails
\documentclass{article}
\begin{document}
\[ a = b \)
\end{document}
Fixed
\documentclass{article}
\begin{document}
\[ a = b \]
\end{document}

3. A closing \] or \) with no opening

Usually the opening delimiter was deleted or commented out. Restore it or remove the stray closing one.

Fails
\documentclass{article}
\begin{document}
The value is a = b\) in this case.
\end{document}
Fixed
\documentclass{article}
\begin{document}
The value is \(a = b\) in this case.
\end{document}

In Manulyx

The editor shows the error beside the line with an explanation, and the compile log is parsed into a list of problems.

Write in Manulyx for free · Journal templates

More in maths

  • Double subscript.Two _ (or two ^) apply to the same symbol, as in x_i_j. Group them with braces: x_{i_j} or x_{ij}, x^{2^3} or {x^2}^3.
  • Missing \right. inserted.A \left has no matching \right in the same formula or line, or a \right has no \left. Pair them, or use \right. / \left. as invisible partners.

Every example on this page was compiled with pdfLaTeX to check that it fails and is fixed as described. All LaTeX errors