[texhax] create float based on longtable?

Christoph Haug christoph.haug at gmail.com
Thu Jan 28 00:43:59 CET 2010

Hi,

My question is how I can create a new float or environment which
behaves just like longtable (or perhaps xtabular?) only that it is not
treated as table (caption wise and list-of wise)? In other words: More
concretely: I would like to have an float called "example" which shows
"Example ..." in its caption and which is listed in a "List of
Examples" (rather than the list of tables).

Here is the whole story: for my thesis, I created a new float called
"example" (I used \DeclareCaptionType from the caption package, but
this doesn't matter here, I think). The examples I create in the
document are listed in a "list of examples" and they are be boxed to
be set apart from the text. I also made them a bit narrower than
\textwidth. For the boxing I created a new environment based on
tabular and called it "exbox". I'll just paste the code here:

\newenvironment{exbox}%
{
\small
\centering
\begin{tabular}[1]{|m{0.9\textwidth}|}
\hline
\smallskip
}
%
{
\smallskip
\\\hline
\end{tabular}
}

Actually, the \centering doesn't work and I dont understand why...

But apart from that little thing, that is working fine so far. The
problem is now that some of my examples (paragraphs of text) turn out
to be longer than one page which is obviously a problem for my float.
At the moment it also is a problem for the exbox environment, since it
is based on tabular, but that could be changed to longtable, or
xtabular, or whatever. But then how do I go on from there? Since exbox
is always embedded in an example-float, I still have the problem that
it doesnt break accross pages.

Does anybody have an idea? I am also open for a completely different
solution. I used tabular because that was the best I could think of,
but it does restrict the formatting of the text within the examples.
So if there are better options, let me know. -- I was actually
surprised that I could not find a standard solution for this on the
net. Die nobobody ever have examples (or Listings or so) that span
several pages?

Thanks for any help,
Christoph