shiblon / latex-makefile

A Makefile for LaTeX - drop it in, type make, and magic happens.
Other
185 stars 30 forks source link

Sweave/knitr #176

Open shiblon opened 8 years ago

shiblon commented 8 years ago

Originally reported on Google Code with ID 163

It'd be great to have support for knitr/Sweave documents.

Reported by jamie.f.olson on 2012-08-29 19:17:50

shiblon commented 8 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.

Reported by jamie.f.olson on 2012-08-29 19:27:06