[texhax] create float based on longtable?

Ulrike Fischer news3 at nililand.de
Mon Feb 1 20:16:19 CET 2010


Am Thu, 28 Jan 2010 18:38:22 +0100 schrieb Christoph Haug:

> But let's assume for a moment that I decide manually, which examples
> should float (the small ones) and which dont (the long ones). How do I
> manage that both my floating and my non-floating examples use the same
> caption numbering and are listed in the same "list of examples"?

You can get problems with the numbering when you mix "fixed floats"
and "real floats":
http://www.tex.ac.uk/cgi-bin/texfaq2html?label=figurehere

Apart from this: you can get captions outside "real" floats e.g.
with the caption package and \captionof. caption allows you also to
define new float/caption types. 

> Before I can even think about that question, I need to know how I can
> tell longtable or supertabular that it should use the "Example" as a
> caption rather than "Table" and use the corresponding list. Or
> rather---instead of changing the longtable environment---how do I
> create a "duplicate" of longtable (or supertabular) which behaves like
> an example (except that it doesn't float?

longtable use the table counter and inserts its caption in the
listoftables. This behaviour is quite hardwirded. You would have to
hack the code to change it. You can't use \captionof inside a
longtable, but you could try \captionof together with longtable*
(which doesn't change the table counter):

\documentclass[]{article}
\usepackage{longtable}
\usepackage{caption}
\DeclareCaptionType{exa}[Example][List of Examples]
\begin{document}
\listofexas

\captionof{exa}{Caption 1}
\begin{longtable*}{l}
cde\\
abc
\end{longtable*}

\begin{longtable}{l}
\caption{fdg}\\
cde\\
abc
\end{longtable}
\end{document}

Be beware that page breaks between the caption and longtable are
possible. 

-- 
Ulrike Fischer 



More information about the texhax mailing list