18

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
3
  • 1
    A minimal example would be nice. It looks like you're using beamer as well as listings? How are you using listings?
    – Seamus
    Dec 1, 2011 at 9:19
  • 1
    If any of the answers below solved your issue, would you consider accepting it by click the checkmark next to it? Dec 9, 2011 at 21:09
  • oh, sorry. i missed that. Dec 10, 2011 at 8:40

4 Answers 4

15

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}
    
1
  • 1
    \begin{frame}[fragile]{Title} works also.
    – alemol
    Aug 14, 2017 at 16:39
12

I don't know how to do this in LyX, but a frame containing "verbatim" material such as a lstlisting environment should be declared as fragile:

\begin{frame}[fragile]
...
\begin{lstlisting}
...
\end{lstlisting}

\end{frame}
5

In LyX 2.1, you do not need to enter LaTeX code directly to achieve frames handling fragile elements correctly.

Just select the frame and press Alt+A 3. The new field "Options" should appear where you enter fragile. Alternatively, right click on the Frame 'header', and select Frame Options.

3
  • Welcome to TeX.SX! Just wondering, is this new for LyX 2.1? May 23, 2014 at 7:20
  • @TorbjørnT. yes (and I agree, that should be stated in the answer)
    – scottkosty
    May 23, 2014 at 7:46
  • Also, I believe the shortcut is alt + a 3 (not 'g').
    – scottkosty
    May 23, 2014 at 7:46
2

use it this way:

before the frame insert with Ctrl-L for inserting LaTeX Code

\defverbatim\lst{%
\begin{lstlisting}
your xml code}
\end{lstlisting}
}

inside the frame place also with Ctrl-L the command \lst where the listing should appear.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .