Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

arara is a cool tool for LaTeX automation, it works by setting your directives (i.e., a code line in tex document) to tell arara what to run next in a specific order that best suits your LaTeX compilation needs. These directives should contain rules (i.e., configuration files that are written in YAML language, default rules ship already with the package but you can create your own) One of the default written rules, called clean, which I found useful to get rid of the auxillary as well as other files which are normally generated during the process of PDF compilation.

The problem arises, when one is working inside a Dropbox folder (a reasonable way to keep your files in the cloud synchronized, updated, and shared), as arara is trying to delete these auxiliary, etc.. files by the clean rule, Dropbox is trying to synchronize them, and synchronization will take some time depending on the size of your files, here comes the problem, arara clean rule will fail, reporting that files are used by another program.
One workaround is to add a sleep command before the delete command in the clean rule file. The below code was generously given from Paulo Cereda, one of the authors of arara fantastic package:

!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  

The above code should replace the default clean.yaml file in the arara rules directory, or a better approach, thankfully suggested by Marco Daniel, one of the authors of arara package, is to provide a new path in araraconfig.yaml for the new rule. Directives in tex file should look like this:

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

Question:
What command should replace the COMMAND HERE in 6th line of the YAML file above that works in Windows 7 platform?

I tried the following but didn't work:

- <arara> TIMEOUT @{wait}  

and also:

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

Notes:
To comment out arara directives you can add ! before arara like this:

% !arara: biber  
share|improve this question
4  
I can't help with windows problems, but you 'clean' your folder every time you latex your document (and only *after uploading all the new files, which will mostly be deleted)? This doesn't seem like an efficient use of resources. It seems like the best solution would to stop the Dropbox service while fiddling with your document, clean it (only) at the end of the session, then run Dropbox (on GNU/Linux this is as easy as dropbox stop and dropbox start). After all one point of the ancillary files is to aid document-creation (easy, I guess, to forget that with today's computers). –  jon Jun 17 '13 at 13:27
2  
A different approach might be to tell dropbox to ignore or filter certain files (.log, .aux, etc)- then you wouldn't have to worry about removing them so often. I'm not sure of the precise syntax but it does look possible –  cmhughes Jun 17 '13 at 14:50
1  
Yet another option, but probably not supported by arara: use the -output-directory directive to let pdflatex create all files in some temporary directory outside of your dropbox and, if desired, copy just the PDF back. –  Daniel Jun 17 '13 at 15:10
1  
@Daniel: It doesn't depends on arara. arara only executes a command with options ;-) –  Marco Daniel Jun 17 '13 at 15:50
3  
Instead of replacing any default files you should provide a new path in araraconfig.yaml. –  Marco Daniel Jun 17 '13 at 15:52

1 Answer 1

up vote 3 down vote accepted

I think the best way to deal with this issue, as rightly suggested by jon, is to pause the snycing of Dropbox if I am intending to implement the clean rule of arara, better than writing a new rule on ad hoc basis. So in Windows, simply go to the dropbox icon on the taskbar and select pause syncing as shown in the picture below:
enter image description here

After that, you can run arara default clean rule, the clean directive should look like this:

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

, but now without the interference of the Dropbox. You will have a clean feeling that all of the ancillary files (e.g., 17 files) are deleted by names specified in the rule in one go, you cannot delete files by mistake, that's what makes arara-automated-delete elegant!
Note:
DO NOT forget to resume syncing files of the Dropbox.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.