Floating a wraptable ?

536 views
Skip to first unread message

Ivan K.

unread,
May 31, 2013, 4:41:07 PM5/31/13
to LaTeX Users Group
I am embarrassed to be back so soon.
I do try to look up some documentation on these things.



I have tabular that I want to be on the one side
of the page while text is formatted on the other side
of the same page

This code does just that:

\begin{wraptable}[]{r}{0.5 \textwidth}
\begin{tabular}{|l| rlr}
etc & etc & etc & etc \\
etc & etc & etc & etc \\
\end{tabular}
\end{wraptable}

except that this code will start the tabular _where_ever_
this code exists in the document in relation to
the text this code is near. This means that the tabular
might start 3/4 down the page (vertically) and run off the
end of the page.

In addition to wrapping the text around this tabular,
I would like the tabular to "float" and find a place
on a page where it can be created without running
off the page.

What more do I need to do?

Thank you very much for your help.

Peter Flynn

unread,
Jun 1, 2013, 5:38:42 PM6/1/13
to latexusersgroup
On Fri, May 31, 2013 at 9:41 PM, Ivan K. <ivan_...@yahoo.com> wrote:
I am embarrassed to be back so soon.
I do try to look up some documentation on these things.

The key is in the wrapfig documentation, at the top of p.2:

New wrapping environments may be added when new float types are defined (us-
ing memoir.cls, float.sty, or ccaption.sty). Any wrapping environment, wrapfigure,
wraptable, or something else may be invoked using the wrapfloat environment, as in
\begin{wrapfloat}{figure}{O}{5cm}.
To use float.sty properly, load package float before wrapfig, and declare any new float
types after loading both. Likewise for ccaption.sty and \newfloatlist and memoir.cls
and its \newfloat.
 
I have tabular that I want to be on the one side of the page while text is formatted on the other side
of the same page

This code does just that:

   \begin{wraptable}[]{r}{0.5 \textwidth}
        \begin{tabular}{|l| rlr}
          etc & etc & etc & etc \\
          etc & etc & etc & etc \\
        \end{tabular}
   \end{wraptable}

There are at least two other ways to do this:
  1. If the widths of the table and the text are to be equal (ie half-width of the page each, as you seem to imply with .5\textwidth), and roughly the same height, you could use a multicols{2} environment from the multicol package, separating the table from the text with \vfill\columnbreak to separate them;
  2. If they need to be unequal widths, use a table for the whole thing, with an extra column for the text, and make it use \multirow (from the multirow package).
You can put both these solutions inside a figure or table evironment.

except that this code will start the tabular _where_ever_ this code exists in the document in relation to the text this code is near.

Correct. Wrapfig documentation, p.1 says:

The wrapfigure and wraptable environments [...] are not regular floats like figure and table

In addition to wrapping the text around this tabular, I would like the tabular to "float" and find a place
on a page where it can be created without running off the page.

Wrapped text in wrapfig/wraptable must not be part of the continuous text of the document if you want the environment to float, otherwise it will lose contiguity with its preceding and following text. I am assuming that because you want it to float, that the text to be wrapped is not part of the continuous text of the document, because its position will of course be lost if it becomes a float.

If that condition is satisfied, just enclose the wraptable environment in a normal table environment.

///Peter

Ivan K.

unread,
Jun 2, 2013, 11:19:30 PM6/2/13
to LaTeX Users Group

Thank you very much for your copious information Mr. Flynn.

It was my intention to have a {tabular}
(1) on just a side of a page
(2) float to a spot where the tabular fit
(3) and have the continuous text of the document
wrap around it.

If I understand you correctly, there is no way to do this?
(except for maybe using \begin{wrapfloat} ?)



One "brute force" solution I came up with was to:

(1) run pdflatex and _see_ where the continuous
text happen to format in the document.
(2) and then manually put the {wraptable} item
in the continuous text where it will fit.

which I may resort to.

Thanks again for your help.


Reply all
Reply to author
Forward
0 new messages