Jean-Marc Lasgouttes wrote: > > Here are a couple new modules that allow to use noweb or Sweave with any > document class. They replace literate-article and friends. > > - noweb.module is the plain one. > > - sweave.module is the one for use with R. It is not finished yet since > I only added support for \SweaveOpts and \SExpr macros (both as custom > insets: should they be CharStyles instead?). It would be nice to add > support for other macros, bit I am short on time ATM. Another thing > that would be nice is to support the plain latex format for Sweave, > but unfortunately it is not regular: the optional argument is enclosed > by {} instead of [] and LyX cannot produce that. > > I think those modules could be added to LyX 1.6.3 as they are, but > having somebody pick them up and improve that first would be nice... > > In the longer term (2.0), what I would like to do is to add a > OutputFormat tag to layout files that allow to specify whether we want > "noweb" or "sweave" format. With this, we can preset the converters in > configure.py. And this would also be a very simple way for anyone to set > up a preprocessor for latex files... > > JMarc
maybe the best is to CC Gorjan for feedback since he put lot of investigation effort into R<->LyX communication thourgh noweb. pavel > > svndiff lib/ > > Index: lib/layouts/sweave.module > =================================================================== > --- lib/layouts/sweave.module (revision 0) > +++ lib/layouts/sweave.module (revision 0) > @@ -0,0 +1,84 @@ > +#\DeclareLyXModule[Sweave.sty]{R/Sweave literate programming} > +#DescriptionBegin > +#Allows to use the statistical package R as a literate programming tool. > +#DescriptionEnd > + > +# Suggested style to write your code: > +# Within same chunk, lines are separated by newlines (Ctrl-Return), use: > +# ItemSep 0.4 > +# . disavantage: must type ctrl-return every single line > +# . advantage: looks better (IMHO) > +# resembles more closely the produced paper doc (more > WYSIWYG) > +# > + > +Format 11 > +OutputType literate > + > +Style Chunk > + Margin First_Dynamic > + LatexType Paragraph > + LatexName dummy > + NewLine 0 > + LeftMargin MMM > + ParSep 0.4 > + TopSep 0.4 > + BottomSep 0.4 > + ItemSep 0.4 > + Align Left > + AlignPossible Block,Left > + FreeSpacing 1 > + PassThru 1 > + LabelType Static > + LabelFont > + Color magenta > + EndFont > + TextFont > + Color latex > + Family Typewriter > + EndFont > +End > + > +Style Scrap > + ObsoletedBy Chunk > +End > + > + > +InsetLayout "Sweave Options" > + LabelString "Sweave opts" > + LatexType Command > + LaTexName SweaveOpts > + LyXType Custom > + Decoration Classic > + Font > + Color latex > + Family typewriter > + EndFont > + LabelFont > + Color latex > + Size Small > + EndFont > + MultiPar false > + PassThru true > + FreeSpacing true > + ForceLTR true > +End > + > +InsetLayout "R expression" > + LabelString "R expr" > + LatexType Command > + LaTexName Sexpr > + LyXType Custom > + Decoration Conglomerate > + Font > + Color latex > + Family typewriter > + EndFont > + LabelFont > + Color latex > + Size Small > + EndFont > + MultiPar false > + PassThru true > + FreeSpacing true > + ForceLTR true > +End > Index: lib/layouts/noweb.module > =================================================================== > --- lib/layouts/noweb.module (revision 0) > +++ lib/layouts/noweb.module (revision 0) > @@ -0,0 +1,39 @@ > +#\DeclareLyXModule[noweb.sty]{Noweb literate programming} > +#DescriptionBegin > +#Allows to use Noweb as a literate programming tool. > +#DescriptionEnd > + > +# Suggested style to write your code: > +# Within same scrap, lines are separated by newlines (Ctrl-Return), use: > +# ItemSep 0.4 > +# . disavantage: must type ctrl-return every single line > +# . advantage: looks better (IMHO) > +# resembles more closely the produced paper doc (more > WYSIWYG) > +# > + > +Format 11 > +OutputType literate > + > +Style Scrap > + Margin First_Dynamic > + LatexType Paragraph > + LatexName dummy > + NewLine 0 > + LeftMargin MMM > + ParSep 0.4 > + TopSep 0.4 > + BottomSep 0.4 > + ItemSep 0.4 > + Align Left > + AlignPossible Block,Left > + FreeSpacing 1 > + PassThru 1 > + LabelType Static > + LabelFont > + Color magenta > + EndFont > + TextFont > + Color latex > + Family Typewriter > + EndFont > +End > Index: lib/chkconfig.ltx > =================================================================== > --- lib/chkconfig.ltx (revision 28539) > +++ lib/chkconfig.ltx (working copy) > @@ -269,6 +269,7 @@ > \TestPackage{slashed} > \TestPackage{soul} > \TestPackage{subfig} > +\TestPackage{Sweave} > \TestPackage{textcomp} > \TestPackage{ulem} > \TestPackage{units}