Re: lyx2lyx conversion routines
On Thu, May 30, 2013 at 4:27 PM, Richard Heck wrote: > OK, I have fixed this, and I have also done the reversion routine. I am > going to go ahead and commit it. We can work out any other problems we see > more easily at that point. > I've tested trunk and cannot find any residual issues. Looks very nice. Liviu
Re: lyx2lyx conversion routines
On 05/29/2013 06:35 PM, Liviu Andronic wrote: Hey Richard, On Wed, May 29, 2013 at 3:37 PM, Richard Heck wrote: I think this is due to other format changes in trunk. New patch attached. Much nicer! The only issue that I still see is when the chunks follow each other as in the attached. Now the conversion routines lump the chunks together, although I would expect to get 3 different insets in 2.1. Could this be achieved? OK, I have fixed this, and I have also done the reversion routine. I am going to go ahead and commit it. We can work out any other problems we see more easily at that point. JMarc, time for tex2lyx work. Richard
Re: lyx2lyx conversion routines
Hey Richard, On Wed, May 29, 2013 at 3:37 PM, Richard Heck wrote: > I think this is due to other format changes in trunk. New patch attached. > Much nicer! The only issue that I still see is when the chunks follow each other as in the attached. Now the conversion routines lump the chunks together, although I would expect to get 3 different insets in 2.1. Could this be achieved? > If this works, then we need to do the reversion. Is the idea there to take > an inset and put each paragraph into a Chunk paragraph? With the optional > argument going into the first one, stuck into <<=...>>? > Yes. The content of the inset goes to a chunk style. It will be enclosed between <<>>= on top if no optional argument is present in the inset, or <>= if an optional argument containing "echo=F" is present. And between @ at the bottom. Let me know if this is not clear. Thanks, Liviu -- Do you know how to read? http://www.alienetworks.com/srtest.cfm http://goodies.xfce.org/projects/applications/xfce4-dict#speed-reader Do you know how to write? http://garbl.home.comcast.net/~garbl/stylemanual/e.htm#e-mail knitr-old.lyx Description: application/lyx knitr-old-conv.lyx Description: application/lyx
Re: lyx2lyx conversion routines
On 05/28/2013 04:42 PM, Liviu Andronic wrote: Richard, On Tue, May 28, 2013 at 6:46 AM, Richard Heck wrote: Try the attached. (The first patch is unchanged.) I still have trouble with this patch (after removing EOL and whitespace issues). When applying it fails on latest trunk: sh>patch -p1 < "0002-A-start-on-lyx2lyx-for-chunks.patch" (28091) patching file lib/lyx2lyx/lyx_2_1.py Hunk #1 succeeded at 4180 with fuzz 1 (offset 28 lines). Hunk #2 FAILED at 4313. 1 out of 2 hunks FAILED -- saving rejects to file lib/lyx2lyx/lyx_2_1.py.rej patching file src/version.h Hunk #1 FAILED at 30. 1 out of 1 hunk FAILED -- saving rejects to file src/version.h.rej sh>patch -p1 < "0002-A-start-on-lyx2lyx-for-chunks.patch" (28091) returned '1' Could you try rebasing it on latest trunk? Maybe this is causing the failure. I think this is due to other format changes in trunk. New patch attached. If this works, then we need to do the reversion. Is the idea there to take an inset and put each paragraph into a Chunk paragraph? With the optional argument going into the first one, stuck into <<=...>>? rh >From fc1771a0cf7d9a604a7f139c1630ad57dd7b2b97 Mon Sep 17 00:00:00 2001 From: Richard Heck Date: Wed, 29 May 2013 09:35:48 -0400 Subject: [PATCH] Patch to convert Sweave chunk paragraphs to insets (bug #8588). Work by Liviu (C++) and Richard (Python). --- lib/Makefile.am | 1 + lib/layouts/knitr.module | 27 +-- lib/layouts/noweb.module | 23 +- lib/layouts/sweave.module | 27 +-- lib/lyx2lyx/lyx_2_1.py| 111 +- src/version.h | 2 +- 6 files changed, 115 insertions(+), 76 deletions(-) diff --git a/lib/Makefile.am b/lib/Makefile.am index cfdbc94..39340a2 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -1932,6 +1932,7 @@ dist_layouts_DATA =\ layouts/lettre.layout \ layouts/lilypond.module \ layouts/linguistics.module \ + layouts/litinsets.inc \ layouts/llncs.layout \ layouts/logicalmkup.module \ layouts/ltugboat.layout \ diff --git a/lib/layouts/knitr.module b/lib/layouts/knitr.module index 0203973..e7ccb34 100644 --- a/lib/layouts/knitr.module +++ b/lib/layouts/knitr.module @@ -7,35 +7,10 @@ #Excludes: lilypond | sweave Format 45 +Input litinsets.inc OutputType literate OutputFormat knitr -Style Chunk - Category Sweave - LatexType Paragraph - LatexName dummy - Marginstatic - Align Left - AlignPossible Block, Left, Right, Center - TopSep0.7 - BottomSep 0.7 - NewLine 0 - FreeSpacing 1 - PassThru 1 - ParbreakIsNewline 1 - Spellcheck 0 - ## What is LabelType used for? - LabelType Static - TextFont - Color latex - Family Typewriter - EndFont -End - -Style Scrap - ObsoletedBy Chunk -End - InsetLayout "Flex:Sweave Options" LabelString "Sweave opts" LatexType Command diff --git a/lib/layouts/noweb.module b/lib/layouts/noweb.module index fc105fd..da8e96b 100644 --- a/lib/layouts/noweb.module +++ b/lib/layouts/noweb.module @@ -5,30 +5,9 @@ #Category: literate Format 45 +Input litinsets.inc OutputType literate AddToPreamble \usepackage{noweb} EndPreamble - -Style Chunk - MarginFirst_Dynamic - LatexType Paragraph - LatexName dummy - LeftMarginMMM - Align Left - AlignPossible Block,Left - NewLine 0 - FreeSpacing 1 - PassThru 1 - ParbreakIsNewline 1 - Spellcheck 0 - 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 index 9126420..dd0e642 100644 --- a/lib/layouts/sweave.module +++ b/lib/layouts/sweave.module @@ -7,6 +7,7 @@ #Excludes: lilypond Format 45 +Input litinsets.inc OutputType literate OutputFormat sweave @@ -20,32 +21,6 @@ AddToPreamble @ EndPreamble -Style Chunk - Category Sweave - LatexType Paragraph - LatexName dummy - Marginstatic - Align Left - AlignPossible Block, Left, Right, Center - TopSep0.7 - BottomSep 0.7 - NewLine 0 - FreeSpacing 1 - PassThru 1 - ParbreakIsNewline 1 - Spellcheck 0 - ## What is LabelType used for? - LabelType Static - TextFont - Color latex - Family Typewriter - EndFont -End - -Style Scrap - ObsoletedBy Chunk -End - InsetLayout "Flex:Sweave Options" LabelString "Sweave opts" LatexType Command diff --git a/lib/lyx2lyx/ly
Re: lyx2lyx conversion routines
Richard, On Tue, May 28, 2013 at 6:46 AM, Richard Heck wrote: > Try the attached. (The first patch is unchanged.) > I still have trouble with this patch (after removing EOL and whitespace issues). When applying it fails on latest trunk: sh>patch -p1 < "0002-A-start-on-lyx2lyx-for-chunks.patch" (28091) patching file lib/lyx2lyx/lyx_2_1.py Hunk #1 succeeded at 4180 with fuzz 1 (offset 28 lines). Hunk #2 FAILED at 4313. 1 out of 2 hunks FAILED -- saving rejects to file lib/lyx2lyx/lyx_2_1.py.rej patching file src/version.h Hunk #1 FAILED at 30. 1 out of 1 hunk FAILED -- saving rejects to file src/version.h.rej sh>patch -p1 < "0002-A-start-on-lyx2lyx-for-chunks.patch" (28091) returned '1' Could you try rebasing it on latest trunk? Maybe this is causing the failure. Thanks, Liviu
Re: lyx2lyx conversion routines
On 05/26/2013 09:35 AM, Liviu Andronic wrote: Hello, On Thu, May 23, 2013 at 10:11 PM, Richard Heck wrote: I have posted a lyx2lyx conversion routine to the bug report http://www.lyx.org/trac/ticket/8588#comment:23 Please test and let me know if there are problems. If so, please post the file causing the problems here, stripped down to be as minimal as possible. I've tested the patch and managed to come up with a 2.0.6 document that didn't get properly converted. Attached are the input and conversion result. I would have expected to get 4 different chunk insets, instead of 1. I think the docs are self-explanatory, but please let me know if I should be more verbose on what went wrong. Try the attached. (The first patch is unchanged.) rh >From f4323fbee7bfc418a4006f3a6f80ce17eee07fbc Mon Sep 17 00:00:00 2001 From: Richard Heck Date: Thu, 23 May 2013 16:00:48 -0400 Subject: [PATCH 1/2] Liviu's chunk patch. --- lib/Makefile.am | 1 + lib/layouts/knitr.module | 27 +-- lib/layouts/litinsets.inc | 41 + lib/layouts/noweb.module | 23 +-- lib/layouts/sweave.module | 27 +-- 5 files changed, 45 insertions(+), 74 deletions(-) create mode 100644 lib/layouts/litinsets.inc diff --git a/lib/Makefile.am b/lib/Makefile.am index cfdbc94..39340a2 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -1932,6 +1932,7 @@ dist_layouts_DATA =\ layouts/lettre.layout \ layouts/lilypond.module \ layouts/linguistics.module \ + layouts/litinsets.inc \ layouts/llncs.layout \ layouts/logicalmkup.module \ layouts/ltugboat.layout \ diff --git a/lib/layouts/knitr.module b/lib/layouts/knitr.module index 0203973..e7ccb34 100644 --- a/lib/layouts/knitr.module +++ b/lib/layouts/knitr.module @@ -7,35 +7,10 @@ #Excludes: lilypond | sweave Format 45 +Input litinsets.inc OutputType literate OutputFormat knitr -Style Chunk - Category Sweave - LatexType Paragraph - LatexName dummy - Marginstatic - Align Left - AlignPossible Block, Left, Right, Center - TopSep0.7 - BottomSep 0.7 - NewLine 0 - FreeSpacing 1 - PassThru 1 - ParbreakIsNewline 1 - Spellcheck 0 - ## What is LabelType used for? - LabelType Static - TextFont - Color latex - Family Typewriter - EndFont -End - -Style Scrap - ObsoletedBy Chunk -End - InsetLayout "Flex:Sweave Options" LabelString "Sweave opts" LatexType Command diff --git a/lib/layouts/litinsets.inc b/lib/layouts/litinsets.inc new file mode 100644 index 000..4f95019 --- /dev/null +++ b/lib/layouts/litinsets.inc @@ -0,0 +1,41 @@ +# Literate Chunk inset definitions. +# This defines the Chunk inset used in the literate modules. +# +# Author: Liviu Andronic +# +# Note that this file is included in sweave.module, +# knitr.module and noweb.module. + +Format 45 + +InsetLayout "Flex:Chunk" +LabelString "Chunk" +LatexType none +LyXType Custom +RightDelim@ +DecorationClassic + Font + Color latex + Family typewriter + EndFont + #LabelFont + #Color latex + #SizeSmall + #EndFont +MultiPar true + CustomParsfalse + ForcePlaintrue +PassThru 1 +ParbreakIsNewline 1 + KeepEmpty true +Spellcheck0 +FreeSpacing true +ForceLTR true +Argument 1 +Mandatory 1 +LabelString "Options" +Tooltip "Options" +LeftDelim << +RightDelim>>= +EndArgument +End diff --git a/lib/layouts/noweb.module b/lib/layouts/noweb.module index fc105fd..da8e96b 100644 --- a/lib/layouts/noweb.module +++ b/lib/layouts/noweb.module @@ -5,30 +5,9 @@ #Category: literate Format 45 +Input litinsets.inc OutputType literate AddToPreamble \usepackage{noweb} EndPreamble - -Style Chunk - MarginFirst_Dynamic - LatexType Paragraph - LatexName dummy - LeftMarginMMM - Align Left - AlignPossible Block,Left - NewLine 0 - FreeSpacing 1 - PassThru 1 - ParbreakIsNewline 1 - Spellcheck 0 - 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 index 9126420..dd0e642 100644 --- a/lib/layouts/sweave.module +++ b/lib/layouts/sweave.module @@ -
Re: lyx2lyx conversion routines
On 05/26/2013 09:35 AM, Liviu Andronic wrote: Hello, On Thu, May 23, 2013 at 10:11 PM, Richard Heck wrote: I have posted a lyx2lyx conversion routine to the bug report http://www.lyx.org/trac/ticket/8588#comment:23 Please test and let me know if there are problems. If so, please post the file causing the problems here, stripped down to be as minimal as possible. I've tested the patch and managed to come up with a 2.0.6 document that didn't get properly converted. Attached are the input and conversion result. I would have expected to get 4 different chunk insets, instead of 1. I think the docs are self-explanatory, but please let me know if I should be more verbose on what went wrong. OK, I'll have a look. rh
Re: lyx2lyx conversion routines
On 05/26/2013 07:30 AM, Liviu Andronic wrote: On Sun, May 26, 2013 at 12:38 PM, Vincent van Ravesteijn wrote: I had the same error in the first try. After correcting the eol-style of the patch file, everything was ok again. To correct the eol-style I used 'dos2unix' in a Git bash shell. I did the EOL corrections using Geany. I'm puzzled here. This patch was generated the same way I always generate these patches: git format-patch HEAD~2 or whatever. I've never seen this kind of problem before. Any ideas? Richard
lyx2lyx conversion routines
Hello, On Thu, May 23, 2013 at 10:11 PM, Richard Heck wrote: > > I have posted a lyx2lyx conversion routine to the bug report > http://www.lyx.org/trac/ticket/8588#comment:23 > Please test and let me know if there are problems. If so, please post the > file causing the problems here, stripped down to be as minimal as possible. > I've tested the patch and managed to come up with a 2.0.6 document that didn't get properly converted. Attached are the input and conversion result. I would have expected to get 4 different chunk insets, instead of 1. I think the docs are self-explanatory, but please let me know if I should be more verbose on what went wrong. Thanks, Liviu > I have not yet written the REversion routine. I'll do that after this is > right. > > Richard > > > > On 05/23/2013 12:25 PM, Liviu Andronic wrote: > > On Thu, May 23, 2013 at 6:14 PM, Richard Heck wrote: > > So we take what's in the first Chunk paragraph, strip off the << and >>= > delimiters, and put that into the argument of the Chunk inset. > > Yes. Often after stripping the contents will be an empty string (""). > Then I think there is no need to include the Chunk argument inset. > > > Then we take > everything up to the last Chunk paragraph, put that as a sequence of > paragraphs into the Chunk inset, and discard the last Chunk paragraph. Yes? > > That is my understanding, too. I attach a new pair of examples that > contain multiple lines of code. Old Style version: > \begin_layout Chunk > <>= > \end_layout > > \begin_layout Chunk > 2+2 > \end_layout > > \begin_layout Chunk > 3+3 > \end_layout > > \begin_layout Chunk > @ > \end_layout > > > New Inset version: > \begin_layout Standard > \begin_inset Flex Chunk > status open > > \begin_layout Plain Layout > > \begin_inset Argument 1 > status open > > \begin_layout Plain Layout > TEST > \end_layout > > \end_inset > > 2+2 > \end_layout > > \begin_layout Plain Layout > > 3+3 > \end_layout > > \end_inset > > > \end_layout > > > Liviu > > > Richard > > > > On 05/23/2013 12:11 PM, Liviu Andronic wrote: > > Richard, > I'm sorry but I gave you an imperfect equivalent for the inset > example. The attached knitr-new.lyx is better, and also uses the > argument inset. The relevant bits are: > > \begin_layout Standard > \begin_inset Flex Chunk > status open > > \begin_layout Plain Layout > > \begin_inset Argument 1 > status open > > \begin_layout Plain Layout > > TEST > \end_layout > > \end_inset > > 2+2 > \end_layout > > \end_inset > > > \end_layout > > > The code below is the old-style equivalent of the above. > > > On Thu, May 23, 2013 at 5:17 PM, Richard Heck wrote: > > \begin_layout Chunk > <>= > \end_layout > > \begin_layout Chunk > 2+2 > \end_layout > > \begin_layout Chunk > @ > \end_layout > > Is it correct, then, to remove the first and last chunks, and leave only > the > middle bit? > > I do not have a good understanding of the LyX file format. Maybe JMarc > knows better? > > Liviu > > > > -- Do you know how to read? http://www.alienetworks.com/srtest.cfm http://goodies.xfce.org/projects/applications/xfce4-dict#speed-reader Do you know how to write? http://garbl.home.comcast.net/~garbl/stylemanual/e.htm#e-mail knitr-old.lyx Description: application/lyx knitr-old-conv.lyx Description: application/lyx
Re: lyx2lyx conversion routines
On Sun, May 26, 2013 at 12:38 PM, Vincent van Ravesteijn wrote: > I had the same error in the first try. After correcting the eol-style of the > patch file, everything was ok again. To correct the eol-style I used > 'dos2unix' in a Git bash shell. > I did the EOL corrections using Geany. But if you retry the patch on latest trunk it will likely fail because of http://git.lyx.org/?p=lyx.git;a=commitdiff;h=e28625160a5078ffb37fc27ad3906edf5a73a31f I had to checkout that revision into a branch for teh patch to apply. Thanks, Liviu
Re: lyx2lyx conversion routines
Op 26-5-2013 8:53, Liviu Andronic schreef: Hello Richard, On Sun, May 26, 2013 at 12:24 AM, Richard Heck wrote: These are just whitespace issues. I've fixed them in the attached, which are also rebased to current trunk. I made some partial progress. I managed to apply the first patch only after I stripped trailing spaces from the patch _and_ changed line-endings from CRLF (Win) to LF (Unix). I guess it's a GIT-related Windows-Linux incompatibility. git apply "0001-Liviu-s-chunk-patch.patch" (15337) git apply "0001-Liviu-s-chunk-patch.patch" (15337) returned '0' However I'm still stumbling on the second, even after the post-processing above: git apply "0002-A-start-on-lyx2lyx-for-chunks.patch" (15371) error: patch failed: lib/lyx2lyx/lyx_2_1.py:4152 error: lib/lyx2lyx/lyx_2_1.py: patch does not apply error: patch failed: src/version.h:30 error: src/version.h: patch does not apply git apply "0002-A-start-on-lyx2lyx-for-chunks.patch" (15371) returned '1' I had the same error in the first try. After correcting the eol-style of the patch file, everything was ok again. To correct the eol-style I used 'dos2unix' in a Git bash shell. Vincent
Re: lyx2lyx conversion routines
On Sun, May 26, 2013 at 8:53 AM, Liviu Andronic wrote: > However I'm still stumbling on the second, even after the > post-processing above: >>git apply "0002-A-start-on-lyx2lyx-for-chunks.patch" (15371) > error: patch failed: lib/lyx2lyx/lyx_2_1.py:4152 > error: lib/lyx2lyx/lyx_2_1.py: patch does not apply > error: patch failed: src/version.h:30 > error: src/version.h: patch does not apply >>git apply "0002-A-start-on-lyx2lyx-for-chunks.patch" (15371) returned '1' > If I apply the patches using 'patch', then this is what I get: sh>patch -p1 < "0002-A-start-on-lyx2lyx-for-chunks.patch" (16151) patching file lib/lyx2lyx/lyx_2_1.py Hunk #1 succeeded at 4180 with fuzz 1 (offset 28 lines). Hunk #2 FAILED at 4313. 1 out of 2 hunks FAILED -- saving rejects to file lib/lyx2lyx/lyx_2_1.py.rej patching file src/version.h Hunk #1 FAILED at 30. 1 out of 1 hunk FAILED -- saving rejects to file src/version.h.rej sh>patch -p1 < "0002-A-start-on-lyx2lyx-for-chunks.patch" (16151) returned '1' Has the trunk moved between the patch rebase and now? Liviu
Re: lyx2lyx conversion routines
Hello Richard, On Sun, May 26, 2013 at 12:24 AM, Richard Heck wrote: > These are just whitespace issues. I've fixed them in the attached, which are > also rebased to current trunk. > I made some partial progress. I managed to apply the first patch only after I stripped trailing spaces from the patch _and_ changed line-endings from CRLF (Win) to LF (Unix). I guess it's a GIT-related Windows-Linux incompatibility. >git apply "0001-Liviu-s-chunk-patch.patch" (15337) >git apply "0001-Liviu-s-chunk-patch.patch" (15337) returned '0' However I'm still stumbling on the second, even after the post-processing above: >git apply "0002-A-start-on-lyx2lyx-for-chunks.patch" (15371) error: patch failed: lib/lyx2lyx/lyx_2_1.py:4152 error: lib/lyx2lyx/lyx_2_1.py: patch does not apply error: patch failed: src/version.h:30 error: src/version.h: patch does not apply >git apply "0002-A-start-on-lyx2lyx-for-chunks.patch" (15371) returned '1' I tried to clean up my local tree as follows: root@liv-laptop:/home/liv/Build/lyx# git clean -f root@liv-laptop:/home/liv/Build/lyx# git stash No local changes to save root@liv-laptop:/home/liv/Build/lyx# git pull Already up-to-date. Any ideas what is wrong? Liviu
Re: lyx2lyx conversion routines
On 05/25/2013 03:54 PM, Liviu Andronic wrote: Dear Richard, I must admit that I'm a bit lost. On Sat, May 25, 2013 at 12:20 AM, Richard Heck wrote: Try: git apply FILE.patch That should work. The patches are based off 01add2d52f, so you could do: git checkout -b Chunks 01add2d52f first, if you want. I tried to apply the patches but failed. If I do: root@liv-laptop:/home/liv/Build/lyx# git checkout -b Chunks 01add2d52f Switched to a new branch 'Chunks' and then: git apply "0001-Liviu-s-chunk-patch.patch" (5272) 0001-Liviu-s-chunk-patch.patch:74: trailing whitespace. # Literate Chunk inset definitions. 0001-Liviu-s-chunk-patch.patch:79: trailing whitespace. # Note that this file is included in sweave.module, 0001-Liviu-s-chunk-patch.patch:80: trailing whitespace. # knitr.module and noweb.module. warning: 3 lines add whitespace errors. git apply "0001-Liviu-s-chunk-patch.patch" (5272) returned '0' git apply "0002-A-start-on-lyx2lyx-for-chunks.patch" (5513) 0002-A-start-on-lyx2lyx-for-chunks.patch:32: trailing whitespace. 0002-A-start-on-lyx2lyx-for-chunks.patch:34: trailing whitespace. 0002-A-start-on-lyx2lyx-for-chunks.patch:58: trailing whitespace. 0002-A-start-on-lyx2lyx-for-chunks.patch:65: trailing whitespace. 0002-A-start-on-lyx2lyx-for-chunks.patch:67: trailing whitespace. warning: squelched 11 whitespace errors warning: 16 lines add whitespace errors. git apply "0002-A-start-on-lyx2lyx-for-chunks.patch" (5513) returned '0' I must be doing something wrong, but I'm not sure how to do it right. Please advise. These are just whitespace issues. I've fixed them in the attached, which are also rebased to current trunk. Richard >From f4323fbee7bfc418a4006f3a6f80ce17eee07fbc Mon Sep 17 00:00:00 2001 From: Richard Heck Date: Thu, 23 May 2013 16:00:48 -0400 Subject: [PATCH 1/2] Liviu's chunk patch. --- lib/Makefile.am | 1 + lib/layouts/knitr.module | 27 +-- lib/layouts/litinsets.inc | 41 + lib/layouts/noweb.module | 23 +-- lib/layouts/sweave.module | 27 +-- 5 files changed, 45 insertions(+), 74 deletions(-) create mode 100644 lib/layouts/litinsets.inc diff --git a/lib/Makefile.am b/lib/Makefile.am index cfdbc94..39340a2 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -1932,6 +1932,7 @@ dist_layouts_DATA =\ layouts/lettre.layout \ layouts/lilypond.module \ layouts/linguistics.module \ + layouts/litinsets.inc \ layouts/llncs.layout \ layouts/logicalmkup.module \ layouts/ltugboat.layout \ diff --git a/lib/layouts/knitr.module b/lib/layouts/knitr.module index 0203973..e7ccb34 100644 --- a/lib/layouts/knitr.module +++ b/lib/layouts/knitr.module @@ -7,35 +7,10 @@ #Excludes: lilypond | sweave Format 45 +Input litinsets.inc OutputType literate OutputFormat knitr -Style Chunk - Category Sweave - LatexType Paragraph - LatexName dummy - Marginstatic - Align Left - AlignPossible Block, Left, Right, Center - TopSep0.7 - BottomSep 0.7 - NewLine 0 - FreeSpacing 1 - PassThru 1 - ParbreakIsNewline 1 - Spellcheck 0 - ## What is LabelType used for? - LabelType Static - TextFont - Color latex - Family Typewriter - EndFont -End - -Style Scrap - ObsoletedBy Chunk -End - InsetLayout "Flex:Sweave Options" LabelString "Sweave opts" LatexType Command diff --git a/lib/layouts/litinsets.inc b/lib/layouts/litinsets.inc new file mode 100644 index 000..4f95019 --- /dev/null +++ b/lib/layouts/litinsets.inc @@ -0,0 +1,41 @@ +# Literate Chunk inset definitions. +# This defines the Chunk inset used in the literate modules. +# +# Author: Liviu Andronic +# +# Note that this file is included in sweave.module, +# knitr.module and noweb.module. + +Format 45 + +InsetLayout "Flex:Chunk" +LabelString "Chunk" +LatexType none +LyXType Custom +RightDelim@ +DecorationClassic + Font + Color latex + Family typewriter + EndFont + #LabelFont + #Color latex + #SizeSmall + #EndFont +MultiPar true + CustomParsfalse + ForcePlaintrue +PassThru 1 +ParbreakIsNewline 1 + KeepEmpty true +Spellcheck0 +FreeSpacing true +ForceLTR true +Argument 1 +Mandatory 1 +LabelString "Options" +Tooltip "Options" +LeftDelim << +RightDelim>>= +EndArgument +End diff --git a/lib/layouts/noweb.module b/lib/layouts/noweb.mod
Re: lyx2lyx conversion routines (was: Re: #8588: add Sweave Chunk inset)
Dear Richard, I must admit that I'm a bit lost. On Sat, May 25, 2013 at 12:20 AM, Richard Heck wrote: > Try: > git apply FILE.patch > That should work. The patches are based off 01add2d52f, so you could do: > git checkout -b Chunks 01add2d52f > first, if you want. > I tried to apply the patches but failed. If I do: root@liv-laptop:/home/liv/Build/lyx# git checkout -b Chunks 01add2d52f Switched to a new branch 'Chunks' and then: >git apply "0001-Liviu-s-chunk-patch.patch" (5272) 0001-Liviu-s-chunk-patch.patch:74: trailing whitespace. # Literate Chunk inset definitions. 0001-Liviu-s-chunk-patch.patch:79: trailing whitespace. # Note that this file is included in sweave.module, 0001-Liviu-s-chunk-patch.patch:80: trailing whitespace. # knitr.module and noweb.module. warning: 3 lines add whitespace errors. >git apply "0001-Liviu-s-chunk-patch.patch" (5272) returned '0' >git apply "0002-A-start-on-lyx2lyx-for-chunks.patch" (5513) 0002-A-start-on-lyx2lyx-for-chunks.patch:32: trailing whitespace. 0002-A-start-on-lyx2lyx-for-chunks.patch:34: trailing whitespace. 0002-A-start-on-lyx2lyx-for-chunks.patch:58: trailing whitespace. 0002-A-start-on-lyx2lyx-for-chunks.patch:65: trailing whitespace. 0002-A-start-on-lyx2lyx-for-chunks.patch:67: trailing whitespace. warning: squelched 11 whitespace errors warning: 16 lines add whitespace errors. >git apply "0002-A-start-on-lyx2lyx-for-chunks.patch" (5513) returned '0' I must be doing something wrong, but I'm not sure how to do it right. Please advise. Liviu
Re: lyx2lyx conversion routines (was: Re: #8588: add Sweave Chunk inset)
On 05/24/2013 05:55 PM, Liviu Andronic wrote: On Thu, May 23, 2013 at 10:11 PM, Richard Heck wrote: I have posted a lyx2lyx conversion routine to the bug report http://www.lyx.org/trac/ticket/8588#comment:23 Please test and let me know if there are problems. If so, please post the Richard, I'm afraid I'm having problems with applying the patches. Using latest trunk I tried all combinations between patch < %f to patch -p3 < %f but I keep getting skipped patches and rejected hunks. How should I apply the patches? Try: git apply FILE.patch That should work. The patches are based off 01add2d52f, so you could do: git checkout -b Chunks 01add2d52f first, if you want. rh
Re: lyx2lyx conversion routines (was: Re: #8588: add Sweave Chunk inset)
On Thu, May 23, 2013 at 10:11 PM, Richard Heck wrote: > > I have posted a lyx2lyx conversion routine to the bug report > http://www.lyx.org/trac/ticket/8588#comment:23 > Please test and let me know if there are problems. If so, please post the > Richard, I'm afraid I'm having problems with applying the patches. Using latest trunk I tried all combinations between patch < %f to patch -p3 < %f but I keep getting skipped patches and rejected hunks. How should I apply the patches? Thanks, Liviu > file causing the problems here, stripped down to be as minimal as possible. > > I have not yet written the REversion routine. I'll do that after this is > right. > > Richard > > > > On 05/23/2013 12:25 PM, Liviu Andronic wrote: > > On Thu, May 23, 2013 at 6:14 PM, Richard Heck wrote: > > So we take what's in the first Chunk paragraph, strip off the << and >>= > delimiters, and put that into the argument of the Chunk inset. > > Yes. Often after stripping the contents will be an empty string (""). > Then I think there is no need to include the Chunk argument inset. > > > Then we take > everything up to the last Chunk paragraph, put that as a sequence of > paragraphs into the Chunk inset, and discard the last Chunk paragraph. Yes? > > That is my understanding, too. I attach a new pair of examples that > contain multiple lines of code. Old Style version: > \begin_layout Chunk > <>= > \end_layout > > \begin_layout Chunk > 2+2 > \end_layout > > \begin_layout Chunk > 3+3 > \end_layout > > \begin_layout Chunk > @ > \end_layout > > > New Inset version: > \begin_layout Standard > \begin_inset Flex Chunk > status open > > \begin_layout Plain Layout > > \begin_inset Argument 1 > status open > > \begin_layout Plain Layout > TEST > \end_layout > > \end_inset > > 2+2 > \end_layout > > \begin_layout Plain Layout > > 3+3 > \end_layout > > \end_inset > > > \end_layout > > > Liviu > > > Richard > > > > On 05/23/2013 12:11 PM, Liviu Andronic wrote: > > Richard, > I'm sorry but I gave you an imperfect equivalent for the inset > example. The attached knitr-new.lyx is better, and also uses the > argument inset. The relevant bits are: > > \begin_layout Standard > \begin_inset Flex Chunk > status open > > \begin_layout Plain Layout > > \begin_inset Argument 1 > status open > > \begin_layout Plain Layout > > TEST > \end_layout > > \end_inset > > 2+2 > \end_layout > > \end_inset > > > \end_layout > > > The code below is the old-style equivalent of the above. > > > On Thu, May 23, 2013 at 5:17 PM, Richard Heck wrote: > > \begin_layout Chunk > <>= > \end_layout > > \begin_layout Chunk > 2+2 > \end_layout > > \begin_layout Chunk > @ > \end_layout > > Is it correct, then, to remove the first and last chunks, and leave only > the > middle bit? > > I do not have a good understanding of the LyX file format. Maybe JMarc > knows better? > > Liviu > > > > -- Do you know how to read? http://www.alienetworks.com/srtest.cfm http://goodies.xfce.org/projects/applications/xfce4-dict#speed-reader Do you know how to write? http://garbl.home.comcast.net/~garbl/stylemanual/e.htm#e-mail
Re: lyx2lyx conversion routines (was: Re: #8588: add Sweave Chunk inset)
I have posted a lyx2lyx conversion routine to the bug report http://www.lyx.org/trac/ticket/8588#comment:23 Please test and let me know if there are problems. If so, please post the file causing the problems here, stripped down to be as minimal as possible. I have not yet written the REversion routine. I'll do that after this is right. Richard On 05/23/2013 12:25 PM, Liviu Andronic wrote: On Thu, May 23, 2013 at 6:14 PM, Richard Heck wrote: So we take what's in the first Chunk paragraph, strip off the << and >>= delimiters, and put that into the argument of the Chunk inset. Yes. Often after stripping the contents will be an empty string (""). Then I think there is no need to include the Chunk argument inset. Then we take everything up to the last Chunk paragraph, put that as a sequence of paragraphs into the Chunk inset, and discard the last Chunk paragraph. Yes? That is my understanding, too. I attach a new pair of examples that contain multiple lines of code. Old Style version: \begin_layout Chunk <>= \end_layout \begin_layout Chunk 2+2 \end_layout \begin_layout Chunk 3+3 \end_layout \begin_layout Chunk @ \end_layout New Inset version: \begin_layout Standard \begin_inset Flex Chunk status open \begin_layout Plain Layout \begin_inset Argument 1 status open \begin_layout Plain Layout TEST \end_layout \end_inset 2+2 \end_layout \begin_layout Plain Layout 3+3 \end_layout \end_inset \end_layout Liviu Richard On 05/23/2013 12:11 PM, Liviu Andronic wrote: Richard, I'm sorry but I gave you an imperfect equivalent for the inset example. The attached knitr-new.lyx is better, and also uses the argument inset. The relevant bits are: \begin_layout Standard \begin_inset Flex Chunk status open \begin_layout Plain Layout \begin_inset Argument 1 status open \begin_layout Plain Layout TEST \end_layout \end_inset 2+2 \end_layout \end_inset \end_layout The code below is the old-style equivalent of the above. On Thu, May 23, 2013 at 5:17 PM, Richard Heck wrote: \begin_layout Chunk <>= \end_layout \begin_layout Chunk 2+2 \end_layout \begin_layout Chunk @ \end_layout Is it correct, then, to remove the first and last chunks, and leave only the middle bit? I do not have a good understanding of the LyX file format. Maybe JMarc knows better? Liviu
Re: lyx2lyx conversion routines (was: Re: #8588: add Sweave Chunk inset)
On Thu, May 23, 2013 at 6:14 PM, Richard Heck wrote: > > So we take what's in the first Chunk paragraph, strip off the << and >>= > delimiters, and put that into the argument of the Chunk inset. > Yes. Often after stripping the contents will be an empty string (""). Then I think there is no need to include the Chunk argument inset. > Then we take > everything up to the last Chunk paragraph, put that as a sequence of > paragraphs into the Chunk inset, and discard the last Chunk paragraph. Yes? > That is my understanding, too. I attach a new pair of examples that contain multiple lines of code. Old Style version: \begin_layout Chunk <>= \end_layout \begin_layout Chunk 2+2 \end_layout \begin_layout Chunk 3+3 \end_layout \begin_layout Chunk @ \end_layout New Inset version: \begin_layout Standard \begin_inset Flex Chunk status open \begin_layout Plain Layout \begin_inset Argument 1 status open \begin_layout Plain Layout TEST \end_layout \end_inset 2+2 \end_layout \begin_layout Plain Layout 3+3 \end_layout \end_inset \end_layout Liviu > Richard > > > > On 05/23/2013 12:11 PM, Liviu Andronic wrote: >> >> Richard, >> I'm sorry but I gave you an imperfect equivalent for the inset >> example. The attached knitr-new.lyx is better, and also uses the >> argument inset. The relevant bits are: >> >> \begin_layout Standard >> \begin_inset Flex Chunk >> status open >> >> \begin_layout Plain Layout >> >> \begin_inset Argument 1 >> status open >> >> \begin_layout Plain Layout >> >> TEST >> \end_layout >> >> \end_inset >> >> 2+2 >> \end_layout >> >> \end_inset >> >> >> \end_layout >> >> >> The code below is the old-style equivalent of the above. >> >> >> On Thu, May 23, 2013 at 5:17 PM, Richard Heck wrote: >>> >>> \begin_layout Chunk >>> <>= >>> \end_layout >>> >>> \begin_layout Chunk >>> 2+2 >>> \end_layout >>> >>> \begin_layout Chunk >>> @ >>> \end_layout >>> >>> Is it correct, then, to remove the first and last chunks, and leave only >>> the >>> middle bit? >>> >> I do not have a good understanding of the LyX file format. Maybe JMarc >> knows better? >> >> Liviu > > -- Do you know how to read? http://www.alienetworks.com/srtest.cfm http://goodies.xfce.org/projects/applications/xfce4-dict#speed-reader Do you know how to write? http://garbl.home.comcast.net/~garbl/stylemanual/e.htm#e-mail knitr.lyx Description: Binary data knitr-new.lyx Description: Binary data
Re: lyx2lyx conversion routines (was: Re: #8588: add Sweave Chunk inset)
So we take what's in the first Chunk paragraph, strip off the << and >>= delimiters, and put that into the argument of the Chunk inset. Then we take everything up to the last Chunk paragraph, put that as a sequence of paragraphs into the Chunk inset, and discard the last Chunk paragraph. Yes? Richard On 05/23/2013 12:11 PM, Liviu Andronic wrote: Richard, I'm sorry but I gave you an imperfect equivalent for the inset example. The attached knitr-new.lyx is better, and also uses the argument inset. The relevant bits are: \begin_layout Standard \begin_inset Flex Chunk status open \begin_layout Plain Layout \begin_inset Argument 1 status open \begin_layout Plain Layout TEST \end_layout \end_inset 2+2 \end_layout \end_inset \end_layout The code below is the old-style equivalent of the above. On Thu, May 23, 2013 at 5:17 PM, Richard Heck wrote: \begin_layout Chunk <>= \end_layout \begin_layout Chunk 2+2 \end_layout \begin_layout Chunk @ \end_layout Is it correct, then, to remove the first and last chunks, and leave only the middle bit? I do not have a good understanding of the LyX file format. Maybe JMarc knows better? Liviu
Re: lyx2lyx conversion routines (was: Re: #8588: add Sweave Chunk inset)
Richard, I'm sorry but I gave you an imperfect equivalent for the inset example. The attached knitr-new.lyx is better, and also uses the argument inset. The relevant bits are: \begin_layout Standard \begin_inset Flex Chunk status open \begin_layout Plain Layout \begin_inset Argument 1 status open \begin_layout Plain Layout TEST \end_layout \end_inset 2+2 \end_layout \end_inset \end_layout The code below is the old-style equivalent of the above. On Thu, May 23, 2013 at 5:17 PM, Richard Heck wrote: > \begin_layout Chunk > <>= > \end_layout > > \begin_layout Chunk > 2+2 > \end_layout > > \begin_layout Chunk > @ > \end_layout > > Is it correct, then, to remove the first and last chunks, and leave only the > middle bit? > I do not have a good understanding of the LyX file format. Maybe JMarc knows better? Liviu knitr-new.lyx Description: Binary data
Re: lyx2lyx conversion routines (was: Re: #8588: add Sweave Chunk inset)
So the relevant bits of these files look like: \begin_layout Chunk <>= \end_layout \begin_layout Chunk 2+2 \end_layout \begin_layout Chunk @ \end_layout and: \begin_layout Standard \begin_inset Flex Chunk status open \begin_layout Plain Layout 2+2 \end_layout \end_inset \end_layout Is it correct, then, to remove the first and last chunks, and leave only the middle bit? Richard
Re: lyx2lyx conversion routines (was: Re: #8588: add Sweave Chunk inset)
Hello Richard, On Thu, May 23, 2013 at 3:55 PM, Richard Heck wrote: >> provide the lyx2lyx bits. We need to take any sequence of Chunk >> layouts and replace them by a Chunk inset. If the Chunk has some >> alignments parameters, they should be given to the Standard layout >> paragraph that holds the Chunk layout. > > Can you post an example file I can use for testing? > I attach an old-style knitr.lyx file containing a chunk style with 2+2 code in it. And a new-style knitr-new.lyx equivalent, this time with a chunk inset containing 2+2. Let me know if you need anything else. Thanks , Liviu knitr.lyx Description: Binary data knitr-new.lyx Description: Binary data
Re: lyx2lyx conversion routines (was: Re: #8588: add Sweave Chunk inset)
On 05/18/2013 03:02 AM, Liviu Andronic wrote: Dear all, JMarc and I decided to go ahead with the Chunk inset for the literate modules in 2.1, and now we're only missing the lyx2lyx conversion routines. Now the patch is available on the bug tracker ( http://www.lyx.org/trac/ticket/8588 : litinsets.inc and sweave-knitr-noweb-inset-chunk.patch), and we ask for a kind soul to provide the lyx2lyx bits. We need to take any sequence of Chunk layouts and replace them by a Chunk inset. If the Chunk has some alignments parameters, they should be given to the Standard layout paragraph that holds the Chunk layout. Can you post an example file I can use for testing? Richard
lyx2lyx conversion routines (was: Re: #8588: add Sweave Chunk inset)
Dear all, JMarc and I decided to go ahead with the Chunk inset for the literate modules in 2.1, and now we're only missing the lyx2lyx conversion routines. Now the patch is available on the bug tracker ( http://www.lyx.org/trac/ticket/8588 : litinsets.inc and sweave-knitr-noweb-inset-chunk.patch), and we ask for a kind soul to provide the lyx2lyx bits. We need to take any sequence of Chunk layouts and replace them by a Chunk inset. If the Chunk has some alignments parameters, they should be given to the Standard layout paragraph that holds the Chunk layout. Could anyone help us with that? Regards, Liviu On Wed, May 15, 2013 at 5:05 PM, LyX Ticket Tracker wrote: > #8588: add Sweave Chunk inset > ---+- > [..] > 3. For that, you send your current patch to the list and ask a kind soul > to provide the lyx2lyx bits, by describing precisely what you need: take > any sequence of Chunk layouts and replace them by a Chunk inset. If the > Chunk has some alignments parameters, they should be given to the Standard > layout paragraph that holds the Chunk layout. > > -- > Ticket URL: <http://www.lyx.org/trac/ticket/8588#comment:19> > The LyX Project <http://www.lyx.org/> > LyX -- The Document Processor