TeXShop is my favorite editor/viewer for LaTeX under Mac OS X for many reasons. One of which is the speed of the edit -> compile -> view process which it enables. Therefore, I have been reluctant to use Sweave in the past because of the extra LaTeX compilation step that is not supported by default in TeXShop.
Recently, my friend Charlie Sharpsteen first showed me this way to get around this with a custom “engine”. The engine file looke like this:
R CMD Sweave “$1”
Place this file in
~/Library/TeXShop/Engines/, make sure
PATH includes the location of you TeX distribution.
Make sure executable permissions (like 744) are set on both files or TeXShop will give an error message. Now open (or re-open) TeXShop and select “Sweave” from the list at the top left. Now you can use command-t to compile Sweave and view your document in one step! Thanks Chuck!