[texworks] Sweave with Texworks - Update

Duncan Murdoch murdoch.duncan at gmail.com
Thu Aug 5 02:23:03 CEST 2010

On 04/08/2010 8:00 PM, Reinhard Kotucha wrote:
> On 4 August 2010 Christopher David Desjardins wrote:
>  > Yeah, I checked out latexmk. It appears that latexmk can't run
>  > Sweave without some modifications (if I reading the information
>  > about latexmk correctly). Unfortunately I don't know any perl
>  > either.
> As far as I understand, Sweave creates LaTeX files from R files.  And
> latexmk creates PDF files from LaTeX files.  Isn't it possible to
> combine these steps by providing a simple shell script (on Unix) or a
> batch file (on Windows) which just calls Sweave and latexmk?

This is easy to do for simple one-file projects; I can show Christopher 
the details.

It's harder for multi-file projects, because there are usually at least 
two different filenames involved:  the chapter file and the main file. 
Sweave needs to update the LaTex for the chapter, and pdflatex needs to 
be given the main file.  TeXworks can currently only pass the name of 
the main file to the script, so it needs some trickery in the script to 
extract the chapter names and process them before calling pdflatex.  I 
haven't worked out the details of this trickery yet.

Duncan Murdoch

More information about the texworks mailing list