为 Eclipse 配置 Arara。
转到工具按钮(见下文)> 外部工具配置
然后点击程序 > 新建
并配置arara如下:
然后创建一个示例代码。您的 .Rnw 文件或乳胶文件的第一行必须包含 % arara: 和命令。下面我首先使用 pdflatex 构建文件,然后使用 bibtex 和 makeglossary,最后我重新运行 pdflatex 两次以获得完整的文档。您只需输入!arara:即可避免一步。
这是一个示例,它使用\gls{}commands 来表示词汇表,\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。