I am trying to compile a .tex file with pdflatex. The file isn't totally valid - but this isn't the point here. One line causes the compilation to fail : \RequirePackage{lastpage} causes the following error !LaTeX Error: file 'lastpage.sty' not found.

But the issue is that pdflatex asks me for a substitute file to use, rather than exiting.

Since the call to pdflatex is within some code, I don't want it to be hanging around waiting for some input when none will be provided. Therefore, I called pdflatex with the -halt-on-error option. But this didn't solve it, and pdflatex still expects an input.

Am I missing something with the -halt-on-error option?


Indeed, -halt-on-error doesn't stop at missing files. You can combine it with -interaction=nonstopmode, though, like in

pdflatex -halt-on-error -interaction=nonstopmode file

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.