I’d like to have an environment that works much like a float, except that it doesn’t float.
That is, in fact, I’d like to be able to define an environment that has a label and a caption.
I explicitly do not want to use a floating environment, though. For one thing, floats do many things fancy which I just don’t need, nor want (such as spacing) and for another, floats have their share of problems (for example consider the problem of splitting a float between pages).
Is there a ready-made way to achieve this? Of course, I could always write my own based on the result of the other answer, i.e. harnessing \refstepcounter. But I’m not sure how to use that, documentation is scarce, and I’d prefer an existing solution.
\captioninside the environment so I can use that instead of\captionofwas surprisingly difficult (I suspect cross-talk between caption and hyperref). But now I can write (almost) usual code and get a caption + label. – Konrad Rudolph Dec 16 '10 at 15:57\captionofcommand is already available and you don't needcaptionorcapt-of(there are also\captionbelowofand\captionaboveof, see the scrguide) – Skillmon Apr 09 '17 at 13:26