开发者

LaTex, issue with Beamer and Listings

开发者 https://www.devze.com 2023-01-02 04:38 出处:网络
I\'m trying to add some code in a presen开发者_运维百科tation made with LaTex. I used beamer, added some frames without problems but once I add the listing, I can\'t compile the presentation anymore.

I'm trying to add some code in a presen开发者_运维百科tation 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 ?


Try making a fragile frame:

\begin{frame}[fragile]


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

\begin{frame}[containsverbatim]


listings provides frame functions:

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

精彩评论

暂无评论...
验证码 换一张
取 消