On 1/23/08, Paul Johnson <[EMAIL PROTECTED]> wrote:
> Brief correction. I worked out a way in which to use Sweave within
> lyx. The instruction is posted in the Lyx Wiki
>
> http://wiki.lyx.org/LyX/LyxWithRThroughSweave

Based on Gregor's article and on recent discussions, these were the
changes needed to get LyX and Sweave up and running on my system
(Gentoo Linux).

1. Put noweb.sty [1] in your TeX PATH, followed by TeX rehash and LyX
reconfigure.
2. Add the following lines to the LyX preferences file:
# 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" ""

As a result, using LyX 1.5.2, pdflatex and R 2.6.1, the documents that
you made available Normal-01.lyx [2] and Gamma-02.lyx [3] compile like
a sweet.

Contrary to the Wikipedia entry, it doesn't seem necessary to create a
specific "Rweave" "batch" script for processing Rnw-files. I never got
into the subtleties of the applied changes, but those mentioned above
seem enough to make LyX and Sweave interact well together.

Regards,
Liviu

[1] http://tug.ctan.org/cgi-bin/getFile.py?fn=/web/noweb/src/tex/noweb.sty
[2] http://wiki.lyx.org/uploads/LaTeX/SweaveR/Normal-01.lyx
[3] http://wiki.lyx.org/uploads/LaTeX/SweaveR/Gamma-02.lyx

Reply via email to