I apologize for the late answer.
In order to run a task, arara
requires a rule to tell it how to do it, that's why % arara: texcount
didn't work. So we need to come up with a rule. :)
A very simple rule to call $ texcount mydocument.tex
is presented as follows (the file has to be named texcount.yaml
in order to work):
!config
identifier: texcount
name: TeXcount
command: texcount @{file}
arguments: []
It is self-explanatory, I believe. :)
No arguments, just a call to texcount
with the current file being processed (arara
already handles file override with the special files
parameter, so we don't need to worry with it in the rule context).
Of course, since I have a custom rule, I need to tell arara
how to find it. Then I need to create a file named araraconfig.yaml
in my home directory (/home/paulo
in Unix, C:\Users\Paulo
in Windows or /Users/paulo
in Mac) and add the rule location to it:
!config
paths:
- /home/paulo/myrulefolder
And we are done! :)
Let us try this new rule with a very simple TeX document, named mydoc.tex
, presented as follows:
% arara: pdflatex
% arara: texcount
\documentclass{article}
\begin{document}
Hello world!
\end{document}
Running arara mydoc.tex
in the terminal gives us the following output:
[paulo@cambridge ~] $ arara mydoc.tex
__ _ _ __ __ _ _ __ __ _
/ _` | '__/ _` | '__/ _` |
| (_| | | | (_| | | | (_| |
\__,_|_| \__,_|_| \__,_|
Running PDFLaTeX... SUCCESS
Running TeXcount... SUCCESS
[paulo@cambridge ~] $
Uh-oh. Although texcount
was successfully executed, I was expecting the command output in order to check the statistics. We could use the --verbose
flag in order to tell arara
to show what is going on under the hood:
[paulo@cambridge ~] $ arara mydoc.tex --verbose
__ _ _ __ __ _ _ __ __ _
/ _` | '__/ _` | '__/ _` |
| (_| | | | (_| | | | (_| |
\__,_|_| \__,_|_| \__,_|
Running PDFLaTeX...
This is pdfTeX, Version 3.14159265-2.6-1.40.16 (TeX Live 2015) (preloaded format=pdflatex)
restricted \write18 enabled.
entering extended mode
(./mydoc.tex
LaTeX2e <2015/10/01> patch level 2
Babel <3.9m> and hyphenation patterns for 79 languages loaded.
(/usr/local/texlive/2015/texmf-dist/tex/latex/base/article.cls
Document Class: article 2014/09/29 v1.4h Standard LaTeX document class
(/usr/local/texlive/2015/texmf-dist/tex/latex/base/size10.clo)) (./mydoc.aux)
[1{/usr/local/texlive/2015/texmf-var/fonts/map/pdftex/updmap/pdftex.map}]
(./mydoc.aux) )</usr/local/texlive/2015/texmf-dist/fonts/type1/public/amsfonts/
cm/cmr10.pfb>
Output written on mydoc.pdf (1 page, 11921 bytes).
Transcript written on mydoc.log.
Status: SUCCESS
Running TeXcount...
File: mydoc.tex
Encoding: ascii
Words in text: 2
Words in headers: 0
Words outside text (captions, etc.): 0
Number of headers: 0
Number of floats/tables/figures: 0
Number of math inlines: 0
Number of math displayed: 0
Status: SUCCESS
[paulo@cambridge ~] $
Well, it worked, but is there a way to nicely show the output instead of this clumsy solution? Now, the sad part: with version 3.0, we might need a bit of trickery in order to make things work. You could read my answer in the following link in order to understand why I cannot exploit rules to do more complex stuff: Arara rule to delete files with wildcard
Long story short: version 3.0 evaluates rules beforehand. With version 4.0, arara
now relies with a REPL workflow, but it would be unfair to talk about it since I am still writing the manual and the tool is not officially released.
I will update this answer accordingly when the new version is out.
A potential improvement is to write a wrapper script (in my example, named gtexcount.sh
) with the following content (I could also suggest a bash function, as in Is it possible to write an arara rule which uses a bash script?):
#!/bin/bash
zenity --info --title='TeXcount' --text="$(texcount \"$1\")"
(I am using zenity
here, but there are other options available as well)
With a quick rule update, we can now invoke this script instead of the original texcount
and a nice window will display the file statistics:
!config
identifier: texcount
name: TeXcount
command: /home/paulo/gtexcount.sh @{file}
arguments: []
(Of course, I also did $ chmod +x gtexcount.sh
in order to give it proper execution permission)
Let us try our new rule:

After clicking the OK
button, we have everything back to normal:
[paulo@cambridge ~] $ arara mydoc.tex
__ _ _ __ __ _ _ __ __ _
/ _` | '__/ _` | '__/ _` |
| (_| | | | (_| | | | (_| |
\__,_|_| \__,_|_| \__,_|
Running PDFLaTeX... SUCCESS
Running TeXcount... SUCCESS
[paulo@cambridge ~] $
Not the best solution available, but I believe it is quite acceptable while version 4.0 is not around the block yet. Hope it helps! :)
arara
line is not the name of a binary, it refers to a rule, which is specified in a text file with a specific format, so such a rule has to be made fortexcount
.arara: texcount
didn't work.arara
) to take a look, so you might get some better help later. Meanwhile, if you want to bring more attention to your question, you could edit it to include your new rule, and say what you've tried.