Consider the following LaTeX document that starts with an Arara script consisting of a single directive that is spread across 5 lines.

% arara: halt if
% arara: --> exists(toFile('arara.file.temp'))
% arara: --> && (writeToFile('arara.var.doesTempExist', 't', false) || true)
% arara: --> ||
% arara: --> writeToFile('arara.var.doesTempExist', 'f', false)
Hello, world!

The intention behind the script is for it to check whether a file named arara.file.temp exists. If so, the string t should be written to the file arara.var.doesTempExist. If not, the string f should be written to the same file.

The directive halt is described on p. 113 of the Arara user guide (v. 4.0), the method exists is described on p. 61, the method toFile is described on p. 59, and the method writeToFile is described on p. 66 (mind that it is said to return a boolean and never to raise an exception).

When I run this script by executing arara test2 from the command line (the document is in a file called test2.tex), the following error message is reported.

For whatever reason, I could not compile the expression in the
provided conditional. 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: null pointer or function not found: writeToFile]
[Near :
{... false) || true) || writeToFile('arara.var.doesTem ....}]

[Line: 1, Column: 105]

Why do I get the error? How can I fix it?


Note that next to the writeToFile signature in the user guide, there's an R indicator. Compare this to the CR indicators next to the exists signature. C indicates that the method can be used in directives, whereas R indicates the method can be used in rules (see the introduction to chapter 6, p. 58). Since there is no C next to writeToFile, this method can't be used in directives.

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.