如何配置 arara post 处理 statet / Eclipse 中的 .Rnw 文件

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

我想使用 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 插件?

arara header 放在 .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 中。

为 eclipse 配置 Arara。

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

然后点击程序 > 新建

并按如下方式配置 arara :

然后创建示例代码。您的 .Rnw 文件或乳胶文件的第一行必须包含 % arara: 和命令。下面我首先使用 pdflatex 构建文件,然后 bibtexmakeglossary,最后我重新运行 pdflatex 两次为完整文档。您只需键入 !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 时,没有构建参考书目和词汇表。

所以你要做的是移动 LATEX 文件并点击 cmd 按钮 arara

最后你得到了用参考书目和词汇表构建的文档,如果你需要更新参考书目和词汇表,重新运行 arara 进程,否则只需 运行 knitr 命令,pdf即将建成。