I'm trying to create a simple newenvironment allowing me to display source code in a verbatim text block with a caption, numbering etc. The solution I'm after is with the in-built LaTeX verbatim environment.
I would have used the fancyvrb package, that seems to allow that kind of thing, but I can't update my MiKTeX installation due to proxy authentication issues. Instead I'm after a way to do it with just the built in verbatim environment. When I get home, I can adapt it to use fancyvrb (so I am still interested in answers relating to that), but for now, I'm after a temporary solution to get me through the day. ;^)
Here's what I imagine the newenvironment command would be like:
\usepackage{float}
\floatstyle{boxed}
\newfloat{program}{h}{lop}
\floatname{program}{Example}
\newenvironment{example}[2]{%
\begin{program}%
\label{#1}%
\caption{#2}%
\scriptsize
\begin{verbatim}%
}{%
\end{verbatim}%
\end{program}%
}
It fails later-on, complaining about overfull \hboxes, which I assume means that it's still trying to typeset the rest of my document as though it were in verbatim mode.
Can I use verbatim env in this way? Got a workaround (given that my MiKTeX package repo is pretty small)?