I am currently using arara to give compilation rules for my .tex files. I have a lot of tikz/pgfplots made files which share common settings hosted in a header file, so that I can easily modify a setting, then recompile everything using a for loop e.g.

@FOR /R "rootdir" %%G in (.) DO (
@ Pushd %%G
@ for %%x in (*.tex) do arara "%%x"
@ Popd )

as I am on a windows machine.

However, this starts/stops arara a big bunch of times and throws very ugly logging to the terminal. So is there a rule or can one be written so that arara is only started once and compiles all files in a specified directory tree.

  • I've heard rumors that file globbing will be part of the next version ;)
    – TeXnician
    Oct 8, 2019 at 18:09
  • @TeXnician Hmmm, sweet ! Any ideas on the release date ?
    – BambOo
    Oct 8, 2019 at 20:36
  • Well, it's expected to be released somewhen next year, so probably not the best alternive for you. But what already works is using the listFilesByExtension function in a custom rule.
    – TeXnician
    Oct 9, 2019 at 12:33
  • @TeXnician you mean something like % arara: ListFilesByExtensions(toFile('/directorypath'),'tex', true); ?
    – BambOo
    Oct 9, 2019 at 14:29
  • No, you have to write a small rule that does (in MVEL, so that arara will process it) something like a for loop over the result of listFilesByExtension and returns something like getCommand('command', loopvariable). But I'm short of time right now, so let's hope Paulo will see your question (and canonically answer) :)
    – TeXnician
    Oct 9, 2019 at 15:12

1 Answer 1


It's as easy1 as writing an own rule using listFilesByExtensions (save this as all.yaml next to your files):

identifier: all
name: All TeX files
- name: All
  command: >
        a = [];
        foreach(ref : listFilesByExtensions(".", ["tex"], true)) {
          a.add(getCommandWithWorkingDirectory(ref.parent, [command, ref.name]));
        return a;
- identifier: command
  flag: >
  default: pdflatex

Then write an arararc.yaml like

- ./

Your header.tex will then contain % arara: all and all TeX files within the directory tree will be compiled (sequentially). Please note that if you actually have your header.tex called header.tex it will be compiled as well. You could e.g. rename it to header.ltx to avoid it.

1 Actually, the first draft of this rule had to be revised. Thanks to Paulo Cereda for providing an updated rule.

  • I just tested your solution (I could not this week-end). I created the all.yaml and arararc.yaml files in the root image folder of my main document. My header.tex is not a standalone file, so I never do something like arara header.tex. It is a file that is called with an \input{header} in each tikz/pgfplots graph. To apply what you propose, I created an allcompile.tex file so that I can call it with arara. I actually says that it compiles successfully but with a ridiculously small amount of time. Do you know why ? Is there a way to see what file is actually being compiled ?
    – BambOo
    Nov 4, 2019 at 9:33
  • Already tried the -v option but it actually gave not much output. The allcompile.tex is in the root image folder and most tex files are contained in sub-folders. Is the listFilesByExtensions search recursive ?
    – BambOo
    Nov 4, 2019 at 9:47
  • Yep in my case recursive search is fine as all tex files in the tree are graphs. However, the compilation fails, as the working directory is always the root one while it should be the folder containing the actual tex of the graph, hence the @ Pushd / @Popd of my original script.
    – BambOo
    Nov 4, 2019 at 12:59
  • Well, I just noticed that I do not know enough about Windows bash to see these details. Actually, dealing with working directories is hard. Arara v5 will probably get working directory support but it will not support multiple working directories in one run for several reasons. I will try whether I can come up with a truly recursive logic.
    – TeXnician
    Nov 4, 2019 at 13:24
  • Thanks for the update, though it does not seem to work. Compilation starts but not in the right directory. Is there a way to print the current value of a variable to the terminal ? I do not know much about yaml. I tried to add something like print path; in the rule but it throws an error.
    – BambOo
    Nov 4, 2019 at 15:19

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.