LaTeX error: \begin{…} on input line … ended by \end{…}
Environments nest like parentheses: the last one opened must be the first one closed. This error names the environment that is still open, the line where it began, and the \end that arrived out of order.
! LaTeX Error: \begin{itemize} on input line 3 ended by \end{document}.
Try it: this example has the error
Press Fix it in the error box, and it compiles to a PDF. What pdfTeX printed for it:
! LaTeX Error: \begin{itemize} on input line 3 ended by \end{document}.
See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...
l.8 \end{document}
Ready. Press Compile (or Ctrl/Cmd + Enter).
Common causes
- A missing
\end{itemize},\end{figure}, or\end{tabular}. - Two environments closed in the wrong order, such as
\end{figure}before\end{center}. - A typo in the
\endname (\end{itemise}after\begin{itemize}).
How to fix it
- Go to the line number in the message and find where that environment should end.
- Add the missing
\end{…}there, or swap the two\endlines into the right order. - TeXpad shows the open environment and offers to insert its
\endin the right place.