Working with Lyx and Sweave; pasting R-code from Emacs into Lyx seems awkward. Any suggestions?

2013-04-14 Thread Mark Dalphin

Hi,

I use Lyx for writing reports on data analysis. To incorporate results 
from those analysis, I use Sweave within Lyx. This is all nicely 
integrated in the recent versions of Lyx. There is one major 
inconvenience remaining for me, however, and that is described here.


I usually develop my R-code in Emacs (ESS-mode). This permits me to 
refine my tables and graphs before I incorporate them into Lyx. This is 
much faster as it interactive and avoids the time to run LaTeX (or 
export the R, etc etc). Then I write the text part of my report, and, in 
the Lyx scrap, I paste the required chunks of R-code. Nice and simple 
(thank you!). The problem is that when I paste the R-code from Emacs to 
the Lyx scrap, the End-Of-Line character gets converted into something 
else (a BLANK or some other white space, I guess), which is not 
acceptable to the R-parser when Sweave runs. This means that every paste 
operation is followed by many edit operations to convert the blanks back 
into new-lines.


Is is possible to prevent this mangling of the paste? Or could there be 
a right-click option to paste-retaining-newlines or something such 
item? Or is this a user-error and there is a better way to perform the 
actions I am describing (A wild example that I have not tried: in a 
blank Lyx window, import the Emacs file, then cut-and-paste from one Lyx 
buffer to another).


System: Linux (Kubuntu 8.04)
Lyx: 2.0.5.1, built from source.

Cut-and-paste: Standard Linux/X11, selecting with left-mouse button and 
pasting with center mouse button.


Regards,
Mark

--



   Mark Dalphin Ph.D.

Director of Bioinformatics

mark.dalp...@pacificedge.co.nz mailto:mark.dalp...@pacificedge.co.nz
*Ph:* +64-3-479-5805
*Cell:* +64-21-156-7625
*Skype:* mark.dalphin.pel
http://www.facebook.com/pages/Pacific-Edge/111356775582456 
http://twitter.com/#%21/pacificEdgeLtd 
http://www.youtube.com/PacificEdgeLtd


87 St David St, PO Box 56, Dunedin, New Zealand 9016www.pacificedge.co.nz

attachment: mark_dalphin.vcf

Re: Working with Lyx and Sweave; pasting R-code from Emacs into Lyx seems awkward. Any suggestions?

2013-04-14 Thread Mark Dalphin
Thanks to both Scott Kostyshak and Yihui Xie (I appreciate Yihui not 
reminding me that he has already suggested I switch to knitr). I 
mis-wrote when I said scrap in my text; it is indeed the chunk into 
which I paste my text from Emacs.


When I use ctrl-shift-v into a chunk that I have pre-filled with 
echo=FALSE,fig=TRUE=\n (where \n means I am on the next line, 
not the literal characters), the first line adds correctly, then there 
is a blank line and change of paragraph type into Standard, with the 
remaining lines in that standard paragraph.


If I change my work order and paste-special into a Standard paragraph, 
it looks alright, but then selection of those lines and conversion to a 
Chunk paragraph yields a similar output: one good, chunk line, a blank 
line plus several lines in the following Standard paragraph.


Trying Yihui's ERT format seemed to paste correctly, however, I am left 
wondering then in what kind of paragraph should the ERT exist. Just as 
a stand-alone Standard paragraph? I can live with that if it leads to 
clean processing of my report. Does anyone have any comments on possible 
side-effects of using the ERT to contain the Sweave material?


Cheers,
Mark

Scott Kostyshak wrote:

On Sun, Apr 14, 2013 at 7:06 PM, Mark Dalphin
mark.dalp...@pacificedge.co.nz wrote:
  

I usually develop my R-code in Emacs (ESS-mode). This permits me to refine
my tables and graphs before I incorporate them into Lyx. This is much faster
as it interactive and avoids the time to run LaTeX (or export the R, etc
etc). Then I write the text part of my report, and, in the Lyx scrap, I
paste the required chunks of R-code. Nice and simple (thank you!). The
problem is that when I paste the R-code from Emacs to the Lyx scrap, the
End-Of-Line character gets converted into something else (a BLANK or some
other white space, I guess), which is not acceptable to the R-parser when
Sweave runs. This means that every paste operation is followed by many edit
operations to convert the blanks back into new-lines.

Is is possible to prevent this mangling of the paste?



Hi Mark,

Does ctrl+shift+v work for you? Or, Edit  Paste Special  Plain Text ?

Best,

Scott

  


--



   Mark Dalphin Ph.D.

Director of Bioinformatics

mark.dalp...@pacificedge.co.nz mailto:mark.dalp...@pacificedge.co.nz
*Ph:* +64-3-479-5805
*Cell:* +64-21-156-7625
*Skype:* mark.dalphin.pel
http://www.facebook.com/pages/Pacific-Edge/111356775582456 
http://twitter.com/#%21/pacificEdgeLtd 
http://www.youtube.com/PacificEdgeLtd


87 St David St, PO Box 56, Dunedin, New Zealand 9016www.pacificedge.co.nz

attachment: mark_dalphin.vcf

Working with Lyx and Sweave; pasting R-code from Emacs into Lyx seems awkward. Any suggestions?

2013-04-14 Thread Mark Dalphin

Hi,

I use Lyx for writing reports on data analysis. To incorporate results 
from those analysis, I use Sweave within Lyx. This is all nicely 
integrated in the recent versions of Lyx. There is one major 
inconvenience remaining for me, however, and that is described here.


I usually develop my R-code in Emacs (ESS-mode). This permits me to 
refine my tables and graphs before I incorporate them into Lyx. This is 
much faster as it interactive and avoids the time to run LaTeX (or 
export the R, etc etc). Then I write the text part of my report, and, in 
the Lyx scrap, I paste the required chunks of R-code. Nice and simple 
(thank you!). The problem is that when I paste the R-code from Emacs to 
the Lyx scrap, the End-Of-Line character gets converted into something 
else (a BLANK or some other white space, I guess), which is not 
acceptable to the R-parser when Sweave runs. This means that every paste 
operation is followed by many edit operations to convert the blanks back 
into new-lines.


Is is possible to prevent this mangling of the paste? Or could there be 
a right-click option to paste-retaining-newlines or something such 
item? Or is this a user-error and there is a better way to perform the 
actions I am describing (A wild example that I have not tried: in a 
blank Lyx window, import the Emacs file, then cut-and-paste from one Lyx 
buffer to another).


System: Linux (Kubuntu 8.04)
Lyx: 2.0.5.1, built from source.

Cut-and-paste: Standard Linux/X11, selecting with left-mouse button and 
pasting with center mouse button.


Regards,
Mark

--



   Mark Dalphin Ph.D.

Director of Bioinformatics

mark.dalp...@pacificedge.co.nz mailto:mark.dalp...@pacificedge.co.nz
*Ph:* +64-3-479-5805
*Cell:* +64-21-156-7625
*Skype:* mark.dalphin.pel
http://www.facebook.com/pages/Pacific-Edge/111356775582456 
http://twitter.com/#%21/pacificEdgeLtd 
http://www.youtube.com/PacificEdgeLtd


87 St David St, PO Box 56, Dunedin, New Zealand 9016www.pacificedge.co.nz

attachment: mark_dalphin.vcf

Re: Working with Lyx and Sweave; pasting R-code from Emacs into Lyx seems awkward. Any suggestions?

2013-04-14 Thread Mark Dalphin
Thanks to both Scott Kostyshak and Yihui Xie (I appreciate Yihui not 
reminding me that he has already suggested I switch to knitr). I 
mis-wrote when I said scrap in my text; it is indeed the chunk into 
which I paste my text from Emacs.


When I use ctrl-shift-v into a chunk that I have pre-filled with 
echo=FALSE,fig=TRUE=\n (where \n means I am on the next line, 
not the literal characters), the first line adds correctly, then there 
is a blank line and change of paragraph type into Standard, with the 
remaining lines in that standard paragraph.


If I change my work order and paste-special into a Standard paragraph, 
it looks alright, but then selection of those lines and conversion to a 
Chunk paragraph yields a similar output: one good, chunk line, a blank 
line plus several lines in the following Standard paragraph.


Trying Yihui's ERT format seemed to paste correctly, however, I am left 
wondering then in what kind of paragraph should the ERT exist. Just as 
a stand-alone Standard paragraph? I can live with that if it leads to 
clean processing of my report. Does anyone have any comments on possible 
side-effects of using the ERT to contain the Sweave material?


Cheers,
Mark

Scott Kostyshak wrote:

On Sun, Apr 14, 2013 at 7:06 PM, Mark Dalphin
mark.dalp...@pacificedge.co.nz wrote:
  

I usually develop my R-code in Emacs (ESS-mode). This permits me to refine
my tables and graphs before I incorporate them into Lyx. This is much faster
as it interactive and avoids the time to run LaTeX (or export the R, etc
etc). Then I write the text part of my report, and, in the Lyx scrap, I
paste the required chunks of R-code. Nice and simple (thank you!). The
problem is that when I paste the R-code from Emacs to the Lyx scrap, the
End-Of-Line character gets converted into something else (a BLANK or some
other white space, I guess), which is not acceptable to the R-parser when
Sweave runs. This means that every paste operation is followed by many edit
operations to convert the blanks back into new-lines.

Is is possible to prevent this mangling of the paste?



Hi Mark,

Does ctrl+shift+v work for you? Or, Edit  Paste Special  Plain Text ?

Best,

Scott

  


--



   Mark Dalphin Ph.D.

Director of Bioinformatics

mark.dalp...@pacificedge.co.nz mailto:mark.dalp...@pacificedge.co.nz
*Ph:* +64-3-479-5805
*Cell:* +64-21-156-7625
*Skype:* mark.dalphin.pel
http://www.facebook.com/pages/Pacific-Edge/111356775582456 
http://twitter.com/#%21/pacificEdgeLtd 
http://www.youtube.com/PacificEdgeLtd


87 St David St, PO Box 56, Dunedin, New Zealand 9016www.pacificedge.co.nz

attachment: mark_dalphin.vcf

Working with Lyx and Sweave; pasting R-code from Emacs into Lyx seems awkward. Any suggestions?

2013-04-14 Thread Mark Dalphin

Hi,

I use Lyx for writing reports on data analysis. To incorporate results 
from those analysis, I use Sweave within Lyx. This is all nicely 
integrated in the recent versions of Lyx. There is one major 
inconvenience remaining for me, however, and that is described here.


I usually develop my R-code in Emacs (ESS-mode). This permits me to 
refine my tables and graphs before I incorporate them into Lyx. This is 
much faster as it interactive and avoids the time to run LaTeX (or 
export the R, etc etc). Then I write the text part of my report, and, in 
the Lyx scrap, I paste the required chunks of R-code. Nice and simple 
(thank you!). The problem is that when I paste the R-code from Emacs to 
the Lyx scrap, the End-Of-Line character gets converted into something 
else (a BLANK or some other white space, I guess), which is not 
acceptable to the R-parser when Sweave runs. This means that every paste 
operation is followed by many edit operations to convert the blanks back 
into new-lines.


Is is possible to prevent this mangling of the paste? Or could there be 
a right-click option to "paste-retaining-newlines" or something such 
item? Or is this a user-error and there is a better way to perform the 
actions I am describing (A wild example that I have not tried: in a 
blank Lyx window, import the Emacs file, then cut-and-paste from one Lyx 
buffer to another).


System: Linux (Kubuntu 8.04)
Lyx: 2.0.5.1, built from source.

Cut-and-paste: Standard Linux/X11, selecting with left-mouse button and 
pasting with center mouse button.


Regards,
Mark

--



   Mark Dalphin Ph.D.

Director of Bioinformatics

mark.dalp...@pacificedge.co.nz <mailto:mark.dalp...@pacificedge.co.nz>
*Ph:* +64-3-479-5805
*Cell:* +64-21-156-7625
*Skype:* mark.dalphin.pel
<http://www.facebook.com/pages/Pacific-Edge/111356775582456> 
<http://twitter.com/#%21/pacificEdgeLtd> 
<http://www.youtube.com/PacificEdgeLtd>


87 St David St, PO Box 56, Dunedin, New Zealand 9016www.pacificedge.co.nz

<>

Re: Working with Lyx and Sweave; pasting R-code from Emacs into Lyx seems awkward. Any suggestions?

2013-04-14 Thread Mark Dalphin
Thanks to both Scott Kostyshak and Yihui Xie (I appreciate Yihui not 
reminding me that he has already suggested I switch to knitr). I 
mis-wrote when I said "scrap" in my text; it is indeed the "chunk" into 
which I paste my text from Emacs.


When I use "ctrl-shift-v" into a chunk that I have pre-filled with 

Re: Having a problem including an AT, '@', in my output (Document module = Sweave)

2012-11-12 Thread Mark Dalphin

I have created and attached a simple example showing the error.

[If this is a double-post, I apologize. I have subscribed to the 
lyx-user maillist as the first posting did not appear to work]


Regards,
Mark

Yihui Xie wrote:

Could you attach a minimal real *.lyx file? I do not understand what
pseudo-html markup means.

Regards,
Yihui
--
Yihui Xie xieyi...@gmail.com
Phone: 515-294-2465 Web: http://yihui.name
Department of Statistics, Iowa State University
2215 Snedecor Hall, Ames, IA


On Mon, Nov 12, 2012 at 7:26 PM, Mark mark.dalp...@pacificedge.co.nz wrote:
  

Hi,

Running lyx, version 2.0.5, built from source today.
Host system is (old): kubuntu 8.04

I am writing an in-house document which shows how to use Sweave. This means I
want to both show the Sweave code and then the results of the Sweave code
being run. This has worked in the distant past (lyx version 1.4?) but as I
update the document now, I am having problems.

In my example below, I use pseudo-html markup to show the Lyx paragraph types.

Eg:
Lyx-code paragraph:
   echo=FALSE,results=tex=
print( toLatex( sessionInfo() ))
@
/lyx-code

chunk paragraph:
echo=FALSE,results=tex=
print( toLatex( sessionInfo() ))
@
/chunk

This works fine (as expected) except that the AT-sign, '@', in the lyx-code
paragraph gets eaten and does not show up in the output. I can circumvent the
problem by adding a thin-space in front of the '@', however, it implies that I
need to know when characters will be eaten. I don't know the rules yet.

If I use the File -- Export -- LaTeX (plain) option, there is no '@' in the
tex file.

Cheers,
Mark




--



Mark Dalphin Ph.D.

Director of Bioinformatics

mark.dalp...@pacificedge.co.nz mailto:mark.dalp...@pacificedge.co.nz
*Ph:* +64-3-479-5805
*Cell:* +64-21-156-7625
*Skype:* mark.dalphin.pel
http://www.facebook.com/pages/Pacific-Edge/111356775582456
http://twitter.com/#%21/pacificEdgeLtd
http://www.youtube.com/PacificEdgeLtd

87 St David St, PO Box 56, Dunedin, New Zealand 9016www.pacificedge.co.nz




simpleExample.lyx
Description: application/lyx
attachment: mark_dalphin.vcf

Re: Having a problem including an AT, '@', in my output (Document module = Sweave)

2012-11-12 Thread Mark Dalphin

I have created and attached a simple example showing the error.

[If this is a double-post, I apologize. I have subscribed to the 
lyx-user maillist as the first posting did not appear to work]


Regards,
Mark

Yihui Xie wrote:

Could you attach a minimal real *.lyx file? I do not understand what
pseudo-html markup means.

Regards,
Yihui
--
Yihui Xie xieyi...@gmail.com
Phone: 515-294-2465 Web: http://yihui.name
Department of Statistics, Iowa State University
2215 Snedecor Hall, Ames, IA


On Mon, Nov 12, 2012 at 7:26 PM, Mark mark.dalp...@pacificedge.co.nz wrote:
  

Hi,

Running lyx, version 2.0.5, built from source today.
Host system is (old): kubuntu 8.04

I am writing an in-house document which shows how to use Sweave. This means I
want to both show the Sweave code and then the results of the Sweave code
being run. This has worked in the distant past (lyx version 1.4?) but as I
update the document now, I am having problems.

In my example below, I use pseudo-html markup to show the Lyx paragraph types.

Eg:
Lyx-code paragraph:
   echo=FALSE,results=tex=
print( toLatex( sessionInfo() ))
@
/lyx-code

chunk paragraph:
echo=FALSE,results=tex=
print( toLatex( sessionInfo() ))
@
/chunk

This works fine (as expected) except that the AT-sign, '@', in the lyx-code
paragraph gets eaten and does not show up in the output. I can circumvent the
problem by adding a thin-space in front of the '@', however, it implies that I
need to know when characters will be eaten. I don't know the rules yet.

If I use the File -- Export -- LaTeX (plain) option, there is no '@' in the
tex file.

Cheers,
Mark




--



Mark Dalphin Ph.D.

Director of Bioinformatics

mark.dalp...@pacificedge.co.nz mailto:mark.dalp...@pacificedge.co.nz
*Ph:* +64-3-479-5805
*Cell:* +64-21-156-7625
*Skype:* mark.dalphin.pel
http://www.facebook.com/pages/Pacific-Edge/111356775582456
http://twitter.com/#%21/pacificEdgeLtd
http://www.youtube.com/PacificEdgeLtd

87 St David St, PO Box 56, Dunedin, New Zealand 9016www.pacificedge.co.nz




simpleExample.lyx
Description: application/lyx
attachment: mark_dalphin.vcf

Re: Having a problem including an AT, '@', in my output (Document module = Sweave)

2012-11-12 Thread Mark Dalphin

I have created and attached a simple example showing the error.

[If this is a double-post, I apologize. I have subscribed to the 
lyx-user maillist as the first posting did not appear to work]


Regards,
Mark

Yihui Xie wrote:

Could you attach a minimal real *.lyx file? I do not understand what
"pseudo-html markup" means.

Regards,
Yihui
--
Yihui Xie 
Phone: 515-294-2465 Web: http://yihui.name
Department of Statistics, Iowa State University
2215 Snedecor Hall, Ames, IA


On Mon, Nov 12, 2012 at 7:26 PM, Mark  wrote:
  

Hi,

Running lyx, version 2.0.5, built from source today.
Host system is (old): kubuntu 8.04

I am writing an in-house document which shows how to use "Sweave". This means I
want to both show the "Sweave" code and then the results of the Sweave code
being run. This has worked in the distant past (lyx version 1.4?) but as I
update the document now, I am having problems.

In my example below, I use pseudo-html markup to show the Lyx paragraph types.

Eg:
 paragraph: