totally new to LaTeX, this question occured today:
I have a table made of 17 columns. Every column is 0,6cm wide.
\begin{tabular}{p{0.6cm}|p{0.6cm}|p{0.6cm}|p{0.6cm}|p{0.6cm}|p{0.6cm}|p{0.6cm}|p{0.6cm}|p{0.6cm}|p{0.6cm}|p{0.6cm}|p{0.6cm}|p{0.6cm}|p{0.6cm}|p{0.6cm}|p{0.6cm}|p{0,6cm}}
That works perfectly and fine. But i also have on several rows 2 cells which are combined with \multicolumn like this:
\multicolumn{2}{|p{1.2cm}|}{\cellcolor{grey}Inverse dependency ratio}
Because this multi column combines two differenct cells i figured out 0,6 + 0,6 = 1,2. Right? So i gave this a width of 1,2cm… However this happens:
The combined \multicolumn doesnt fit to the 2 columns at the bottom of it. What did i do wrong?
Best Answer
It is best to post a complete (small) document showing all packages used however..
Aside from the first column, if you look at
and want to span those two columns, the first
|
is in the previous column so the span should not start with|
(unless this is the first column). Then there is padding of\tabcolsep
, then column content of0.6cm
, then another\tabcolsep
, then|
. In the original LaTeXtabular
this took no space, but you used\cellcolor
so you must have loadedcolortbl
(orxcolor
which loadscolortbl
) which implies that thearray
package is loaded. In thearray
package tabular|
takes up the width of the rule\arrayrulewidth
, then there is\tabcolsep
padding again,0.6cm
of content,\tabcolsep
padding, and another|
rule .So you want a
Note this does not have a
|
on the left and includes the space taken up by the padding and rules between the spanned columns.