Getting Rweave (aka Sweave) working real nice-like
For my dollar, Rweave is about the best way to do the computational part of science. It's all there, you can do anything, and anyone can see EXACTLY what you did to do it. Unfortunately, it's a pain. For now, here are some telegraphic notes to help guide setting things up (at least on OS X):
- Put a symbolic link like so `ln /Library/Frameworks/R.Framework/Versions/Current/Resources/share/texmf ~/Library/texmf/tex/latex/Sweave`. You'll need to make the intermediate directories in our ~/Library folder as well. This may not be necessary, e.g. if you use the Sweave.sh script out there.
- Put the line \SweaveOpts{condordance=TRUE} at the beginning of your document body - NOT in the header!
- Put the line \synctex=1 in your document header (I like this better than a command line option, but you could do it that way too).
- You may need to do some of this kind of funny stuff. Sadly, patchDVI doesn't seem to download for the most recent version of R (2.13.0). I had trouble downloading it using the instructions on that page. You can check to see if the packages actually exist here. If they don't exist, we can use the SVN. The commands below will do it if you have developer tools (i.e., Xcode or some other OS X compiler suite) and subversion installed (recent OS X includes this, maybe with developer tools).
svn checkout svn://svn.r-forge.r-project.org/svnroot/sweavesearch/pkg/patchDVI
R CMD INSTALL patchDVI
In addition, you may want to set up an Sweave engine if
you're using TeXShop (ask me for mine!). If you're using some other editor on a mac, you'll
definitely want Skim (which supports SyncTeX, Preview doesn't). In MacVim, LaTeX-box mode allows you to open up Skim, and Skim can open MacVim. You'll need to change some commands around on MacVim though, as LaTex-Box doesn't load for .Rnw files, and the R-vim command \l will override any use of \l* for latex stuff (I think - let me know if I'm wrong!).