# Kill pdflatex upon error in TeXworks using Arara

My question is based on another: Make arara close pdflatex upon error

I'm looking for a way to automatically kill the pdflatex process if Arara, used within TeXworks, stumbles upon an error. Right now it doesn't: Arara seems to stop (green button turns red) but there's still a pdflatex process going on. Therefore, .aux-files are 'in use' and to remove them, I have to manually kill the process. Such a hassle.

In the question mentioned above, someone complained of the same issue. However, the accepted answer in the earlier question is to make Arara run in nonstopmode. I don't want that because 1) it wastes time and 2) it's easy to overlook errors this way.

I tried to to use the method suggested in a second, non-accepted answer of @egreg. It included a MWE:

% arara: pdflatex: { options: '-halt-on-error'}
% arara: bibtex
% arara: pdflatex

\documentclass{article}

\begin{document}

\ERROR

\end{document}


Unfortunately, it does not work for me. I get an error:

I have spotted an error in rule 'pdflatex' located at 'C:\Users\***\AppData\Roaming\MiKTeX\2.9\scripts\arara\rules'. I could not evaluate the flag expression of one of the arguments. This part is quite tricky, since it involves aspects of the underlying expression language. I will do my best to help you in any way I can. There are more details available on this exception:

DETAILS --------------------------------------------------------- [Error: throwError('I was expecting a list of options.'): I was expecting a list of options.] [Near : {... @{ ....}]

And I can't seem to find any information on the particular '-halt-on-error' option anywhere in the Arara documentation. Would anyone known how to make this option work, or another way to make Arara kill the pdflatex process immediately once it encounters an error?

• The options argument requires a list (delimited with square brackets) so the first line should be % arara: pdflatex: { options: [-halt-on-error]} Nov 7 '18 at 16:32
• I knew it had to be something really stupid! Already tried curled brackets, missed the squared ones. Works perfectly fine now, and the pdflatex process is indeed killed upon any error. If your comment had been an answer I would accept it. :)
– Loes
Nov 7 '18 at 18:19

The options argument requires a list (delimited with square brackets) so the first line should be

% arara: pdflatex: { options: [-halt-on-error]}


Other options can be included as a comma-separated list. For example:

% arara: pdflatex: { options: [ -halt-on-error, -file-line-error ]}


Remember that you need to repeat the options for the second pdflatex line:

% arara: pdflatex: { options: [-halt-on-error]}
% arara: bibtex
% arara: pdflatex: { options: [-halt-on-error]}