Below are some examples of LaTeX error messages and sample code which causes them. Two of each have the same or similar error messages.
Error message | Cause of the error | |
---|---|---|
1 |
! LaTeX Error: There's no line here to end. See the LaTeX manual or LaTeX Companion for explanation. |
% Wrong \begin{description} \item[Very long label] \\ Text... \end{description} % Right \begin{description} \item[Long label] \hspace*{\fill} \\ ext... \end{description} |
2 |
% Wrong \begin{center} First (heading) line\\ \\ body of the centred text... \end{center} % Right \begin{center} First (heading) line\\[\baselineskip] body of the centred text... \end{center} |
|
3 |
! Argument of \@sect has an extra } |
% Wrong \section{Mumble\footnote{just another example}} % Right \section{Mumble\protect\footnote{just another example}} |
4 |
! Argument of \@caption has an extra }. |
\newcommand{\aproc}[1]% {\begingroup \raggedright \typeout{-->#1<--}% \endgroup}% \begin{document} \section{Introduction} \aproc{ClearDoc} \aproc{Clear\\Doc} % ERROR here \end{document} |
5 |
! Extra alignment tab has been changed to \cr |
% Wrong \begin{tabular}{ll} hello & there & jim \\ goodbye & now \end{tabular} % Right \begin{tabular}{lll} hello & there & jim \\ goodbye & now \end{tabular} |
6 |
% Wrong \begin{tabular}{lll} \cline{1-4} % Column number too big hello & there \\ goodbye & now \end{tabular} % Right \begin{tabular}{lll} \cline{1-3} hello & there \\ goodbye & now \end{tabular} |
|
7 |
! Missing number treated as zero |
% Wrong /* Text \\ [abcd] Sentence continued. \\ */ % Right /* Text \\ {[abcd]} Sentence Continued. \\ */ |
8 |
! Missing * at the end of the line |
% Wrong /* C-language comment\\ */ % Right /* C-language comment\\ {*}/ |