diff --git a/lib/Makefile.am b/lib/Makefile.am index 1dcbf11c1c..b9c6b2bbdc 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -1070,6 +1070,7 @@ dist_layouts_DATA =\ layouts/mwart.layout \ layouts/mwbk.layout \ layouts/mwrep.layout \ + layouts/noweb.module \ layouts/numarticle.inc \ layouts/numreport.inc \ layouts/numrevtex.inc \ @@ -1111,6 +1112,7 @@ dist_layouts_DATA =\ layouts/svjog.layout \ layouts/svjour.inc \ layouts/svprobth.layout \ + layouts/sweave.module \ layouts/tarticle.layout \ layouts/tbook.layout \ layouts/theorems-ams-extended.module \ diff --git a/lib/configure.py b/lib/configure.py index 94668e7233..853af75337 100644 --- a/lib/configure.py +++ b/lib/configure.py @@ -349,6 +349,7 @@ def checkFormatEntries(dtl_tools): \Format dot dot "Graphviz Dot" "" "" "%%" "vector" \Format platex tex "LaTeX (pLaTeX)" "" "" "%%" "document" \Format literate nw NoWeb N "" "%%" "document" +\Format sweave Rnw "Sweave" S "" "%%" "document" \Format lilypond ly "LilyPond music" "" "" "%%" "vector" \Format latex tex "LaTeX (plain)" L "" "%%" "document" \Format pdflatex tex "LaTeX (pdflatex)" "" "" "%%" "document" @@ -447,6 +448,10 @@ def checkConverterEntries(): checkProg('a Noweb -> LaTeX converter', ['noweave -delay -index $$i > $$o'], rc_entry = [r'''\converter literate latex "%%" "" \converter literate pdflatex "%%" ""''']) + # + checkProg('a Sweave -> LaTeX converter', ['R CMD Sweave $$i'], + rc_entry = [r'''\converter sweave latex "%%" "" +\converter sweave pdflatex "%%" ""''']) # path, elyx = checkProg('eLyXer converter', ['elyxer.py $$i $$o'], rc_entry = [ r'\converter lyx html2 "%%" ""' ] ) diff --git a/lib/layouts/noweb.module b/lib/layouts/noweb.module new file mode 100644 index 0000000000..0d97c4d3e8 --- /dev/null +++ b/lib/layouts/noweb.module @@ -0,0 +1,40 @@ +#\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 + +# FIXME: Use the Chunk layout from the sweave module? +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 diff --git a/lib/layouts/sweave.module b/lib/layouts/sweave.module new file mode 100644 index 0000000000..d579fb5897 --- /dev/null +++ b/lib/layouts/sweave.module @@ -0,0 +1,100 @@ +#\DeclareLyXModule[Sweave.sty]{Sweave - S/R literate programming} +#DescriptionBegin +#Allows to use the statistical language S/R as a literate programming tool - Sweave. +#DescriptionEnd + +# Within the chunk, lines are separated by newlines (Ctrl-Return)! + +# To add : +# - \setkeys{Gin}{width=0.8\textwidth} How to add such a "beast"? This is used to define +# the size of produced plots. + +Format 11 +OutputType literate +#OutputFormat sweave + +Style Chunk + Category Sweave + LatexType Paragraph + LatexName dummy + Margin static + ParSep 0.4 + TopSep 0.4 + BottomSep 0.4 + ItemSep 0.4 + Align Left + AlignPossible Block, Left, Right, Center + NewLine 0 + FreeSpacing 1 + PassThru 1 + ## What is LabelType used for? + LabelType Static + 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 "S/R expression" + LabelString "S/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 + +InsetLayout "Sweave Input File" + LabelString "Sweave Input File" + LatexType Command + LaTexName SweaveInput + 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