Dear All,

I have a weird problem formatting source code ... using "listings" and LyX 
1.3.6 on a (no ... several ;-) Linux systemS.

If I use the \lstinputlisting directive (i.e. importing a file directly), 
everything works as intended. Fine. 

If I take the same code and copy/paste it in a piece of ERT containing the 
\begin{lstlisting}...\end{lstlisting} "brackets", the whole code is 
displayed double-spaced. Example below. Oops?!

Anyone knows how to work around this problem? In this particular case I 
would like to avoid using \lstinputlisting, since I need a number of small 
code snippets - and the files' location in the filesystem may change.

Any help greatly appreciated :-)

- Joerg


Example follows:

#LyX 1.3 created this file. For more info see http://www.lyx.org/
\lyxformat 221
\textclass article
\begin_preamble
\usepackage{listings}
\lstset{language=bash,numbers=left,numbersep=5pt,frame=single}
\end_preamble
\language english
\inputencoding auto
\fontscheme default
\graphics default
\paperfontsize default
\spacing single
\papersize Default
\paperpackage a4
\use_geometry 0
\use_amsmath 0
\use_natbib 0
\use_numerical_citations 0
\paperorientation portrait
\secnumdepth 3
\tocdepth 3
\paragraph_separation indent
\defskip medskip
\quotes_language english
\quotes_times 2
\papercolumns 1
\papersides 1
\paperpagestyle default
\layout Standard

This is a test for the
\emph on
listings
\emph default
package.
\layout Standard

Reading an
\begin_inset Quotes eld
\end_inset

external
\begin_inset Quotes erd
\end_inset

 file:
\layout Standard

\begin_inset ERT
status Open

\layout Standard

\backslash
lstinputlisting[firstline=26,lastline=29]{.bashrc}
\end_inset

\layout Standard

Another example, with code inserted via copy/paste ...
 notice the double-spaced file?
\layout Standard

\begin_inset ERT
status Open

\layout Standard

\backslash
begin{lstlisting}
\layout Standard
# e.g. 57600 or 38400; lowest is 9600 (very slow!)
\layout Standard
#
\layout Standard
export PILOTPORT=/dev/pilot
\layout Standard
export PILOTRATE=115200
\layout Standard
\backslash
end{lstlisting}

\layout Standard
\end_inset
\the_end

-- 
joerg.hau(at)dplanet.ch * Lausanne, Switzerland
http://homepage.sunrise.ch/mysunrise/joerg.hau/
"All standard disclaimers apply."
Never take life seriously. You won't get out alive anyway.

Reply via email to