Using the floats and listings packages, I have defined a float for code listings and a shortcut for using it as follows:
\usepackage{floats}
\usepackage{listings}
\newfloat{program}{tbphH}{lop}[section]
\floatname{program}{Program}
\newcommand{\codefrom}[2][Matlab]
{
\begin{program}[p]
\lstinputlisting[language=#1]{#2}
\caption{#2}
\label{#2}
\end{program}
}
Now, if a code file is too long, it will just continue down outside the page. Instead, I would like to automatically split the float at the end of the page, and continue on the next page.
Is there any way to accomplish this without sacrificing the float structure? If not, is there another way to get numbering etc as easily as with a float?
matlab-prettifierpackage; see this answer. – jub0bs Apr 28 '14 at 15:24