[texhax] A table with both images and text (format problem)
Dan Bolser
dmb at mrc-dunn.cam.ac.uk
Sun Jun 12 16:20:17 CEST 2005
On Sun, 12 Jun 2005, Lars Madsen wrote:
>Dan Bolser :
>
>> On Sat, 11 Jun 2005, Lars Madsen wrote:
>>
>>>
>>> just use p{...} on both columns (your pictures all have the same width).
>>>
>>> If the pictures in your 'real' document does not have the same width use
>>> the array package and use >{\centering\arraybackslash}p{5cm} for the last
>>> column
>>
>> I tried the above, but it looks just like as with '|c|' for the 'image
>> column' of the table.
>>
>> All my images are (or will be scaled to) the same size.
>>
>
>argh, ####! my mistake.
>
>use the array-package
>
>and m{...} instead of p{...}
>
>I remembered wrong.
>
>p{...} is like \parbox[t]{...}{...}
>m{...} is like \parbox[c]{...}{...}
>and
>b{...} is like \parbox[b]{...}{...}
Sorry, when I said 'I tried the above' I meant about using the altered
tabular preamble...
\begin{tabular}{|p{3cm}|p{5cm}|}
which looks just as bad as with
\begin{tabular}{|p{3cm}|c|}
(the original syntax giving the original problem).
I tried using
\begin{tabular}{|p{3cm}|m{5cm}|}
and
\begin{tabular}{|p{3cm}|b{5cm}|}
with the array package as you suggested, but it does not fix the problem.
While the m{...} form looks slightly improved it is still not correctly
formatted. Here is code that shows the problem...
\listfiles
\documentclass{report}
\usepackage{graphicx,array}
\begin{document}
\begin{tabular}{|p{3cm}|m{5cm}|}
\hline
more more more more more more more more more more more more more text
&
\rule{5cm}{2cm}
\\
\hline
\end{tabular}
\end{document}
The resulting table still has too much white space (unnecessary white
space). Is this just on my system?
I tried using the parbox equivelents that you suggested (wrapped around
the "\rule{5cm}{2cm}" command only, but the results are the same as the
above, i.e. "\parbox[c]{...}{...}" gives a slight improvement.
Again, if I use parbox on both the image column and the text column I
loose all my internal margins, and the text / image is right up against
the lines of the table.
\begin{tabular}{|p{3cm}|c|}
\hline
\parbox{3cm}{
more more more more more more more more more more more more more text
}
&
\parbox{5cm}{
\rule{5cm}{2cm}
}
\\
\hline
\end{tabular}
I don't really like the above solution because it is quite inflexible to
any layout changes, however, if I could give my parboxes above a little
spaceing at least it would be better than anything I have seen yet.
Can I center one parbox within another?
Thanks very much for your help so far :)
>
>
>
More information about the texhax
mailing list