# [texworks] Sweave with Texworks - Update

Christopher David Desjardins cddesjardins at gmail.com
Sun Aug 1 16:48:21 CEST 2010

Hi Paul,
Thanks for your reply. I am running Ubuntu 10.04 with texlive 2009 (if
that matters) and R 2.11.1. My set seems to work wonderfully. I have
blogged about it here -> http://cddesjardins.wordpress.com/

My initial set up indeed involves working with a .Rnw extension.

Some of your other suggestions (regarding colorizing syntax and creating
a script) sounds interesting and I think I'll investigate them when I
get some free time. For the moment, running Sweave (as I've written)
creates a .tex file which I can then open in TeXworks and run pdflatex
on. Additionally, I will either use TeXworks or gedit (GNOME's editor)
as my R editor and copy/paste or source my file directly to R running in
a terminal. So this set up works great for me.

Thanks!
Chris

On Sun, 2010-08-01 at 18:12 +1200, Paul A Norman wrote:
> Hi Chris,
>
> Your basic set up seems right (I am not running Sweave but here are
> some tips from http://stat.epfl.ch/webdav/site/stat/shared/Regression/EPFL-Sweave-powerdot.pdf)
>
> Are you using an initial .Rnw or Snw extension for your first file(s)?
>  E.g. MyFile.Rnw
>
> Assuming (as you are using CMD) you are on MSWindows, is Sweave in
> your path statement? (Right Click MyComputer choose Properties /
> Advanced / Environment Variables / under System Variables scroll to
> Path and Click edit (carefully) edit the path ststement includung the
> full path to your Sweave binary. OK, OK  out.
>
> Choose Sweave from the drop down beside the Green start arrow.
>
> Run the Green arrow.
>
> When Sweave runs it should produce a file with the same name stem but
> .tex extension.
>
> So MyFile.Rnw will produce a file MyFile.tex which you then need to
> open in TeXWorks and run pdflatex (or what ever) over, (Change
> dropdown to pdflatex and run green arrow), to get MyFile.pdf
>
> You may want to try and see if you can edit
> \config\configuration\syntax-patterns.txt
>
> to make your Sweave in-document commands colour-ise in some useful
> way, if you do you might want to consider adding that information to
> the TeXWorks/issues as a resource perhaps (you might have alrteady
> opened an issue 397 there)?
>
> Another approach would be to make a Tw QtScript (like JavaScript) that
> handles the processing of the Swaeve file and then opens the result in
> the TexWorks editor for you.
>
> Hope this helps ...
>
> Paul
>
> On 1 August 2010 05:48, Christopher Desjardins <cddesjardins at gmail.com> wrote:
> > Hi,
> > I think I got this to work properly. Here's what I did.
> >
> > Edit -> Preferences...
> >
> > Processing tools -> click the '+'
> >
> > Name: Sweave
> > Program: R
> > Arguments: CMD
> >                   Sweave
> >                   \$fullname
> >
> >
> > Is there anything else I should do?
> > Chris
> >
>