Hi LyX Users!

I am trying the whole day to create a nice style for SQL. Up to now, I have manage to create some semi-nice output. My .layout file looks about like this:


\usepackage{listings}

[...]

Style SQL
  CopyStyle             LyX-Code
  LatexType             Environment
  LatexName             sql_1
  Preamble
        \lstnewenvironment{sql_1}
{ \lstset{ language=SQL, basicstyle=\small, keywordstyle=\color{blue}, commentstyle=\color{red}, numbers=left, numberstyle=\tiny, stepnumber=2, numbersep=5pt}
                }
                {}
  EndPreamble
End

Now, I have tried to use my layout. It looks quite nice on the screen, but not very much like it should in the output files. I have created a very simple and stupid query:

SELECT * FROM bla, fasel WHERE bla = 0

Highlighted it, chose the "SQL" param style from the dropdown. LyX formatted it like it does when using the LyX-Code style. Fine so far. Exporting it to pdf shows something weird:

1 SELECT ~ { * } ~FROM~ b l a , ~ f a s e l ~WHERE~ b l a ~= ~0

Wonderfully colored, but spoiled with tilde and brackets. Bad.

Now, I exported the file to LaTeX to see what went wrong. Bad luck here, too:

\begin{sql_1}
SELECT~{*}~FROM~bla,~fasel~WHERE~bla~=~0
\end{sql_1}

The code within the LyX file looks like this:

\layout SQL

SELECT *
\layout SQL

FROM bla, fasel
\layout SQL

WHERE bla = 0



I really can't tell what went wrong. Another thing I noticed that when using newlines, LyX seems to insert double newlines. So, something looking like this on the screen:

SELECT * FROM bla, fasel
WHERE bla = 0

turns out to look like

1 SELECT ~ { ∗ } ~FROM~ b l a , ~ f a s e l ~
[big space here]
3 WHERE~ b l a ~= ~0

as pdf.

Could anyone give me a hand here please? I think I have found out a lot browsing the net, but there's still way too much in front of me to sort this out myself.

Thanks a lot!

André

Systems Engineer
COLT
Mürtschenstrasse 27
CH-8048 Zürich/Switzerland
Tel:   +41 (0)44 560 06 00      Internal: 8411 0501
Fax:  +41 (0)44 563 05 01
[EMAIL PROTECTED]
www.colt.net
Data | Voice | Managed Services


Reply via email to