# fancyvrb always creates new page

I'm having trouble using the facyvrb package. I have the following code:

\section{My section}
\subsection{Subsection}

\begin{Verbatim}[frame=single]
...lots of code...
\end{Verbatim}


However, pdflatex constructs a whole page just containing the subsection header, the rest of the page empty, and then, on the next page starts the verbatim section. How can I tell the Verbatim part to be exactly under the subsection, something like the [H] command with floats on figures?

-
@Timo --- Please edit your question and add a complete example code that reproduces the problem you describe. – Ian Thompson Jun 22 '12 at 13:00
that is not possible with the package fancyvrb which you already load, it can have page breaks. Only the BVerbatim environment is put in a box (note the preceding B). As Ian wrote, give more informations ... – Herbert Jun 22 '12 at 13:03
listings is based on fancyvrb ... – Herbert Jun 22 '12 at 13:07
Does this happen always or only when the subsection title falls near the end of a page? – egreg Jun 22 '12 at 13:36

I can't see any problem.

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage{fancyvrb}
\usepackage{lipsum}
\usepackage{xcolor}

\begin{document}
\section{My section}
\subsection{Subsection}
\lipsum[1]
\begin{Verbatim}[frame=single,framerule=1mm,framesep=3mm,
rulecolor=\color{red},fillcolor=\color{yellow}]
Verbatim line.
\end{Verbatim}

\begin{Verbatim}[frame=single,framerule=1pt,rulecolor=\color{blue}]
...lots of code...
\end{Verbatim}

\lipsum[1-2]
\end{document}


-