I have a text in a 3 row table like as follows
\begin{wrapfigure}{r}{3in}
\centering
\includegraphics{style3color.png}
\end{wrapfigure}
\begin{tabular*}{7in}{l@{\extracolsep{\fill}}r}
a \\
b \\
c \\
\end{tabular*}
I want to insert an image that spans across all the rows in the 2nd column. What's the best way to do it?
As you can see from above I have used wrapfig
package to wrap this table around the image. It works but the image does not come to the center. It starts from b to end way below c.
Best Answer
You can use the
tabularx
package to insert atabularx
that fits within the line (or7in
, depending on your requirement) and\smash
the contents of your image to make it fit within your parameters vertically. Here's a quick example of what I mean:\hfill
pushes the contents of theX
-column to the right (as it seems like you're after anr
-column, but it may not be necessary). The image height is forced to3\normalbaselineskip
which makes it fit within 3 lines of the table. However, it's moved down slightly (.3\normalbaselineskip
) to accommodate for the fact that it's actually placed on the baseline, which doesn't center it vertically across the three rows.\smash
removes all vertical height, making it span more than one row (similar to what\multirow
from themultirow
package would do).tabularx
is not necessary, but it may help in these situations, depending on your actual application/usage.