Cedric
Cedric

Reputation: 2474

How to configure arara to post process .Rnw files in statet / Eclipse

I would like to use arara to post process the .tex files produced from Sweave (.Rnw) documents in R, and use it to build glossaries or bibliographies in reports. How do you integrate that in the statet eclipse plugins ?

The arara header is put on top of the .Rmd file and will be processed to the .tex file as following.

% arara: pdflatex:  { action: nonstopmode, synctex: True }
% !arara: bibtex
% arara: makeglossaries
% !arara: pdflatex: {action: nonstopmode, synctex: True }
% !arara: pdflatex: {action: nonstopmode, synctex: True }
\documentclass{article}
\usepackage{glossaries}
\newglossaryentry{salmon}{name={salmon},description={Anadromous migratory fish}}
\newglossaryentry{eel}{name={eel},description={Catadromous fish of the genus
anguilla}}
\makeglossaries
\begin{document}
An example for \gls{salmon} and \gls{eel}
\printglossary[numberedsection]
\end{document}

This way I will be able to run the bibtex and makeglossaries command. Now I want to integrate that command into the statet IDE.

Upvotes: 1

Views: 189

Answers (1)

Cedric
Cedric

Reputation: 2474

Congigure Arara for eclipse.

Go to the tool button (see below)> external tool configuration

enter image description here

Then click on program > new enter image description here

And configure arara as following :

enter image description here

Then create an example code. You .Rnw file or latex file must have the first lines with % arara: and commands. Below I'm using first pdflatex to build the file then bibtex and makeglossary, finally I re-run the pdflatex twice for a complete document. You can avoid one step simply by typing !arara:.

Here is an example which uses both \gls{}commands for glossary and \cite{} commands for bibtex. The R code is just to show that this is a .Rnw document.

% arara: pdflatex:  { action: nonstopmode, synctex: True }
% arara: bibtex
% arara: makeglossaries
% arara: pdflatex: {action: nonstopmode, synctex: True }
% arara: pdflatex: {action: nonstopmode, synctex: True }

arara.Rnw :

% arara: pdflatex:  { action: nonstopmode, synctex: True }
% arara: bibtex
% arara: makeglossaries
% arara: pdflatex: {action: nonstopmode, synctex: True }
% arara: pdflatex: {action: nonstopmode, synctex: True }
\documentclass{article}
\usepackage{glossaries}
\newglossaryentry{knitr}{name={Knitr},description={A package for reproducible
research}} 
\newglossaryentry{latex}{name={Latex},description={A typesetting program}}
\newglossaryentry{arara}{name={Arara},description={TeX automation tool based on
rules and directives.}}
\makeglossaries
\begin{document}

<<get_citation, echo=FALSE, eval=FALSE >>=
print(citation("knitr"),bibtex=TRUE)
@

This short reproducible example demonstrates how to use the \gls{arara}
\gls{latex} tool with a \textbf{Sweave} document, using eclipse and \gls{knitr}. 
For demonstration we will  include a bibliography using \cite{knitr_2017} and
\cite{knitr_2015}.

\printglossary[numberedsection]
\bibliographystyle{plain}
\bibliography{arara}
\end{document}

arara.bib :

@Book{knitr_2015,
    title = {Dynamic Documents with {R} and knitr},
    author = {Yihui Xie},
    publisher = {Chapman and Hall/CRC},
    address = {Boca Raton, Florida},
    year = {2015},
    edition = {2nd},
    note = {ISBN 978-1498716963},
    url = {https://yihui.name/knitr/},
  }  

@Manual{knitr_2017,
    title = {knitr: A General-Purpose Package for Dynamic Report Generation in R},
    author = {Yihui Xie},
    year = {2017},
    note = {R package version 1.17},
    url = {https://yihui.name/knitr/},
  }

When first running the .Rmd, the bibliography and glossaries are not built.

enter image description here

So what you do is you shift the the LATEX file and click on the cmd button arara

enter image description here

finally you get the document built with the bibliography and glossaries, re-run the arara process if you need to update the bibliography and glossaries, otherwise just run the knitr command, the pdf will be built.

enter image description here

Upvotes: 1

Related Questions