# Problem with lstlisting in beamer… What am I doing wrong?

I am trying to to put an lstlisting environment in the left column, but I'm getting errors. Are lstlisting and the columns environment in beamer incompatible? Or is it something else?

\documentclass{beamer}

\usepackage{remreset}
\usepackage{comment} % end and begin comment
\usepackage{dtklogos} % for \BibTeX

\usepackage{listings} % display code on slides; don't forget [fragile] option after \begin{frame}
\usepackage{bera} % pause in listing
\usepackage{color}
\definecolor{lightgrey}{rgb}{0.92,0.92,0.92} % defining color for listing
\definecolor{darkgreen}{rgb}{0,0.6,0} % defining color for listing

\usepackage{graphicx} % importing figure

\usepackage{verbatim} % writing code

\makeatletter
\@removefromreset{subsection}{section} % creates navigation circles for every slide not section
\makeatother
\setcounter{subsection}{1} % creates navigation circles for every slide not section

\usetheme{Frankfurt}

\lstset{language=[LaTeX]TeX,
basicstyle=\small\ttfamily,
texcsstyle=*\bf\color{blue},
numbers=left,
breaklines=true,
keywordstyle=\color{darkgreen},
otherkeywords={$}, frame=leftline, tabsize=2, backgroundcolor=\color{lightgrey}, escapeinside=|| } %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \begin{document} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \begin{frame} \begin{columns} \begin{column}{5cm} \begin{lstlisting}[float=*] \pause \end{lstlisting} \end{column} \begin{column}{5cm} text \end{column} \end{columns} \end{frame} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \end{document} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  - ## 1 Answer No; columns and lstlisting are not incompatible. You should use the fragile option for the frame, and don't treat the listing as a floating object: \documentclass{beamer} \usepackage{remreset} \usepackage{comment} % end and begin comment \usepackage{dtklogos} % for \BibTeX \usepackage{listings} % display code on slides; don't forget [fragile] option after \begin{frame} \usepackage{bera} % pause in listing \usepackage{color} \definecolor{lightgrey}{rgb}{0.92,0.92,0.92} % defining color for listing \definecolor{darkgreen}{rgb}{0,0.6,0} % defining color for listing \usepackage{graphicx} % importing figure \usepackage{verbatim} % writing code \makeatletter \@removefromreset{subsection}{section} % creates navigation circles for every slide not section \makeatother \setcounter{subsection}{1} % creates navigation circles for every slide not section \usetheme{Frankfurt} \lstset{language=[LaTeX]TeX, basicstyle=\small\ttfamily, texcsstyle=*\bf\color{blue}, numbers=left, breaklines=true, keywordstyle=\color{darkgreen}, commentstyle=\color{red}, otherkeywords={$},
frame=leftline,
tabsize=2,
backgroundcolor=\color{lightgrey},
escapeinside=||
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{frame}[fragile]
\begin{columns}

\begin{column}{5cm}
\begin{lstlisting}
\pause
\end{lstlisting}
\end{column}

\begin{column}{5cm}
text
\end{column}

\end{columns}

\end{frame}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\end{document}


On a side note, I see the following line in your code:

\usepackage{bera} % pause in listing


this is not correct; the bera package has nothing to do with being able to use \pause inside lstlisting; bera is just a font package (used to obtain a nice monospaced font).

-
thanks, that was probably the most stupid question I have every asked here! I should probably stop working for the day. THANK YOU! –  MCB Jun 7 '12 at 21:04