Converter failure with Sweave

2008-03-20 Thread Andrew Barr
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]


Re: Converter failure with Sweave

2008-03-20 Thread Liviu Andronic
On Thu, Mar 20, 2008 at 3:39 PM, Andrew Barr [EMAIL PROTECTED] wrote:
  Using Lyx 1.5.2 and MiKTeX 2.5 on XP.  I am trying to use the Sweave

First question that comes to me: what version of R are you using?
Liviu


Re: Converter failure with Sweave

2008-03-20 Thread Paul Johnson
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?


Hello, everybody.

Here are the instructions for how we did succeed in using Sweave with
LyX in Windows.  I do not  use Windows, but I have seen this work.  I
might test it out and see if I can fix it if somebody promises to send
me a t-shirt.   I think either you can follow this plan or study this
plan and then try to update it to the approach that Gregor proposes.
Gregor takes advantage of the fact that Sweave is now a command line
batch option for R, but the way that Windows interacts with the
environment is so different from Unix that I'm not optimistic that
something so simple will work.

Here is my warning.  Your R code mistakes do not finish gracefully
with Lyx  Sweave.  The only way to tell what works is to run LyX from
a terminal window, where you can see the R error messages.  If you
start LyX from an Icon, as Windows users are prone to do, then you
will be completely helpless.


My student Frank Liu worked this set of instructions. I understand
that he has many students in Taiwan who are doing this, and I will
contact him to see if he has newer information.

I'm pretty sure that the library(tools) in the script below should be
changed to library(utils). I also think the last two lines of that
script are not strictly necessary.
pj

 Original Message 
Subject:Re: Rweave for Windows Lyx (problem solved!)
Date:   Sat, 04 Mar 2006 17:06:22 -0600
From:   Cheng-shan (Frank) Liu



Thank you, Nicolás. Also thank Uwe Ligges, Brian D. Ripley, and Paul
Johnson for their advices. Here is a summary of the advices about how to
make Rweave work in Lyx under Windows:

Suppose your Lyx is installed in C:\ProgramFiles\Lyx and your R in
C:\ProgramFiles\R-2.2.1.

1. Create a R file MakeSweave.R with the following lines and then put
it in C:\ProgramFiles\Lyx\bin\ (this is a path registered in Lyx).

library(tools)
args - commandArgs()
inp - args[length(args)]
Sweave(inp)
base - sub(\.(Rnw|Rtex)$, , inp)
texi2dvi(paste(base, .tex, sep=), pdf=TRUE)
shell.exec(paste(base, .pdf, sep=))

2. Create a batch script called Rweave.bat with the follwowing line,
and put it in C:\ProgramFiles\Lyx\bin\. (Note that back slash /,
rather than slash /, is used in the script.)
C:/ProgramFiles/R-2.2.1/bin/Rterm --no-save --args %1
C:/ProgramFiles/LyX/bin/MakeSweave.R %1.log

3. Put noweb.sty (can be found in google, or simply grab this file:
http://www.lsi.upc.es/~tpl/noweb.sty) in
C:\ProgramFiles\Miktex\tex\latex\noweb\ and refresh MikTex.

4. Reconfigure Lyx (go to Edit- Reconfigure). Check if you have
document class article(noweb) (Layout-Document), If not, you may need
to reinstall Lyx.

5. Last, make Lyx recognize the converter script Rweave. Go to
Edit-Preferences-Converters. In the From pulldown, choose Noweb. In
the To pulldown, choose LaTeX. Hit the new button toward the bottom.
Then, make sure the Converter Noweb-LaTeX is chosen, and in the box
called Converter type Rweave $$i without the quotation .


To test if the installation is done, check out Dr. Paul Johnson's
example file (http://pj.freefaculty.org/stat/Distributions/Gamma-02.lyx
). See if you can view its pdf file.


-Frank Liu






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


Re: Converter failure with Sweave

2008-03-20 Thread Paul Johnson
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


MakeRweave.R
Description: Binary data


TestSweave.lyx
Description: application/lyx


Converter failure with Sweave

2008-03-20 Thread Andrew Barr
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]


Re: Converter failure with Sweave

2008-03-20 Thread Liviu Andronic
On Thu, Mar 20, 2008 at 3:39 PM, Andrew Barr [EMAIL PROTECTED] wrote:
  Using Lyx 1.5.2 and MiKTeX 2.5 on XP.  I am trying to use the Sweave

First question that comes to me: what version of R are you using?
Liviu


Re: Converter failure with Sweave

2008-03-20 Thread Paul Johnson
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?


Hello, everybody.

Here are the instructions for how we did succeed in using Sweave with
LyX in Windows.  I do not  use Windows, but I have seen this work.  I
might test it out and see if I can fix it if somebody promises to send
me a t-shirt.   I think either you can follow this plan or study this
plan and then try to update it to the approach that Gregor proposes.
Gregor takes advantage of the fact that Sweave is now a command line
batch option for R, but the way that Windows interacts with the
environment is so different from Unix that I'm not optimistic that
something so simple will work.

Here is my warning.  Your R code mistakes do not finish gracefully
with Lyx  Sweave.  The only way to tell what works is to run LyX from
a terminal window, where you can see the R error messages.  If you
start LyX from an Icon, as Windows users are prone to do, then you
will be completely helpless.


My student Frank Liu worked this set of instructions. I understand
that he has many students in Taiwan who are doing this, and I will
contact him to see if he has newer information.

I'm pretty sure that the library(tools) in the script below should be
changed to library(utils). I also think the last two lines of that
script are not strictly necessary.
pj

 Original Message 
Subject:Re: Rweave for Windows Lyx (problem solved!)
Date:   Sat, 04 Mar 2006 17:06:22 -0600
From:   Cheng-shan (Frank) Liu



Thank you, Nicolás. Also thank Uwe Ligges, Brian D. Ripley, and Paul
Johnson for their advices. Here is a summary of the advices about how to
make Rweave work in Lyx under Windows:

Suppose your Lyx is installed in C:\ProgramFiles\Lyx and your R in
C:\ProgramFiles\R-2.2.1.

1. Create a R file MakeSweave.R with the following lines and then put
it in C:\ProgramFiles\Lyx\bin\ (this is a path registered in Lyx).

library(tools)
args - commandArgs()
inp - args[length(args)]
Sweave(inp)
base - sub(\.(Rnw|Rtex)$, , inp)
texi2dvi(paste(base, .tex, sep=), pdf=TRUE)
shell.exec(paste(base, .pdf, sep=))

2. Create a batch script called Rweave.bat with the follwowing line,
and put it in C:\ProgramFiles\Lyx\bin\. (Note that back slash /,
rather than slash /, is used in the script.)
C:/ProgramFiles/R-2.2.1/bin/Rterm --no-save --args %1
C:/ProgramFiles/LyX/bin/MakeSweave.R %1.log

3. Put noweb.sty (can be found in google, or simply grab this file:
http://www.lsi.upc.es/~tpl/noweb.sty) in
C:\ProgramFiles\Miktex\tex\latex\noweb\ and refresh MikTex.

4. Reconfigure Lyx (go to Edit- Reconfigure). Check if you have
document class article(noweb) (Layout-Document), If not, you may need
to reinstall Lyx.

5. Last, make Lyx recognize the converter script Rweave. Go to
Edit-Preferences-Converters. In the From pulldown, choose Noweb. In
the To pulldown, choose LaTeX. Hit the new button toward the bottom.
Then, make sure the Converter Noweb-LaTeX is chosen, and in the box
called Converter type Rweave $$i without the quotation .


To test if the installation is done, check out Dr. Paul Johnson's
example file (http://pj.freefaculty.org/stat/Distributions/Gamma-02.lyx
). See if you can view its pdf file.


-Frank Liu






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


Re: Converter failure with Sweave

2008-03-20 Thread Paul Johnson
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


MakeRweave.R
Description: Binary data


TestSweave.lyx
Description: application/lyx


Converter failure with Sweave

2008-03-20 Thread Andrew Barr
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]


Re: Converter failure with Sweave

2008-03-20 Thread Liviu Andronic
On Thu, Mar 20, 2008 at 3:39 PM, Andrew Barr <[EMAIL PROTECTED]> wrote:
>  Using Lyx 1.5.2 and MiKTeX 2.5 on XP.  I am trying to use the Sweave

First question that comes to me: what version of R are you using?
Liviu


Re: Converter failure with Sweave

2008-03-20 Thread Paul Johnson
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?
>

Hello, everybody.

Here are the instructions for how we did succeed in using Sweave with
LyX in Windows.  I do not  use Windows, but I have seen this work.  I
might test it out and see if I can fix it if somebody promises to send
me a t-shirt.   I think either you can follow this plan or study this
plan and then try to update it to the approach that Gregor proposes.
Gregor takes advantage of the fact that Sweave is now a command line
batch option for R, but the way that Windows interacts with the
environment is so different from Unix that I'm not optimistic that
something so simple will work.

Here is my warning.  Your R code mistakes do not finish gracefully
with Lyx & Sweave.  The only way to tell what works is to run LyX from
a terminal window, where you can see the R error messages.  If you
start LyX from an Icon, as Windows users are prone to do, then you
will be completely helpless.


My student Frank Liu worked this set of instructions. I understand
that he has many students in Taiwan who are doing this, and I will
contact him to see if he has newer information.

I'm pretty sure that the library(tools) in the script below should be
changed to library(utils). I also think the last two lines of that
script are not strictly necessary.
pj

 Original Message 
Subject:Re: Rweave for Windows Lyx (problem solved!)
Date:   Sat, 04 Mar 2006 17:06:22 -0600
From:   Cheng-shan (Frank) Liu



Thank you, Nicolás. Also thank Uwe Ligges, Brian D. Ripley, and Paul
Johnson for their advices. Here is a summary of the advices about how to
make Rweave work in Lyx under Windows:

Suppose your Lyx is installed in C:\ProgramFiles\Lyx and your R in
C:\ProgramFiles\R-2.2.1.

1. Create a R file "MakeSweave.R" with the following lines and then put
it in "C:\ProgramFiles\Lyx\bin\" (this is a path registered in Lyx).

library(tools)
args <- commandArgs()
inp <- args[length(args)]
Sweave(inp)
base <- sub("\.(Rnw|Rtex)$", "", inp)
texi2dvi(paste("base", ".tex", sep=""), pdf=TRUE)
shell.exec(paste("base", ".pdf", sep=""))

2. Create a batch script called "Rweave.bat" with the follwowing line,
and put it in "C:\ProgramFiles\Lyx\bin\". (Note that back slash "/",
rather than slash "/", is used in the script.)
C:/ProgramFiles/R-2.2.1/bin/Rterm --no-save --args "%1"
 "%1.log"

3. Put noweb.sty (can be found in google, or simply grab this file:
http://www.lsi.upc.es/~tpl/noweb.sty) in
C:\ProgramFiles\Miktex\tex\latex\noweb\ and refresh MikTex.

4. Reconfigure Lyx (go to Edit-> Reconfigure). Check if you have
document class "article(noweb)" (Layout->Document), If not, you may need
to reinstall Lyx.

5. Last, make Lyx recognize the converter script Rweave. Go to
Edit->Preferences->Converters. In the "From" pulldown, choose Noweb. In
the "To" pulldown, choose LaTeX. Hit the "new" button toward the bottom.
Then, make sure the Converter Noweb->LaTeX is chosen, and in the box
called "Converter" type "Rweave $$i" without the quotation "".


To test if the installation is done, check out Dr. Paul Johnson's
example file (http://pj.freefaculty.org/stat/Distributions/Gamma-02.lyx
). See if you can view its pdf file.


-Frank Liu






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


Re: Converter failure with Sweave

2008-03-20 Thread Paul Johnson
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"
 "%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


MakeRweave.R
Description: Binary data


TestSweave.lyx
Description: application/lyx