[Tex/LaTex] LaTeX error when inserting code listing in LyX

beamerlyxpresentations

I am currently making a presentation in LyX. After I have inserted some XML code in a code listing, I am getting this error:

Paragraph ended before \lst@next was complete.
Paragraph ended before \lst@next was complete.
LaTeX Error: \begin{lstlisting} on input line 228 ended by \end{beamer@framep
Missing } inserted.
Extra }, or forgotten \endgroup.

What's the problem? Have I to escape some characters or something? I am pretty new to LyX.

EDIT:

Here is a little code snippet. Because I am working with LyX, the code is generated and looks a little bit confusing, I think. I hope you can read it.

\begin_layout BeginFrame
\lang english
Güte der Ergebnisse
\end_layout
\begin_layout Standard
\lang english
\begin_inset listings
inline false
status open
\begin_layout Plain Layout
<server> 
\end_layout
\begin_layout Plain Layout
<name>MyServer</name> 
\end_layout
\begin_layout Plain Layout
<version>1</version> 
\end_layout
\begin_layout Plain Layout
<functionality>0</functionality> 
\end_layout
\begin_layout Plain Layout
<platform>Win</platform> 
\end_layout
\begin_layout Plain Layout
</server> 
\end_layout
\begin_layout Plain Layout
</ddsml> 
\end_layout
\end_inset
\end_layout
\begin_layout EndFrame
\start_of_appendix
\end_layout

Best Answer

Perhaps this should rather be a comment on egregs answer, but it became a little long.

I searched a little, and there is a module for creating fragile frames, that can be found in the LyX wiki. I don't know how to install modules, but I guess that information can also be found in the LyX wiki.

An alternative is to use ERTs (source):

  1. Instead of starting a new frame the LyX way, add a TeX code box, or ERT, by hitting Ctrl + L, or choosing Insert --> TeX Code. In this box you write

    \begin{frame}[fragile]
    \frametitle{Title of the frame}
    
  2. Add the listing.

  3. Finally a second ERT with

    \end{frame}
    
Related Question