I have some big tables and I want to know how it is possible to make the columns in a row all equally sized. You can see in the row 'Intra Prediciton' that the column with the content 'I_PCM' is bigger than the others in its row. Same with '16×8' and '8×8' in the next row. Is it possible to fix that?
Here the image:
I also appreciate other suggestions how to improve the tables.
heres the mess …
\newcolumntype{Y}{>{\columncolor[gray]{.8} } c|}
\newcolumntype{N}{>{\columncolor[gray]{.8} \color{gray}} c|}
%Spaltenzahl 8
% \color{gray} \color{lightgray} %\rowcolor{hellgrau} \cellcolor{dunkelgrau}
\begin{tabular}{| >{\color{white} \columncolor[gray]{.2}[.5\tabcolsep]} c | >{\columncolor[gray]{.8}[.5\tabcolsep]} c | >{\columncolor[gray]{.8}[.5\tabcolsep]} c | >{ \columncolor[gray]{.8}[.5\tabcolsep]} c | >{ \columncolor[gray]{.8}[.5\tabcolsep]} c | >{ \columncolor[gray]{.8}[.5\tabcolsep]} c | >{ \columncolor[gray]{.8}[.5\tabcolsep]} c | >{ \columncolor[gray]{.8}[.5\tabcolsep]} c }
\hline
Bildverfahren & \multicolumn{3}{Y}{progressive} & \multicolumn{3}{Y} {interlaced } \\
\hline
Frames/Slices & \multicolumn{2}{Y}{I} & \multicolumn{2}{Y}{P} & \multicolumn{2}{Y}{B} \\
\hline
Slices & \multicolumn{3}{N}{nein} & \multicolumn{3}{Y}{ja} \\
\hline
Transformation & \multicolumn{2}{N}{8x8 DCT} & \multicolumn{2}{Y}{8x8 IDCT} & \multicolumn{2}{Y}{4x4 IDCT} \\
\hline
Adaptive Quantization & \multicolumn{2}{N}{nein} & \multicolumn{2}{N}{Lumi} & \multicolumn{2}{Y}{Variance} \\
\hline
Max. Ref Frames & \multicolumn{3}{N} {keine} & \multicolumn{3}{Y}{16} \\
\hline
B-Pyramid &\multicolumn{3}{N} {nein} & \multicolumn{3}{Y} {ja} \\
\hline
Loop-Filter & \multicolumn{3}{N} {nein} & \multicolumn{3}{Y} {ja} \\
\hline
Entropiekodierung & \multicolumn{3}{Y} {CAVLC} & \multicolumn{3}{Y}{CABAC} \\
\hline
SubPixel ME & \multicolumn{2}{N} {nein} & \multicolumn{2}{N} {halb} & \multicolumn{2}{Y}{viertel} \\
\hline
Intra Prediction & \multicolumn{1}{N} {nein} & \multicolumn{1}{Y}{16x16} & \multicolumn{1}{Y}{8x8} & \multicolumn{1}{Y}{4x4} &\multicolumn{2}{Y}{ I\_PCM}\\
\hline
MB-Partitionierung & \multicolumn{1}{Y}{16 x 16} & \multicolumn{1}{Y}{8x16} & \multicolumn{2}{Y}{16x8} & \multicolumn{2}{Y}{8x8} \\
\hline
SubMB-Partitionierung & \multicolumn{1}{N}{nein} & \multicolumn{1}{Y}{8x8} & \multicolumn{1}{Y}{4x8} & \multicolumn{1}{Y}{8x4} & \multicolumn{2}{Y}{4x4} \\
\hline
%Intra Prediction & \color{gray} nein & 16×16 & 8×8 & 4×4 \\
Farb-Sampling & \multicolumn{2}{Y}{4:0:0} & \multicolumn{2}{Y}{4:2:0} & \multicolumn{1}{Y}{4:2:2} & \multicolumn{1}{Y}{4:4:4} \\
\hline
Bit-Tiefe & \multicolumn{1}{Y}{8} & \multicolumn{2}{Y}{8 bis 10} & \multicolumn{2}{Y}{8 bis 12} & \multicolumn{1}{Y}{8 bis 14} \\
\hline
Error Prevention /Handling & \multicolumn{3}{N} {nein} &\multicolumn{3}{Y}{ja} \\
\hline
Level/Profile & \multicolumn{3}{N} {nein} &\multicolumn{3}{Y}{ja} \\
\hline
\end{tabular}
EDIT:
Isn't that cool? Used tablet now…
Unfortunately the vrules are sometimes not so beautiful. You see it when comparing the last two lines. Should I color the table?
Best Answer
Even though I don't like the layout you are trying to produce, since I think it is very confusing for the reader, here is some coding that will produce equally spaced cells in a particular column.
If the row has a non-standard height, then the final
\strut
will have to be replaced by an appropriate version of\vrule width 0pt height 14pt depth 4pt
.The basic idea of the code is that
\tabelt
produces a variable width box with its contents centered, but of zero width. To make the first and last boxes correct, the table specification includes@{}
to kill spacing added between columns. To prevent everything collapsing the width of the column is specified.A similar idea will work in
\multicolumn
:Here will kill extra spacing at the beginning with
\unksip
and the\strut
is no longer necessary.Update: Usage with
colortbl
The first solution works with
colortbl
with very little modification:For the second version, using
\multicolumn
, one has adjust the code some what, sincecolortbl
produces its alignments usesfill
s instead offil
s (in attempt to stop the user doing what we are trying to do :-) :