如何在 Windows 中设置一条新的干净 arara 规则以规避 Dropbox 干扰?

如何在 Windows 中设置一条新的干净 arara 规则以规避 Dropbox 干扰?

arara是一款很酷的 LaTeX 自动化工具,它通过设置指令(即 tex 文档中的代码行)来告诉 arara 接下来按照最适合您的 LaTeX 编译需求的特定顺序运行什么。这些指令应该包含规则(即用 YAML 语言编写的配置文件,默认规则已随包一起提供,但您可以创建自己的规则)其中一条默认的书面规则称为clean,我发现它对于摆脱辅助文件以及通常在 PDF 编译过程中生成的其他文件很有用。

问题在于,当一个人在Dropbox文件夹(一种保持云中文件同步、更新和共享的合理方法),就像arara尝试通过 clean 规则删除这些辅助文件等一样,Dropbox 正在尝试同步它们,同步将需要一些时间,具体取决于文件的大小,问题就来了,arara clean 规则将失败,报告文件正在被另一个程序使用。
一种解决方法是在 clean 规则文件中的删除命令之前添加一个sleep命令。以下代码由 fantastic 包的作者之一 Paulo Cereda 慷慨提供arara

!config
# requires arara 3.0+
identifier: clean
name: NewCleaningTool
commands:
- <arara> COMMAND HERE @{wait}
- <arara> @{remove} 
arguments:
- identifier: remove
  default: <arara> @{isFalse(file == getOriginalFile(), isWindows("cmd /c del", "rm -f").concat(' "').concat(file).concat('"'))}
- identifier: wait
  flag: <arara> @{parameters.wait}
  default: 10  

上述代码应替换规则目录中默认的 clean.yaml 文件,或者更好的方法是为新规则提供新的路径,arara值得庆幸的是,该包的作者之一 Marco Daniel 建议了这种方法。文件中的指令应如下所示: araraararaconfig.yamltex

% arara: xelatex: { shell: true }
% arara: makeglossaries
% arara: biber
% arara: xelatex: { shell: true }   
% arara: xelatex: { shell: true }
% arara: clean: { wait: 15, files: [phdmain.aux, phdmain.idx, phdmain.glg, phdmain.ilg, phdmain.bbl, phdmain.ind, phdmain.log, phdmain.gls, phdmain.glo, phdmain.bcf, phdmain.blg, phdmain.run.xml, phdmain.lof, phdmain.lot, phdmain.out, phdmain.toc, phdmain.xdy]}  
\documentclass[oneside]{scrbook} 
\begin{document}
This is just a MWE to show if clean rule of arara package is waiting the specified seconds passed as a wait argument in the clean directive above, the default was set to 10 seconds in the clean.yml file, however if you have large files you might need longer waiting periods until Dropbox is done with syncronization of your files, leaving them ready to be deleted by clean rule directive of arara package. An elegant way to keep your messy tex folder as clean as possible.
\end{document}  

问题:
在 Windows 7 平台上,应该用什么命令替换COMMAND HERE上述 YAML 文件第 6 行?

我尝试了以下方法,但没有效果:

- <arara> TIMEOUT @{wait}  

并且:

- <arara> powershell -command "Start-Sleep -s @{wait}"  

笔记:
要注释掉arara指令,您可以在 arara 之前添加 !,如下所示:

% !arara: biber  

答案1

我认为处理这个问题的最好办法,正如 jon 所建议的,如果我打算实施 的清理规则,就暂停 Dropbox 的 snycing arara,这比在 上写一条新规则要好。特别指定基础。因此在 Windows 中,只需转到任务栏上的 Dropbox 图标并选择,pause syncing如下图所示:
在此处输入图片描述

此后,您可以运行 arara 默认清理规则,清理指令应如下所示:

% arara: clean: { files: [phdmain.aux, phdmain.idx, phdmain.glg, phdmain.ilg, phdmain.bbl, phdmain.ind, phdmain.log, phdmain.gls, phdmain.glo, phdmain.bcf, phdmain.blg, phdmain.run.xml, phdmain.lof, phdmain.lot, phdmain.out, phdmain.toc, phdmain.xdy]}  

,但现在没有 Dropbox 的干扰。您会有一种干净的感觉,所有辅助文件(例如 17 个文件)都按规则中指定的名称一次性删除,您不会误删文件,这就是 arara-automated-delete 的优雅之处!
笔记:
不要忘记恢复 Dropbox 的同步文件。

相关内容