When pdflatex can't compile a file, it drops me to a prompt. I've never used it and always try to get away from there as quickly as possible, usually generating a q.log file in the process.

Is there any way to avoid this behavior and let pdflatex drop back to command-line on error?

  • 3
    Perhaps the answers to this question: Ignore compile errors will help.
    – Alan Munn
    Commented Mar 13, 2011 at 17:01
  • 1
    @Alan: Thanks. -halt-on-error (your link) and -interaction=nonstopmode (Martin Scharrer) seems to be what I'm looking for.
    – Tim N
    Commented Mar 13, 2011 at 17:05
  • 1
    Yes, -halt-on-error exits on error. Exactly what I'm after. Ignoring or not printing errors is not helpful. Especially when make then thinks everything's up to date. I've never used the interactive thing. Imo shouldn't be default.
    – jozxyqk
    Commented Feb 15, 2014 at 11:53
  • 1
    I don't believe I've ever had a meaningful interaction with latex when it has halted on an error. I'm sure there is much I could do, but I always ^d, modify source, and compile again. Commented May 1, 2020 at 11:43

3 Answers 3


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
  • 1
    Took this information from the comments on the question. This is what simply worked for me. Commented Feb 17, 2014 at 17:50

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .