Dear list,

I am trying to add a lstlisting environment to my layout file (using
listings package) and arrive at the following:

Style Listings
 Margin         Static
 LatexType              Environment
 LatexName              lstlisting
 NextNoIndent           1
 LeftMargin             MMM
 RightMargin            MMM
 TopSep         0.5
 BottomSep              0.5
 Align                  Left
 AlignPossible          Block, Left, Right, Center
 LabelType              No_Label

 # define the environment listings
 Preamble
   \usepackage{listings}
   \lstset{language=Python,
  showspaces=false,
  basicstyle=\footnotesize,
  showstringspaces=false,
  showtabs=false
  }
 EndPreamble

 # standard font definition
 Font
   Family               Typewriter
   Size            small
 EndFont
End


My problem is that

Line1
Line2

appears in latex as

\begin{lstlisting}
Line1

Line2
\end{lstlisting}

so I get an extra line.

If I do Ctrl-enter after Line1, the latex code would be

\begin{lstlisting}
Line1 ~\\
Line2
\end{lstlisting}

~\\ will be shown in lstlisting as it is.

How can I correct this? Basically, I would like the code to be in
latex as it is.

Many thanks in advance.
Bo

Reply via email to