Display math should end with $$.

A displayed equation was closed with a single $ or a $ appeared inside it. Use \[ … \] or an equation environment, and no $ inside.

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

What the log says

! Display math should end with $$.
<to be read again>
                   y
l.4 x = $y
           + 1$

What it means

Inside displayed maths ($$ … $$, \[ … \], equation and similar), TeX met a single $. A lone $ there is read as an attempt to end the display, and a display must end with $$ (which \] and \end{equation} produce for you). Usually the $ should not be there at all.

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. A $ inside an equation environment

An equation, align or \[ … \] is already maths: remove the $ signs inside it. For words inside the display, use \text{…} from amsmath.

Fails
\documentclass{article}
\begin{document}
\begin{equation}
x = $y + 1$
\end{equation}
\end{document}
Fixed
\documentclass{article}
\begin{document}
\begin{equation}
x = y + 1
\end{equation}
\end{document}

2. A display opened with $$ and closed with one $

Close it with $$; better, use \[ … \], which is the LaTeX form and checks its own pairing.

Fails
\documentclass{article}
\begin{document}
$$ E = mc^2 $
Text.
\end{document}
Fixed
\documentclass{article}
\begin{document}
\[ E = mc^2 \]
Text.
\end{document}

3. A blank line inside a display

A paragraph break inside \[ … \] or equation forces TeX out of the display, and it complains here or with Missing $ inserted. Remove the empty line.

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