Sweave on MacOSX

Because it took me a while to figure this all out, I thought I would post it. The aim here is to create Sweave files in TeXShop with the ability to compile to a pdf in one click (or command-T [can't figure out how to insert the command symbol]). Here’s what I did mainly thanks to Aaron Rendahl.

  1. Save Sweave.sh into ~/Library/TeXShop/bin
  2. In terminal, type `chmod +x ~/Library/TeXShop/bin/Sweave.sh
  3. Create ~/Library/TeXShop/Engines/Sweave.engine with the following content:

    #!/bin/bash
    ~/Library/TeXShop/bin/Sweave.sh -ld “$1″

  4. In terminal, type `chmod +x ~/Library/TeXShop/Engines/Sweave.engine’

If you want to also have an engine that doesn’t clean up after itself, create ~/Library/TeXShop/Engines/Sweave.engine with the following content:

#!/bin/bash
~/Library/TeXShop/bin/Sweave.sh -nc -ld “$1″

and in terminal typing `chmod +x ~/Library/TeXShop/Engines/SweaveNoClean.engine’.

Now, if you don’t want to include Sweave.sty in every directory where you are creating a Sweave document, just do the following obtained from here:

  1. In terminal type, `mkdir -p ~/Library/texmf/tex/latex’
  2. In terminal type, `cd ~/Library/texmf/tex/latex’
  3. In terminal type, `ln -s /Library/Frameworks/R.framework/Resources/share/texmf Sweave’

Add a comment »One comment to this article

  1. Do you have a favorite tutorial for Sweave? I love the idea, but I could never seem to get it to put tables in nicely, and getting it to scale plots correctly made me look back on my days of twiddling .eps files by hand to get the axes right with downright nostalgia.

Copyright © All Rights Reserved · Green Hope Theme by Sivan & schiy · Proudly powered by WordPress

show
 
close