[Tex/LaTex] Copy and Paste code in LyX

lyx

I am trying to copy and paste some code (Matlab script) from the text-editor into a lstlisting-environment in LyX.

But LyX does not recognize the linebreaks, and only does a linebreak if there is an empty space in the code, which forces me to manually do every linebreak in LyX…

i know i can insert it as a lstinputlisting, but still i was wondering why it doesnt work that way.

hmm maybe there is something in the settings in LyX to fix this behavior, do you guys know? or maybe its a bug? then i will post it on the bugtracker…

its acually the same with tex-code (STRG+L), but then its even totally wrong, because if i have some text in lets say texmaker with an empty line, then its a clear new paragraph, it i just copy and paste it in lyx into tex-code, then there will be only a line break, with that the new paragraph is gone…

Best Answer

Use Ctrl + Shift + V (Paste special) instead of the normal Ctrl + V, then line breaks are preserved.

Related Question