I've found the float package, which lets me specify \newfloat{program}{...} to get other named floats than Table and Figure. However, if I try to use this more than once, I get a cryptic error:
! You can't use `\def' after \the.
\fs@plain ->\def
\@fs@cfont {\rmfamily }\let \@fs@capt \floatc@plain \def \@...
It points to the first line where I try to use one of the new floats - not where I define the second one. However, if I remove all calls to \newfloat except one, everything works as expected.
Is this a problem with the package? If so, is there another package I can use that does the same thing (and doesn't depend on this package)?
UPDATE: This seems to be related to using the listings package in new floats. The following code produces the above error:
\documentclass{article}
\usepackage{floatrow}
\DeclareNewFloatType{program}{name=Program,fileext=lop,within=section}
\DeclareNewFloatType{output}{name=Output,fileext=loo,within=section}
\usepackage{listings}
\begin{document}
\begin{program}
\lstinputlisting{thisfile.tex}
\caption{some code}
\end{program}
\end{document}
If I comment out the second \DeclareNewFloatType, or do something else in the float (for example \begin{tabular}...\end{tabular} instead of \lstinputlisting{...}), the code compiles correctly.
\newfloat{program}{...}multiple times or do you have\newfloat{program}{...} \newfloat{foo}{...}? – TH. Sep 05 '10 at 02:58