# Issue with lstlisting inside semiverbatim

Code I got from here...

When I run it, the output has line numbers broken, like it says 1, then from 3 to 6 and then 8 to 11... Any idea why?

\documentclass{beamer}

\setbeamercovered{transparent}

\usepackage{pxfonts}
\usepackage{listings}

\begin{document}

\lstset{language=python,
numbers=left,
numberstyle=\tiny,
showstringspaces=false,
aboveskip=-40pt,
frame=leftline
}

\begin{frame}[fragile]
\frametitle{\texttt{parrot.py}}
\begin{semiverbatim}
\pause
\begin{lstlisting}
if __name__ == "__main":

\end{lstlisting}

\pause
\begin{lstlisting}[firstnumber=last]
print "Oh yes, the, uh,
the Norwegian Blue..."
print "What's, uh...
What's wrong with it? "

\end{lstlisting}

\pause
\begin{lstlisting}[firstnumber=last]
print "I'll tell you what's wrong with it,
that's what's wrong with it!"

\end{lstlisting}
\end{semiverbatim}
\end{frame}

\end{document


There are empty lines in those listings. A line number is assigned to each empty line, but that number is not printed. Try:

\documentclass{beamer}

\setbeamercovered{transparent}

\usepackage{pxfonts}
\usepackage{listings}

\begin{document}

\lstset{language=python,
numbers=left,
numberstyle=\tiny,
showstringspaces=false,
aboveskip=-40pt,
frame=leftline
}

\begin{frame}[fragile]
\frametitle{\texttt{parrot.py}}
\begin{semiverbatim}
\pause
\begin{lstlisting}
if __name__ == "__main":
\end{lstlisting}

\pause
\begin{lstlisting}[firstnumber=last]
print "Oh yes, the, uh,
the Norwegian Blue..."
print "What's, uh...
What's wrong with it? "
\end{lstlisting}

\pause
\begin{lstlisting}[firstnumber=last]
print "I'll tell you what's wrong with it,