h1

TeXworks with Sweave

July 31, 2010

Recently, I’ve started trying TeXworks for my LaTeX editing needs. It’s pretty basic but works well, is fast, cross-platform, open-source, and has a nice previewer. I didn’t find any information regarding how to set up Sweave to run with it, so I’ve decided to post how I’ve done it.

Do the following
Edit -> Preferences...

Under the Typesetting tab, in the Processing tools section look for the ‘+’ and click it. This will bring up a dialog box to add your own ‘tool’

I added the following.

In the Name field:
Sweave

In the Program field:
R

And I gave it 3 arguments, each is a separate argument and should not be on the same line!
CMD
Sweave
$fullname

Also, I deselected view PDF as it doesn’t make sense as you now need to run LaTeX.

Click OK, then OK, and now you’ll have Sweave available in the drop down box.

It should look like the screenshot below.

texworks

Advertisements

2 comments

  1. That didn’t work for me in Windows (It complains about ‘sh’ being unknown), but this did:
    Program: Rscript
    Arguments:
    -e
    Sweave(‘$filename’)

    I also had to add the R program directory to the search paths.


    • Thanks. I’ve added your comment in case someone else encounters this issue.



Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: