On Jan 4, 2008 7:32 AM, Jean-Marc Lasgouttes <[EMAIL PROTECTED]> wrote:
> Gorjanc Gregor <[EMAIL PROTECTED]> writes:
>
> > take a look at
> > http://bugzilla.lyx.org/show_bug.cgi?id=4286
> >
> > I did try to change the milestone to 1.6, but was not able to do
> > that, since I was not the original poster.
>
> FWIW, I have downloaded the paper and began to read it. I am not sure
> what is the best way to proceed. I guess it would be enough to
> configure either noweb or Sweave depending on which one is available.
> Also it would be nice to be able to use this with any class. The new
> support for modules should be enough for that, but it needs thought
> and a bit of design. I doubt I will have time to work on it
> personally.
>
> Unfortunately, the target will be set to 1.6 only if we find somebody
> willing to work on it.
>
> JMarc
>

It appears to me that this is mostly superficial.  The change in the R
batch processing has simplified the problem somewhat from when I was
working on it originally.   Now it is no longer necessary to use that
small bash script to pass the LyX noweb output to R.  Rather, one can
simply make one Lyx preference change, either with the lyx GUI
preference changer or by adding a like like this in ~/.lyx/preferences

\converter "literate"  "latex" "R CMD Sweave $$i" ""

It appears to me this "does the trick" even if one does not install Sweave.sty.

Take one the lyx documents I have posted here (files that use the
ordinary Lyx noweb article layout)

http://pj.freefaculty.org/stat/Distributions

Take Normal-01.lyx. You can see how the output is supposed to look
because I have the pdf file posted as well.  If you have R installed,
then open the document in LyX and the document will be processed just
fine. I do not think it is necessary to put Sweave.sty in the LaTeX
path, but, as I originally said in 2006, it is necessary to have
noweb.sty.  It is not necessary to have the whole noweb installation,
just that file.

I think the other part--the layout part--is just cosmetic. It controls
the way the R code chunks look on the screen only. The R code chunks
can be written as ordinary ERT.  If the Lyx user is happy enough to
just put in ERT (without a layout representation in the on-screen
display), the document will go through LaTeX and R fine.  It does not
matter what the blocks of ERT are called.

You could follow Gregor's example and add a layout environment that is
common to all noweb document classes. It could be called "Scrap" or
"Schunk".  Note in Gregor's Layouts, the structure is simple.  He
includes the existing noweb document layout and a
"literate-scrap.inc".

There is a more serious problem that I was never able to overcome.  If
one writes a book LyX, the R code chunks will be properly processed
only if they are actually in the main book file.  If one follows the
usual practice of writing chapters and then putting them together with
includes in the main book file, then in my experience, the R code does
not get processed.  I would be eager to see a working example of an R
book that solved this problem.  I asked about this in the LyX user
list last year and didn't get any answers, so I assumed it was an
intractable problem.

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


Here's Sweave.sty:

\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{Sweave}{}

\RequirePackage{ifthen}
[EMAIL PROTECTED]
[EMAIL PROTECTED]
[EMAIL PROTECTED]
[EMAIL PROTECTED]

[EMAIL PROTECTED]
[EMAIL PROTECTED]
\ProcessOptions

\RequirePackage{graphicx,fancyvrb}
\IfFileExists{upquote.sty}{\RequirePackage{upquote}}{}

[EMAIL PROTECTED]
[EMAIL PROTECTED]
  \RequirePackage[T1]{fontenc}
  \RequirePackage{ae}
}{}%

\DefineVerbatimEnvironment{Sinput}{Verbatim}{fontshape=sl}
\DefineVerbatimEnvironment{Soutput}{Verbatim}{}
\DefineVerbatimEnvironment{Scode}{Verbatim}{fontshape=sl}

\newenvironment{Schunk}{}{}

Reply via email to