[texhax] A table with both images and text (format problem)
Dan Bolser
dmb at mrc-dunn.cam.ac.uk
Sat Jun 11 19:32:43 CEST 2005
Hello, I want to create a table with an image in each row, and some text
to go with each image. I searched the archive and found this answer...
http://tug.org/mailman/htdig/texhax/2004-February/001782.html
That is quite close to what I want, but the below is a more accurate
reflection of my situation...
\documentclass{report}
\usepackage{graphicx}
\begin{document}
\begin{tabular}{|c|c|}
\hline
more more more more more more text
&
\includegraphics[height=2cm,width=5cm]{picture.1.eps}
\\
\hline
more more more more more more text
&
\includegraphics[height=2cm,width=5cm]{picture.2.eps}
\\
\hline
\end{tabular}
\end{document}
The above produces a beautiful table with no problems at all, however, if
you now change the tabular preamble to read...
\begin{tabular}{|p{3cm}|c|}
You see great big chunks of white space appear within the table because
none of the text wants to appear on the same line as the image, even
though they are in the same row of the table. (You see my state of
ignorance about latex when I say what the text 'wants'.)
I found that doing the following makes the problem less severe (but not
totally fixed)...
\begin{tabular}{|p{3cm}|c|}
\hline
more more more more more more more more more more more text
&
\parbox{5cm}{
\includegraphics[height=2cm,width=5cm]{picture.1.eps}
}
\\
\hline
more more more more more more more more more more more text
&
\parbox{5cm}{
\includegraphics[height=2cm,width=5cm]{picture.2.eps}
}
\\
\hline
\end{tabular}
Above you need more text to see clearly that there is still a problem.
I have tried lots of different ways of making the above look more compact
(remove any unnecessary white space), but I don't really know what I am
doing with latex.
Can anyone help me with a neat solution to this format problem?
Dan.
More information about the texhax
mailing list