I'm creating a presentation using beamer and listings - when I end a section with a {lstlisting} call, the next section title appears in the slide. Is there a way that I can specify when the next section should come in?
Code:
\documentclass{beamer}
\mode<presentation>
{
\usetheme{CambridgeUS}
\setbeamercovered{transparent}
}
\usepackage{listings}
\lstset{frame=tb,
language=Java,
aboveskip=3mm,
belowskip=3mm,
showstringspaces=false,
columns=flexible,
basicstyle={\fontsize{9}{9}\ttfamily},
numbers=none,
numberstyle=\tiny\color{gray},
breaklines=true,
breakatwhitespace=true,
tabsize=3
}
\usepackage[english]{babel}
\usepackage[latin1]{inputenc}
\usepackage{times}
\usepackage[T1]{fontenc}
\usepackage{amsmath}
\title[The presentation]{The Presentation}
\begin{document}
\section[section 1]{section 1}
\begin{frame}
This is the first section
\end{frame}
%%%%% Starts using 'Section 2' %%%%%
Hey! This is the wrong section!
\begin{lstlisting}[frame=single]
public void hi(){
system.out.println("Hello World!");
}
\end{lstlisting}
%%%%%% Section 2 declared here %%%%%%
\section[section 2]{section 2}
\begin{frame}
I should be the first with the title Section 2!
\end{frame}
\end{document}