如何配置arara以在statet / Eclipse中发布进程.Rnw文件

时间:2018-01-02 10:37:47

标签: r eclipse knitr tex statet

我想使用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中。

1 个答案:

答案 0 :(得分:1)

Congigure Arara for eclipse。

转到工具按钮(见下文)>外部工具配置

enter image description here

然后点击节目>新 enter image description here

将arara配置如下:

enter image description here

然后创建一个示例代码。你.Rnw文件或latex文件必须有第一行% arara:和命令。下面我使用第一个 pdflatex 构建文件,然后 bibtex makeglossary ,最后我重新运行 pdflatex < / em>两次完整的文档。只需键入!arara:即可避免一步。

这是一个使用\gls{}命令用于词汇表和\cite{}命令用于bibtex的示例。 R代码只是为了表明这是一个.Rnw文档。

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

首次运行.Rmd时,不会构建参考书目和词汇表。

enter image description here

所以你要做的就是转移 LATEX 文件,然后点击cmd按钮arara

enter image description here

最后,您将获得使用参考书目和词汇表构建的文档,如果您需要更新参考书目和词汇表,请重新运行arara流程,否则只需运行knitr命令,即可构建pdf文件。

enter image description here