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 into ~/Library/TeXShop/bin
  2. In terminal, type `chmod +x ~/Library/TeXShop/bin/
  3. Create ~/Library/TeXShop/Engines/Sweave.engine with the following content:
    #!/bin/bash ~/Library/TeXShop/bin/ -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/ -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'

blog comments powered by Disqus


30 March 2011