1

我想使用arara对从 R 中的 Sweave (.Rnw) 文档生成的 .tex 文件进行后期处理,并使用它在报告中构建词汇表或参考书目。您如何将其集成到statet eclipse 插件中?

arara 头文件放在 .Rmd 文件的顶部,将被处理为 .tex 文件,如下所示。

% 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}

这样我就可以运行 bibtex 和 makeglossaries 命令。现在我想将该命令集成到 statet IDE 中。

4

1 回答 1

1

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

于 2018-01-07T18:09:50.463 回答