How to disable the prompt on error?

Use the -interaction=nonstopmode command line argument or the \nonstopmode macro to disable stopping on errors.

Example: pdflatex -interaction=nonstopmode your.tex (note the -interaction flag before the filenames).


-interaction <mode>
    Starts the so-called interaction mode, which can be specified as
    batchmode, nonstopmode, scrollmode or errorstopmode. The meaning of
    these options is the same as for that of the corresponding \commands.

Which is to say that placing \batchmode as the first line in your document would have the same effect.

If you didn’t know about those commands, here’s what they do (from TeX usage tips):

The modes make TeX behave in the following way:

  • errorstopmode stops on all errors, whether they are about errors in the source code or non-existent files.

  • scrollmode doesn't stop on errors in the source but requests input when a more serious error like like a missing file occurs.

  • In the somewhat misnamed nonstopmode, TeX does not request input after serious errors but stops altogether.

  • batchmode prevents all output in addition to that (intended for use in automated scripts). In all cases, all errors are written to the log file (yourtexfile.log).


To drop back to the command line on the first error like gcc (or other compilers do), use:

pdflatex -halt-on-error yourfile.tex