Hello Actually Program Listing worked fine for me.
Thanks Uwe!!! First of all i had a float figure and inside that i have inserted the program listing box And then i have pasted selected text and the format was well preserved. Regards Sajjad ---------- Forwarded message ---------- From: James C. Sutherland <james.sutherl...@utah.edu> Date: Mon, Jun 8, 2009 at 4:06 PM Subject: Re: Inserting C++ code To: lyx-users User <lyx-users@lists.lyx.org> On Jun 7, 2009, at 5:55 AM, Sajjad wrote: Hello forum, > > I have installed LyX 2.6.1 and trying to insert C++ code. I am trying as > follows: > > 1. Inserted a float algorithm . > 2. Pasted the code snippet inside that > > > But the code is not well formatted > > Any hint on how to keep the format ? > > I have noticed that when I copy code from the emacs editor, line breaks are not respected when pasted into LyX. However, if I copy code from XCode (Mac) then the problem goes away. While I don't know why this is the case, my suggestion to you is to try to open your C++ file in a different editor and copy it into LyX. James