LaTex, issue with Beamer and Listings

21,399

Solution 1

The fragile option didn't work for me, but this did:

\begin{frame}[containsverbatim]

Solution 2

listings provides frame functions:

\begin{lstlisting}[frame=single]
Sample Code
\end{lstlisting}

Share:
21,399
pmascaraque
Author by

pmascaraque

Updated on July 09, 2022

Comments

  • pmascaraque
    pmascaraque almost 2 years

    I'm trying to add some code in a presentation made with LaTex. I used beamer, added some frames without problems but once I add the listing, I can't compile the presentation anymore.

    \begin{frame}{Code}
    \begin{lstlisting}
    Sample Code
    \end{lstlisting}
    \end{frame}
    

    The error I pdflatex gave me is:

    Package Listings Warning: Text dropped after begin of listing on input line 80.
    

    Is there anything special to add to make it work ?