I Just made it work on a Windows XP machine like this,

>From the LyX for windows faq, I learned you can open a dos box and run

lyx -dbg 3

and that lets you see the error messages and such. If I were using
windows, I would always start LyX that way. From the errors I see
there, it appears to me as if the "R CMD Sweave" approach for the
converter will never work under the DOS shell, and people for whom it
does work in Windows are probably using a replacement shell, such as
BASH.

Never fear, it can still work.

I put a copy of noweb.sty in the MikTex\tex\latex hierarchy, also had
to copy the R\share\texmf directory contents into the MikTeX\tex\latex
hierarchy. For reasons I don't understand, MikTeX would not let me add
that to the search path.  Have done it in Linux before, but that's
TeTeX, what can I say?

Then I put R\bin into the system path. On my system, that is
C:\ProgramFiles\R\bin.  Note I always omit spaces because they suck.

Then Put 2  files (MakeRweave.R and Rweave.bat) into R\bin directory.
I attached MakeRweave.R, but Gmail will not let me assign the
Rweave.bat.  So here it is (all on one line):

C:/ProgramFiles/R/bin/Rterm --no-save --args "%1"
<C:/ProgramFiles/R/bin/MakeRweave.R> "%1.log

Any other place that you are sure is in the path would be OK for those
files.  You may need to revise Rweave.bat to fit your paths. In there,
  I don't know for sure how to make it work if you have spaces in your
directory names. To me, spaces are a curse.  They really suck.

In the R preferences dialog, look for Noweb-> latex. If you now  have
"R CMD Sweave $$i" replace that with the name of the bat file I give,
"Rweave $$i".  No need to insert "bat" there.

I also attach sample LyX document that does view in PDF

pj



On Thu, Mar 20, 2008 at 11:30 AM, Paul Johnson <[EMAIL PROTECTED]> wrote:
> The other thing I notice about your approach.  You did the noweb.sty
>  trick I recommended,but if you are using Gregor's converter
>  configuraiton, you need to put the R Sweave.sty directory into your
>  latex path.  I don't think you can mix/match the two approaches.
>
>
>  pj
>
>  On Thu, Mar 20, 2008 at 9:39 AM, Andrew Barr <[EMAIL PROTECTED]> wrote:
>
>
> > Hi all,
>  >
>  >  Using Lyx 1.5.2 and MiKTeX 2.5 on XP.  I am trying to use the Sweave
>  >  to create literate-article documents.  I haven't found great
>  >  documentation for how to do this on a windows install, but I have
>  >  pieced together the following steps, that ultimately fail when I try
>  >  to produce any layout by any method.  I get the following error.
>  >  "Lyx:Cannot convert file.  An error occured whilst running R CMD
>  >  Sweave "newfile2.Rnw"".  Anybody know why?
>  >
>  >
>  >  What I did....
>  >  (1) download Noweb.sty file
>  >  (2) verify that MiKTeX is indexing the directory containing Noweb.sty.
>  >  (3) create a preferences file that contains the following code, store
>  >  this in the Lyx Users directory, and verify through Lyx menu that this
>  >  correctly updates converters
>  >
>  >  # FORMATS SECTION ##########################
>  >  \format "literate" "Rnw" "Sweave" "" "editor" "editor"
>  >  \format "r" "R" "R/S code" "" "editor" "editor"
>  >  \format "pdflatex" "tex" "LaTeX (pdflatex)" "" "editor" "editor"
>  >  \format "latex" "tex" "LaTeX (plain)" "" "editor" "editor" "document"
>  >
>  >  # CONVERTERS SECTION ##########################
>  >  \converter "literate" "r" "R CMD Stangle $$i" ""
>  >  \converter "literate" "latex" "R CMD Sweave $$i" ""
>  >  \converter "literate" "pdflatex" "R CMD Sweave $$i" ""
>  >
>  >  (4) Copy literate-article layout files to users directory.
>  >  (5) reconfigure Lyx.
>  >
>  >  Then comes the error when I try to get any output.  Thanks.
>  >
>  >
>  >
>  >
>  >
>  >  --
>  >  W. Andrew Barr
>  >  Department of Anthropology
>  >  University of Texas at Austin
>  >  1 University Station C3200
>  >  Austin, TX 78712-0303
>  >  Email: [EMAIL PROTECTED]
>  >
>
>
>
>  --
>
>
> Paul E. Johnson
>  Professor, Political Science
>  1541 Lilac Lane, Room 504
>  University of Kansas
>



-- 
Paul E. Johnson
Professor, Political Science
1541 Lilac Lane, Room 504
University of Kansas

Attachment: MakeRweave.R
Description: Binary data

Attachment: TestSweave.lyx
Description: application/lyx

Reply via email to