HOWTO info--------------------------- For information on the statistical program R, consult http://www.r-project.org. For more info on Sweave in R, you can consult the FAQ from the author of Sweave, the R component that does the processing of the Rnw file. http://www.ci.tuwien.ac.at/~leisch/Sweave/FAQ.html There are 3 steps to make LyX work with Sweave. 1. Put the "batch" script for processing Rnw files into an executable file and save it in your path. That file is in the Sweave documentation, but here it is again for reference. I named it Rweave. The version recommended by the Sweave author is this: Rweave: #!/bin/sh echo "library(tools); Sweave(\"$1\")" | R --no-save --no-restore I've seen various renditions of this script. 2. Fool LyX into thinking you have the whole of Noweb installed. Noweb is a package you can download and install, but you don't need it all. All you need is the noweb.sty file, the LaTeX style file. Install that in your LaTeX, I put it under /usr/local/share/texmf/tex/latex/noweb because that's a standard place to store user added latex files. If you want, I could package up my /usr/local/share/texmf directory and you could untar into your system. I also have the LaTeX files for the "beamer" presentations I make in LyX, those are the ones I show in Pols 110 when I don't use Powerpoint. After dropping the noweb.sty file in, then run > texhash to make sure your LaTeX system knows about the file. 3. Configure LyX. First, open LyX, choose "edit" and "reconfigure" and let it run. You should notice in the output it finds the noweb style and now you get new document classes. Close LyX, restart. Now you need to configure LyX. LyX needs to know that your file is a NoWeb file and that it has to be "post processed". Ordinarly, LyX goes directly from *.lyx format to *.tex format, but now it will go from *.lyx to *.nw format. You have to tell it how to handle the nw file. In Lyx, you will see the document classes now include "Noweb" variants. Choose article(Noweb). THat tells Lyx that you want to process your file through another program. Now you have to tell LyX what that other program is. In Lyx's Edit / Preferences dialog, choose the "Converters" option. This menu interface is confusing. Here's the way it should go. a. In the "From" pulldown, choose NoWeb b. In the "To" pulldown, choose LaTeX c. Hit the "new" button toward the bottom. d. Make sure the Converter NoWeb->LaTeX is chosen, and then in the box called "Converter" type the name of the batch script you saved above. Mine was called Rweave, so I put Rweave in there. THe syntax should be Rweave $$i