# How to open TeXworks' TeX root pdf result with arara?

Until now I've been using TeXworks to edit my .tex projects. When the project is divided in several subfiles I can use % TeX root=my_main_file.tex directive in order to compile the main file and not the one it's being edited. Once the file is compiled my_main_file.pdf is shown in TeXworks' pdf viewer.

Yesterday I decided to test arara because I also wanted to use its clean rule. After installing it and (more or less) reading the manual I don't know how to automatically open my_main_file.pdf after typesetting my_subfile.

arara typesetting engine is declared with $fullname --verbose --log and view PDF after running is marked. Rule %arara: pdflatex on my_main_file.tex works as expected: main file is processed and viewed. Rule % arara: pdflatex: {files: [ my_main_file ] } on my_subfile.tex works almost as expected: main file is processed but nothing is shown in viewer. What am I missing? - In your arara.log, there should be a line that looks like TRACE CommandTrigger - Command: .... Could you add this line, from both runs, to the question? – Brent.Longborough Sep 27 '12 at 11:14 I believe that you only need % !TeX program=arara in the secondary files, and no arara directive. Of course the TeX Root directive is still needed – egreg Sep 27 '12 at 11:20 ## 2 Answers First of all, thanks for giving arara a try. :) We are working on the new 3.x series, which will hopefully be the best version ever. :) When you mark the View PDF after running option when configuring the tool, TeXworks will monitor the current file expecting for changes. If you run arara on foo.tex, TeXworks will wait for changes in that specific file. Now, when we call arara on another file, TeXworks is not aware that it's another file that's being processed, hence not displaying the PDF preview. We can easily "fix" (technically, it's not a fix, it's just a "Hey, TeXworks! I'm running foo.tex, but my main file is bar.tex.") this behaviour by adding the following TeXworks directive in our subfile.tex file: % !TeX root = mymainfile.tex Hello world  That should do the trick. :) The arara directive is not even needed in the included files. When we use the % !TeX root directive provided by TeXworks, the current $fullname variable is set to mymainfile.tex, so arara will read the directives in mymainfile.tex instead of the current file.

As egreg mentions in the comment, it's also advisable to include another TeXworks directive, % !TeX program=arara, in the secondary file just to make sure arara will run. Maybe arara isn't selected in the program list. :)

-
Is it going to be even better than v4.0 ? :P – percusse Sep 27 '12 at 12:47
@percusse: Uh-oh. :) – Paulo Cereda Sep 27 '12 at 12:57
It worked! I also added TeX program directive but I had to remember (looking TeXworks manual) that it only sets the typesetting program when file is loaded. After that the typesetting program selected on the menu is the one which works. – Ignasi Sep 27 '12 at 15:03
@PauloCereda: arara tag ;-) – Marco Daniel Sep 27 '12 at 16:01

sorry for bumping this but I have this problem also. I was trying to use arara as an option to texify on miktex.

but setting up arara typesetting engine declared with \$fullname --verbose --log and view PDF after running marked and running for an old file (with a additional citation) does nothing. I dont know how to set up rules :(

-