Sweave.edt by Gilbert Ritschard (gilbert.ritschard@unige.ch)

Sweave.edt is a macro for launching the Sweave(filename) R command
           from within WinEdt. It checks also if the sweave process
           (that turns the .Rnw file into a .tex file terminates normally
           and opens the error log otherwise.
           It offers also the possibility to directly texify or pdftexify
           the resulting .tex file.

When the macro ends normally, the focus is on the resulting .tex file
when sweave only is requested, and on the .Rnw file when sweave +
pdfLaTeX is requested.


Installation and usage instructions:
===================================

If you have installed R-Sweave, Sweave.edt is ready to use. Now, if
you want Sweave without all the R-Sweave stuff, proceed as follows:

1. Put the content of this zip file in a

 %B\Contrib\R-Sweave

 folder. Create the folder if necessary.


2. Create a new submenu macro item (named for instance "Sweave")

 LetReg(6,"dvi");LetReg(4,"\x64");Exe("%B\Contrib\R-Sweave\Sweave.edt");

 with
 Requires File Filter set to : %p\%n.Rnw
 Start in             set to : %p

 and check "Requires a document", "Set Folder to 'Start in'" and "Save input file to disk".


 In the above macro line, the LetReg is optional.

 LetReg(6,"dvi");    has for effect to directly texify the LaTeX file generated by Sweave.
                    When omitted, the macro opens the generated LaTeX file without texifying it.
                    This offers a way to change settings before texifying.
                    With "pdf" instead of "dvi" the LaTeX file is PDFTeXifyied.

 LetReg(4,"\x64");  specifies that you use the 64bit version of R (version 2.12.0 or higher)
                    alterntives are "i386" fro the 32bit version, or "" for version < 2.12.0

 You may also set

 LetReg(7,"c:\Program Files\R\R-2.12.0\bin\i386");
                    to tell the macro where
                    it founds the R binaries (more specifically the Rscript.exe).
                    If omitted, the macro attempts to find the path
                    in the Windows registry. If you set registry %!7, registry %!4 is ignored.

 LetReg(8,"cache");   in which case cacheSweave is run instead of Sweave.

 LetReg(8,"R");       in which case Stangle is run instead of Sweave. Stangle just 
                      concatenates all chunks into a single .R file.

 We suggest to create different submenu items, one with the "pdf" option,
 and one without this option for instance.


3. Before using the macro, you should indeed check that the cacheSweave
   package is installed in your R system.

 We recommend also, to transfer the sweave.sty file from the
 c:\Program Files\R\R-2.12.0\share\texmf\ directory to a directory
 searched by your TeX system. Alternatively, you can add the above
 directory in the list of paths that TeX will search.
 In any of these two cases, add a \usepackage{sweave} in the
 preamble of your LaTeX document.


Now try it and enjoy.
Gilbert
