Hello!
I have interest in Sweave, which is a literate programming idea applied
in writing documents with code that produces some output in the document
- numbers, pictures. Sweave[1] uses LaTeX for the document and R[1] for
computing part. R is a popular language and environment for data
analysis (statistics) and graphics. Example is
--- Start Sweave example ---------------------------------------------
Some text, some text, some text, some text, some text, some text, some
text, some text, some text, some text, some text, some text, some text,
some text, some text, some text.
<<RIntro>>=
1+1
plot(x=1:10, y=1:10)
x <- 10 * 5,6
@
Some text, some text, some text, some text, some text, some text, some
text, some text, some text, some text, some text, some text, some text,
some text, some text, some text. x equals to \Sexpr{x}.
--- End Sweave example -----------------------------------------------
There were some attempts[3, 4] to fuse Sweave with LyX. Proposed "hack"
is a nice one and documented in Extended manual, but it is a hack. I
would like to provide direct support for Sweave in LyX without modifying
preference files/menus. Do you see some value in helping me with this -
I am willing to learn and I think that this should not be much of a work
to do.
Up to now I applied the following and I got things working - I added
this to preference file or appropriately modifying the menus:
\converter literate latex "R CMD Sweave $$i"
"parselog=listerrors g"
\converter literate program "R CMD Stangle $$i"
"originaldir,parselog=listerrors g"
I also tweaked system configure.py (preferable if this should be in
future LyX) getting the same effect. However, I am not satisfied with
this since with above changes user has to tweak the files/menus and I do
not have the support to import and export Sweave files and adding proper
entries in configure.py causes Noweb to disapear - since I use literate
for Sweave.
Additionaly if I add
\Format literate Rnw Sweave
I additionally get:
* support for exporting from LyX to Sweave Rnw file
But there are still problems for "wide use":
* Noweb disapears
* can not import Sweave file into LyX as they are weaved first
Is there any way to provide functionality for "several" literate systems
- if there are apropriate tools on the system of course? I know that
this can be tested in configure.py script, but the issue is how to setup
several literate formats. I guess I could use my own file format Sweave,
but I just can not convince LyX to import Sweave file to LyX. I see this
is/was done with noweb2lyx, but I can not find it on my Debian box,
neither in lyx-devel trunk or latest branch. I also get "no" in
configure when searching for noweb2lyx. Is this script somewhere else or
removed or ...? Now everytime when I import Noweb or Sweave file, they
are weaved first. I guess nobody using literate programming wants that.
I am really confused now.
Can you please provide me any pointers so I can try to work on this a
bit further.
[1]http://www.ci.tuwien.ac.at/%7Eleisch/Sweave/
[2]http://www.r-project.org
[3]http://wiki.lyx.org/LyX/LyxWithRThroughSweave
[4]http://www.ci.tuwien.ac.at/%7Eleisch/Sweave/LyX/
--
Lep pozdrav / With regards,
Gregor Gorjanc
----------------------------------------------------------------------
University of Ljubljana PhD student
Biotechnical Faculty
Zootechnical Department URI: http://www.bfro.uni-lj.si/MR/ggorjan
Groblje 3 mail: gregor.gorjanc <at> bfro.uni-lj.si
SI-1230 Domzale tel: +386 (0)1 72 17 861
Slovenia, Europe fax: +386 (0)1 72 17 888
----------------------------------------------------------------------
"One must learn by doing the thing; for though you think you know it,
you have no certainty until you try." Sophocles ~ 450 B.C.
----------------------------------------------------------------------