13

If my tex-files contain an error (such as an undefined control sequence), latexmk will present a prompt and ask for manual input before continuing. Now, of course it is possible to force further processing, e.g. as described here Don't make me manually abort a LaTeX compile when there's an error or here Make latexmk ignore errors and finish compiling.

However, in case of an error I would like Latexmk to stop processing completely and to return to the command line. Is there any way to accomplish this?

2
  • I have this in my .latexmkrc: $pdflatex = "pdflatex -synctex=1 -halt-on-error %O %S"; In my case I tend to use -pvc all the time, so here it just stops the compilation if there is an error and go back to waiting for change. You can also use the -interaction=... option. If I'm not mistaken you can also pass these on to pdflatex via latexmk CLI options.
    – daleif
    Jan 30, 2015 at 11:05
  • I'll convert it into an answer
    – daleif
    Jan 30, 2015 at 14:32

1 Answer 1

15

I have this in my .latexmkrc:

$pdflatex = "pdflatex -synctex=1 -halt-on-error %O %S"; 

In my case I tend to use -pvc all the time, so here it just stops the compilation if there is an error and go back to waiting for change. You can also use the -interaction=... option.

If I'm not mistaken you can also pass these on to pdflatex via latexmk CLI options

Reading latexmk --help you can actually use latexmk -halt-on-error directly

2
  • 1
    What do all the flags mean? Especially the "synctex", and the "%O" and "%S"?
    – muuh
    Jan 7, 2020 at 9:06
  • @muuh synctex is a feature used for reverse search communication, aka the ability to go from the PDF (in a suitable pdf viewer) to the corresponding source line in an editor. For the others see personal.psu.edu/jcc8//software/latexmk-jcc/latexmk-467.txt under "FORMAT OF COMMAND SPECIFICATIONS"
    – daleif
    Jan 7, 2020 at 9:20

You must log in to answer this question.

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