Short answer: you can use Ctrl+L and Ctrl+Shift+V instead of Scrap and Ctrl+V.
Note Scrap is obsolete now. The new name is Chunk. Some users choose to use this, but others like me use the ERT (Ctrl+L). It is up to you. A slightly longer answer: you do not really have to paste code between Emacs and LyX if you use the knitr module instead of Sweave. See http://yihui.name/knitr/demo/externalization/ for examples, and http://yihui.name/knitr/demo/lyx/ for a video demo of knitr in LyX. 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 Sun, Apr 14, 2013 at 6:06 PM, Mark Dalphin <mark.dalp...@pacificedge.co.nz> wrote: > 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 >