Hi,

I'm very new to Lyx and Latex.
I'm trying to use the listings package to format some Python code.
I've  copied the following sample latex document from the internet that does
this:

\documentclass{article}
\usepackage{listings}
\lstset{numbers=left, numberstyle=\tiny, stepnumber=1, numbersep=5pt,
language=Python}

\begin{document}
\title{test}

\begin{lstlisting}

import numpy
import sys

if __name__='__main__':
   print "test"

\end{lstlisting}
\end{document}


Then I import the document in Lyx . (through the Lyx menu
File/Import/Latex(plain) )
In the Lyx document the linebreaks have disappeared (for instance between
'import numpy' and 'import sys')

And the generated dvi is the following:

1
2 import numpy import sys
3
4 if name='main': print \char'\"{}test\char'\"{}


Do you know what I'm doing wrong?
I'm using version 1.5.5 of Lyx for windows.
Thank you very much for any help.

Tomas Bar

Reply via email to