Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I have bash script that generates several tex files when it is run and then uses latex and dvipdfm to generate a pdf file. The only problem I have is that when something fails latex will halt the process and ask for input on the errors. In this case I am generating more than one pdf and latex is called several times for each one. So I end up with the same errors several times and I have to mash through it.

Since this is being integrated into the build process for something else I would like to find a way to just let the script die with just a single message.

To recap I would like to have latex terminate when there is an error so that when people other than my self run this they are stuck trying to kill this script.

share|improve this question

1 Answer 1

up vote 10 down vote accepted

Call latex with the -halt-on-error option and the -interaction=nonstopmode option:

 latex -halt-on-error -interaction=nonstopmode file.tex
share|improve this answer
    
I am absolutely dumb founded that I didn't see this when looking at the latex command, that is exactly what I was looking for. Thanks! –  Tarmon Aug 18 '11 at 20:28
3  
Actually I would do -interaction=nonstopmode -halt-on-error or -interaction=batchmode -halt-on-error. Using -halt-on-error by itself will still pause for user input in certain situations, such as a missing package. –  frabjous Aug 18 '11 at 21:14
    
@frabjous Good point, updated my answer accordingly. –  N.N. Aug 18 '11 at 22:16
3  
An alternative (on UNIX-like machines) is to force LaTeX to read from /dev/null: latex file_name < /dev/null. When LaTeX asks /dev/null to answer some inane question, /dev/null nicely responds with EOF, and LaTeX in turn dies with "Emergency stop!" (and gives a non-zero status to boot, which is very nice for makefiles). –  David Hammen Aug 19 '11 at 1:19

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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