LaTeX error · Math mode

Package amsmath Error: \begin{split} won't work here

Quick answer

split is not a display on its own: it only splits one equation into lines inside a math environment such as equation, equation* or gather. Used directly in text, or inside align where each line is already an equation, amsmath stops with this error. Wrap the split in \begin{equation} ... \end{equation}, or replace it with align if every line should be a separate equation.

The error in the log

This is how the message appears in the .log file (and in the compile output). The line starting with l. is the line number where TeX noticed the problem; the real mistake is there or just before it.

! Package amsmath Error: \begin{split} won't work here.

See the amsmath package documentation for explanation.
Type  H <return>  for immediate help.
 ...

l.6 \end{split}

Why it happens

  • \begin{split} written directly in the text, as if it were a display environment like align.
  • split placed inside align, multline or another environment that already handles line breaking.
  • split inside $...$ inline math, where amsmath does not allow it.

How to fix it

Put the split inside an equation environment. The whole block then gets one equation number, centred vertically, and the & in each line aligns the relation signs.

If you want a number on every line, you do not need split at all: use align directly.

Broken: reproduces the error

\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{split}
  (a+b)^2 &= a^2 + 2ab + b^2
\end{split}
\end{document}

Try this in Octree — free LaTeX editor with AI, compiles in your browser

Fixed: compiles cleanly

\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{equation}
\begin{split}
  (a+b)^2 &= (a+b)(a+b) \\
          &= a^2 + 2ab + b^2
\end{split}
\end{equation}
\end{document}

Related errors

Frequently Asked Questions

What is the difference between split and align?

align is a display environment in which every line is its own equation and gets its own number. split goes inside an equation and turns it into several lines that share a single number.

Can I use split without an equation number?

Yes. Put it inside equation* (or \[ ... \]) instead of equation. The split works the same way and no number is printed.

Does split work inside align?

No. align already splits lines and aligns them, so amsmath refuses a split inside it. Use aligned if you need a sub-block inside an align line.

Paste your document into Octree — compile errors get a Fix with AI button

When a compile fails, Octree shows the error next to the line that caused it and offers a one-click fix that you can review before applying. Free, nothing to install.

Fix it in Octree →