yochju / latex-makefile

Automatically exported from code.google.com/p/latex-makefile
Other
0 stars 0 forks source link

Sweave/knitr #163

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
It'd be great to have support for knitr/Sweave documents.

Original issue reported on code.google.com by jamie.f....@gmail.com on 29 Aug 2012 at 7:17

GoogleCodeExporter commented 9 years ago
And coincidentally, I already did it and attached a patch.

It automatically identifies dependencies for generated files and incorporates 
them into .tex.d files.  These .tex.d files are added as dependencies to import.

These generated files should also get cleaned up automatically, since the 
dependency information is also put into .fls files.

Currently only supports knitr style processing, but knitr is backwards 
compatible with Sweave.  It shouldn't be hard to add sweave processing as an 
option.

The ONLY deviation from straight up vanilla knitr, is for adding external R 
scripts as dependencies.  Normally, you'd just do this:
<<cache=FALSE>>=
read_chunk("my_r_script.R")
@
Although this still works, the dependency on the R script is missed, so that 
make will NOT remake the .tex file and any graphics files if the R script is 
changed without changing the Rnw file.  Instead, you can use this and the 
dependency will work correctly:
<<cache=FALSE,file.chunk="my_r_script.R">>=
@

I also attached an example, since I wasn't quite sure how the tests work.

Original comment by jamie.f....@gmail.com on 29 Aug 2012 at 7:27

Attachments: