5

I'm trying to set up an arara user command in TeXstudio. I've been following this very helpful little tutorial that can be found as an answer the following question:

How to configure TexStudio editor to use glossaries package with makeglossaries and xindy or how to configure TexStudio to use arara?

The only issue I have is that I can't seem to get the syntax for the user command correct on Windows. The closest to working that I can get is:

Arara user command

This does open arara, but then I get the error:

I'm sorry, but the command from the 'PDFLaTeX' task could not be found. Are you sure the command 'pdflatex "lecture3.tex"' is correct, or even accessible from the system path?

Note that the source tex file (lecture3.tex) has the command % arara: pdflatex at the top. Do I need to tell TeXstudio where to find pdflatex even though it's in the same folder as arara? This is all using MiKTeX on Windows.

Shane
  • 875
  • 1
    Have you tested that arara actually works from the command line? (dos prompt) it needs to at least work there in order to work in general. I cannot test it as I have no java on my computer ;-) – daleif Jun 03 '16 at 08:51
  • Are you in the folder where lecture3.tex is? can nyou compile it with normal pdflatex on the command line? – daleif Jun 03 '16 at 09:08
  • In the command line, if I navigate to the folder containing lecture3.tex and run arara lecture 3.tex, arara and the pdflatex it calls work fine. – Shane Jun 03 '16 at 09:23
  • Is there an arara.exe file in C:\Program Files (x86)\MiKTeX 2.9\miktex\bin (with a .exe extension)? I don't use Windows, but arara is a Java application, so it comes as a .jar file. When you run arara from the command line, it might actually be invoking java -jar /path/to/arara.jar. – Nicola Talbot Jun 04 '16 at 10:56
  • @NicolaTalbot Yes, there is an arara.exe file there. Judging from the error, the issue is not that arara isn't opening, but rather that when it does it cannot find pdflatex.exe, despite the fact that it's in the same folder as arara.exe. Perhaps it is looking for it in the folder where the .tex file is -- this is my suspicion. – Shane Jun 04 '16 at 12:05
  • @Shane Sorry, I mis-read your message. That's strange. If pdflatex is on your path, arara should find it. What version of arara are you using? (I can't find that error message in the resource files for the current version.) – Nicola Talbot Jun 04 '16 at 12:19
  • @NicolaTalbot I'm using the arara.exe that comes with the MiKTeX distribution. When I run it, it says it is version 3.0, which (looking around) appears to be the current version. Let me try downloading and installing the standalone off of Github. – Shane Jun 05 '16 at 03:07
  • Installing the standalone revealed the issue -- arara.exe comes with MiKTeX but the preset rules, including pdflatex.yaml don't. I'll create a corresponding answer. Thanks to all for your help. – Shane Jun 05 '16 at 03:13

1 Answers1

4

While arara comes with MiKTeX, the default rules do not. When I was calling arara.exe to the .tex file, I was then instructing arara to call pdflatex which corresponds to the default rule pdflatex.yaml. Of course, since the default rules are not included in MiKTeX, this yielded an error. The simplest solution is to get the standalone version of arara from Github. You could perhaps also put a folder with the default rules inside the MiKTeX distribution file system, but I have not tested this.

Once you have the standalone version installed, I recommend creating the user command in TeXstudio as:

"C:\Program Files (x86)\arara\arara.exe" -v -l %

Of course, customize the path to wherever you installed arara.

Cheers to Paulo Cereda and his crew for this wonderful tool!

Shane
  • 875
  • If you use verbose option (-v) in TeXstudio on Windows 10, when there is an error (for example an undefined control sequence) Texstudio blocks and the process remains hanging even if you push the red stop button (you have to kill it with Task Manager). With the log option (-l) only: arara -l % | txs:///view | txs:///view-log it works like a charm! – CarLaTeX Nov 08 '16 at 22:05
  • 1
    Moreover, I've installed arara with MiKTeX 2.9 an I've automatically found also the rules on my pc, at the directory: C:\Users\myuser\AppData\Local\Programs\MiKTeX 2.9\scripts\arara\rules – CarLaTeX Nov 09 '16 at 06:23
  • After a successful MikTeX install of arara (you can test by typing arara in a command prompt), to find the arara.exe directory, open a command prompt and write where arara and you will get the path to paste into TeXstudio user command. As mentioned by @CarLaTeX the default rules should be automatically found in latest version of MiKTeX. – zetyty Jun 18 '23 at 20:33