[comp.text.tex] Tables/Figures staying put WITH label

phd11@seq1.kl.ac.uk (A. Mcdonald) (03/22/91)

A while back, this was posted to the net....

In article <9162@castle.ed.ac.uk> robin@castle.ed.ac.uk (R C Smith) writes:
>In LaTeX how do you stop figures floating around apart from
>\begin{figure}[h]
>
>I want to know exactly where they appear as I use a \special to include
>graphics in the  output, but the area where I put the picture is not the
>same when I left the space for it....very annoying.
>
>Ideally I would like a macro which would also allow the special to float
>to the same page as the figure has floated to.


... and the response from Timothy Van Zandt was ....

The whole point of the figure and table envirnments is to float their 
contents. Just leave out the \begin{figure}, \end{figure} and \caption{},
and whatever was in the environment  is placed right where you put it in
the source file. You can then add a caption if you want.

If a special is placed inside the figure environment, it should float with
everything else, although specials are special, so it depends.

Tim

... Now the thing is this works beautifully, BUT I don't seem to be able
to get any kind of referencing using \label, you need to be in a figure or
table or equation environment to get anything to happen (apart that is
if you're in the middle of a section).

My point is this:- if you then set up one of these environments then you're
back where you started with everything floating about...

Also, trying something like

\begin{table}
\caption{A test caption}
\end{table}

directly after the \begin{tabular}...\end{tabular} doesn't seem to help.

Can a guru help?

		thanks, Tony.

tvz@zandtwerk.Princeton.EDU (Timothy Van Zandt) (03/25/91)

In article <1028@keele.keele.ac.uk> phd11@seq1.kl.ac.uk (A. Mcdonald) writes:
>
>In article <9162@castle.ed.ac.uk> robin@castle.ed.ac.uk (R C Smith) writes:
>>In LaTeX how do you stop figures floating around apart from
>>\begin{figure}[h]
>>
>... and the response from Timothy Van Zandt was ....
>
>>The whole point of the figure and table envirnments is to float their 
>>contents. Just leave out the \begin{figure}, \end{figure} and \caption{}.
>
>... Now the thing is this works beautifully, BUT I don't seem to be able
>to get any kind of referencing using \label.
>

Put the following in a style file (unfortunately, it can't go in the
preamble because of the @):

\def\figureh{\vskip \intextsep \def\@captype{figure}}
\def\endfigureh{\vskip \intextsep}

Now the figureh environment (with no optional arguments) is like
\begin{figure}[RIGHT HERE, OK!?!], in particular, the caption and label
work as desired, and the figure gets listed in the list of figures.
You could define tableh similarly, or do the same for any float. You
can use both the figureh and the figure environments in the same document.

Tim Van Zandt
tvz@princeton.edu