I wrote a perl script (teximporter) to facilitate the use of in-line foreign textual notation inclusion in LaTeX. Typically, it calculates a set of files (images, attach, ...) and a latex replacement string. Example:

EF G2 | GG G2 | GA B2 | BB B2 | AG F2 | FF F2 | GF E>E|EE E2||


teximport ex.tex > _ti_ex.tex
pdflatex _ti_ex.tex

we got the expected result (a pdf image and a midi attach), enter image description here In order to hide command line activity (for IDEs), I decided to try arara. Here is my teximporter.yaml

identifier: teximporter
name: teximporter
-  teximporter -o "_ti_@{file}" "@{file}" 
-  pdflatex "_ti_@{file}" 
arguments: []

But the final pdf file has the wrong name (_pi_ex.pdf instead of ex.pdf).

What is the best way to define a good arara configuration for a preprocessor, if possible capable of running in Linux, Windows and Mac.

  • According to the rule that you've specified, I'd say that _ti_ex.pdf is the appropriate name of the pdf. You could add another line to rename the pdf, which I have done in, for example, my answer to : tex.stackexchange.com/questions/31334/…. For reference, you might like to see: tex.stackexchange.com/questions/19182/…
    – cmhughes
    Commented Mar 1, 2017 at 11:36
  • Hello João! Chris (@cmhughes) is right, when running pdflatex on a file named a.tex, you end up with a PDF file named a.pdf, so the current result is expected. Is _ti_ex.pdf the file you were expecting, only with the "wrong" name? If so, it is just a matter of writing a "rename" command in the list of commands. Chris wrote a solution for that, but I can come up with another solution if you want more features to be added to your rule. :) Commented Mar 1, 2017 at 17:04
  • @cmhughes, thank you! in the suggested answers I learn some very nice tricks like isWindows("...", "..." and -jobname -- this way I see 2 good ways to write a system independent rename.
    – JJoao
    Commented Mar 1, 2017 at 19:06
  • @PauloCereda, muito obrigado! After Chris wise suggestions I will begin by trying ` - pdflatex -jobname="@{getBasename(file)}" "_ti_@{file}"` This way it will work with some IDEs and in the music files, we just need a simple % arara: teximport.
    – JJoao
    Commented Mar 1, 2017 at 19:18
  • That's great! Perhaps you could self answer with your implementation :)
    – cmhughes
    Commented Mar 1, 2017 at 20:51

1 Answer 1


This is not really my answer: all the wisdom came from @cmhughes and others (see references in the comments).

The configuration presented in question has some problems:

  • the pdf output for file a.tex is _pi_a.pdf -- problematic for the IDEs' users : rename needed
  • it forces the use of pdflatex : parameter needed

Following the new version of configuration teximporter.yaml :

identifier: teximporter
name: teximporter
-  <arara> teximporter -o _ti_@{file} @{file} 
-  <arara> @{engine} -jobname=@{getBasename(file)} _ti_@{file}

- identifier: engine
  flag: <arara> @{parameters.engine}
  default: pdflatex


  • jobname=@{getBasename(file)} : renames output and auxiliary files to the initial basename (a.pdf, a.aux, etc)
  • @{engine} : defines a parameter (default: pdflatex) to be possible to choose different latex engines (lualatex, etc) (copied from @cmhughes)

To use teximporter preprocessor, add the following to the "tex" file:

% arara : teximporter


% arara : teximporter: { engine : lualatex }

And it is possible to directly use arara as the processor in IDEs like TexWorks.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .