# “Center” table offset, to account for floating figure?

I'm composing a document in which I use the wrapfig environment to let me wrap text around a floating figure. I've placed this figure (of width 0.3\textwidth) on the right of a page, and I'd like to include a table inline with the text that's wrapping around the figure, centered relative to the 0.7\textwidth I have left. Unfortunately:

• When using a regular center environment (and no table, just tabular), the table's centered with respect to the entire page
• When using the table environment, the table floats with regard to the text - I'd like it to stay exactly where I put it, rather than head to the bottom or top of the page like a figure (and I can't really figure out how to center it anyway)
• When using wraptable, I get warnings about wrapped figure collisions, and the table continues to float relative to the text

Is there a way I can tell LaTeX to "center" a tabular environment only in the left 0.7\textwidth of a page?

Edit: To be clearer, here's a snippet of my current file:

\begin{wrapfigure}{r}{0.3\textwidth}
\includegraphics[width=0.28\textwidth]{someimage.png}
\end{wrapfigure}

Some text here...

\begin{tabular}{c}
table info...
\end{tabular}

More text here...


I'd very much like the layout to look like:

Some text here...                                 someimage.png
someimage.png
table info...                     someimage.png
someimage.png
More text here...                                 someimage.png


Note how the table info is centered but only in the left portion of the page. I'm looking for the environment I can use to make that happen with the tabular chunk I have now.

-
Not sure if I understand what you're trying to achieve. First, is your figure a "float" in the (normal) LaTeX sense of the word? If it has be located in the cutout generated by wrapfig, how can it be a "float"? Second, it appears that you want the tabular stuff to be located to the right of the figure, with text above and below (but not to either side, right?) it. If so, why not place the table and figure environments in side-by-side minipages of width 0.7\textwidth and 0.3\textwidth, respectively -- and not "wrap" them inside a paragraph... – Mico Jan 12 '12 at 15:14
@Mico: Sorry I was unclear! I've edited the question to (hopefully) show better what I mean. – Tim Jan 12 '12 at 15:29
So am I correct to assume that you want the table and to figure together to take up the whole width of the page? In that case, what you need is two minipage environments, side by side. Make their combined width equal to the overall textwidth. – Michael Palmer Jan 12 '12 at 15:37

Here is one way to do this using \parshape.

\documentclass{article}
\usepackage[demo]{graphicx}% http://ctan.org/pkg/graphicx
\begin{document}

% Setup picture inclusion
\newsavebox{\myimage}%
\savebox{\myimage}{\includegraphics[width=.3\linewidth]{image}}%
\newlength{\mylinewidth}\setlength{\mylinewidth}{\dimexpr\linewidth-\wd\myimage-1em}% Leave a horizontal 1em gap

\null\hfill\smash{\raisebox{-\height}{\usebox{\myimage}}} \par \vspace*{-\dimexpr.7\baselineskip+\parskip}% Insert image
\parshape=1 0pt \mylinewidth
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras ultrices,
nunc aliquam ultrices euismod, lorem velit hendrerit urna, vel imperdiet
mi magna sed mauris.

\parshape=1 0pt \mylinewidth
\begin{center}
\begin{tabular}{ccc}
\hline
One & Two & Three \\
\hline
\end{tabular}
\end{center}

\parshape=3
0pt \mylinewidth 0pt \mylinewidth 0pt \linewidth
Donec et bibendum nulla. Donec laoreet mauris a turpis iaculis malesuada.
Integer semper cursus erat, ut blandit felis posuere a. Sed neque nisl,
porttitor eu viverra in, scelerisque vel nisi. Aliquam consectetur aliquam
facilisis. Proin magna velit, euismod eget pretium eu, euismod ut velit.
Praesent adipiscing imperdiet arcu eget congue. Integer et tellus ut quam

The image is first set, followed by a paragraph that leaves a 1em horizontal space between the text and the image via \parshape=1 0pt \mylinewidth. Here \mylinewidth is specifically set as \linewidth-<image width>-1em. Subsequent paragraphs are also set using this approach, while the last paragraph width is only modified for the rows affected by the image placement. In the MWE, this includes only the first 3 lines - the first two are set within \mylinewidth, while the third (and following) stretch the entire \linewidth.
Regarding the \parshape primitive, the following is taken from Chapter 14: How TeX Breaks Paragraphs into Lines (p 101) of the TeX Book:
You can specify an essentially arbitrary paragraph shape by saying \parshape=<number>, where the <number> is a positive integer n, followed by 2n <dimen> specifications. In general, \parshape=n i1 l1 i2 l2 ... in ln specifies a paragraph whose first n lines will have lengths l1, l2, ..., ln, respectively, and they will be indented from the left margin by the respective amounts i1, i2, ..., in. If the paragraph has fewer than n lines, the additional specifications will be ignored; if it has more than n lines, the specifications for line n will be repeated ad infinitum. You can cancel the effect of a previously specified \parshape by saying \parshape=0.