myChemistry

chemistry, typesetting and LaTeX

arara – automate your LaTeX with birds music

| 2 Comments

After I read an article on latex-community.org I got intrigued: this sounded like a really comfortable way to automate my compiling process! So today I downloaded, installed and used Paolo Cereda‘s arara for the first time — and immediately fell in love with it.

So now I’d like to tell you how I installed it on my linux machine, added an entry to my kile editor and how it works once you’ve set it up.

Installation

Since I am working with OpenSUSE as OS I tell you, what I did to get it working there. The first step is to download arara.jar. Then I created the directory /opt/arara/ and placed the file in there. Now I created a bash script in the same directory named arara containing the following two lines:

#!/bin/bash
java -jar "$(dirname "$0")/arara.jar" $*

This file must be executable, so I run chmod 777 arara on the command line. (I changed these rights to more restricted ones later. I was eager to start!) Next thing to do was making it accessable from everywhere. For this I added the following lines to the .profile file in my home directory:

# arara
PATH=/opt/arara:$PATH; export PATH

That’s it. Since I am a dedicated kile user I created a menu entry for arara next. Simply go to Einstellungen > Kile einrichten > Werkzeuge > Erstellen and add an entry arara with options '--verbose %S'. Now we’re good to go. Sorry for the menu entries being in German. The English ones must be something like Settings > Setup Kile > Tools > Built.

Setting it up

Next thing you need are rules for arara. Otherwise it won’t do anything. But to get started you don’t need to dig too deep into it. I created the subdirectory /opt/arara/rules/plain/. This directory now should contain the rules which are files with the extension yaml. Paolo Cereda has a bunch of them ready to use.

So for testing purposes I copied them into the directory and I was ready for testing. The names of the yaml files now are the rules for arara.

Creating these rules on your own isn’t very difficult, though. The documentation explains several examples step by step. Actually I created own rules first before I realized there were ready ones.

Let the music begin: run arara

For testing purposes I created a file test.tex containg these lines:

% arara: pdflatex
% arara: makeindex: { style: test.ist }
% arara: biber
% arara: pdflatex
% arara: pdflatex
\documentclass{article}
\usepackage[utf8]{inputenc}

\usepackage{filecontents}
\usepackage{makeidx}
\begin{filecontents}{\jobname.ist}
 heading_prefix "{\\bfseries "
 heading_suffix "\\hfil}\\nopagebreak\n"
 headings_flag  1
 delim_0 "\\dotfill "
 delim_1 "\\dotfill "
 delim_2 "\\dotfill "
 delim_r "\\textendash"
 suffix_2p "\\nohyperpage{\\,f.}"
 suffix_3p "\\nohyperpage{\\,ff.}"
\end{filecontents}
\usepackage[backend=biber]{biblatex}
\addbibresource{biblatex-examples.bib}
\makeindex
\begin{document}
A citation\cite{companion} and an index entry\index{bla} and some arbitrary text.
\printbibliography
\printindex
\end{document
}

The first five lines

% arara: pdflatex
% arara: makeindex: { style: test.ist }
% arara: biber
% arara: pdflatex
% arara: pdflatex

tell arara to run pdflatex, then makeindex with a custom style file, then biber for the bibliography and pdflatex twice more. Hit the arara button in kile and voila: everythings ready!

With some effort that took less than an hour I made my life a lot easier!

Thanks very much to Paolo for this awesome software!

2 Comments

  1. Wow, that’s a nice summary. Thank’s for the effort!

Leave a Reply

Required fields are marked *.