1

I've just started using arara and I'm trying to write a custom rule that would allow me to compile documents without a preamble (by using a separate preamble template).

This is my first attempt:

!config
identifier: myrule
name: MyRule
commands:
    - cat preamble.tex "@{file}" | pdflatex
arguments: []

When I try to use it, however, I get this:

cat: |: No such file or directory
cat: pdflatex: No such file or directory
FAILURE

So it seems like the pipe character and the pdflatex command are being passed as arguments to cat, instead of the cat output being redirected to pdflatex (as when I run something like cat preamble.tex file.tex | pdflatex from the command line, for instance).

So is there a way to make the command redirection work with arara?

  • 1
    You can always put it in a script and run the script. – cfr May 31 '18 at 23:51
  • @cfr Ah, I should have thought of that, haha. 🤦🏻‍♂️ It works, thanks! I'm still curious if it's possible to do it directly in the rule, though, in case anybody has any insights on that... – dbmrq Jun 1 '18 at 0:35
  • 4
    The reason this would be difficult to have in the YAML file itself is because piping is a shell feature and arara starts processes. To get a pipe, arara would have to start a shell and feed the command to the shell instead, which is not really something we'd get for free from the JVM (AFAIK) and would introduce an external dependency on something that could change from system-to-system. That's my guess – I'll let Paulo or one of the others on that team speak definitively on the matter :-) – Sean Allred Jun 1 '18 at 1:26
  • @SeanAllred Ah, I see. I thought the commands were sent to a shell anyway. That makes sense, thank you for the explanation. :) – dbmrq Jun 1 '18 at 4:58
1

This isn't really an answer to my question about arara, but I followed @cfr's suggestion and wrote a script to compile those files for me and it's working pretty well, so I thought I'd share it in case someone else is interested:

https://github.com/dbmrq/solo

There's probably no point, since the script itself already handles many use cases, but it's also easy to use it in an arara rule:

!config
identifier: solo
name: Solo
command:
    - solo "@{file}"
arguments: []

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.