I'm writing a .Rnw file in TextMate when using knitr to convert this file to a .tex file, then converting the .tex file a PDF. I'm wondering if there are any tools available that will automate this process, ie everytime anything updates in the .Rnw file, the PDF also updates? Using knitr to combine R and LaTeX code is great, but I think the conversion process to PDF takes up a lot of time, especially if changes to the .Rnw file are small but need to be cross-checked in the PDF file everytime they are made.
1 Answers
2
votes
If you are on Linux use inotifywait for that. Most distributions have the package inotify-tools
Then do something like
while inotifywait -e close_write myfile.Rnw; do compile_myfile.sh; done
or
while inotifywait -e delete_self myfile.Rnw; do compile_myfile.sh; done
It depends on how your editor actually saves files. Just try and read the man page.
You have to write compile_myfile.sh
of course to compile the .Rnw to .pdf - but I guess you know the commands.
cache = TRUE
in knitr (chunks). Upon compilation, this will update only "changed" chunks (a change is a matter of definition). – Roman Luštrikcache = TRUE
. I want the PDF to update automatically, without having to manually compile the .Rnw and .tex files – luciano