Recovering from errors

If LaTeX finds an error in your document then it gives you an error message and prompts you with a question mark, ?. For instance, running LaTeX on this file

\newcommand{\NP}{\ensuremath{\textbf{NP}}}
The \PN{} problem is a million dollar one.

causes it show this, and wait for input.

! Undefined control sequence.
l.5 The \PN
           {} problem is a million dollar one.
? 

The simplest thing is to enter x and RETURN and fix the typo. You could instead enter ? and RETURN to see other options.

There are two other error scenarios. The first is that you forgot to include the \end{document} or misspelled it. In this case LaTeX gives you a ‘*’ prompt. You can get back to the command line by typing \stop and RETURN.

The last scenario is that you mistyped the filename. For instance, instead of pdflatex test you might type pdflatex tste.

! I can't find file `tste'.
<*> tste
        
(Press Enter to retry, or Control-D to exit)
Please type another input file name:

The simplest thing is to enter CTRL d (holding the Control and d keys down at the same time), and then retype the correct command line.

© 2007–2018 Karl Berry
Public Domain Software
http://latexref.xyz/Recovering-from-errors.html