# Table spacing, multi column

Good day, hi, I have a question to ask. If you have some spare time please kindly spare me a few minutes to enlighten me on the following question. Thanks in advance!

So I am trying to construct a table, but the spacing isn't balanced.

\documentclass{article}
\usepackage[english]{babel}
\usepackage{multirow}

\begin{document}
\begin{center}
\begin{tabular}{ |c|c|c|c|c|c|c|c|c|c| }

\hline
\multirow{2}{*}{Class} & \multicolumn{2}{c|}{Similarity Gibbs Sampling} & \multicolumn{2}{c|}{Hand Computatation} & \multicolumn{4}{c|}{Combination} & \multirow{2}{*}{Graph Cut(S)} \\ \cline{2-1} \cline{3-1} \cline{4-1} \cline{5-1} \cline{6-1} \cline{7-1} \cline{8-1} \cline{9-1}
& 0 & 1 & 0 & 1 & 1 & 2 & 3 & 4 & \\ \hline
${V_1}$ & 0.388 & 0.612 & 0.393 & 0.607 & 0 & 0 & 1 & 0 & 2 \\ \hline
${V_2}$ & 1 & 0 & 1 & 0 & 0 & 0 & 1 & 1 & 2 \\ \hline
${V_3}$ & 0 & 1 & 0 & 1 & 1 & 0 & 1 & 0 & 3 \\ \hline
${V_4}$ & 0.388 & 0.612 & 0.393 & 0.607 & 1 & 0 & 1 & 1 & 1 \\ \hline
%\cline{2-1}
\end{tabular}
\end{center}
\end{document}


As you can see, the 3rd column and 5th column do not share the same spacing as 2nd and 4th respectively.

-
have a look at the tabularx package, and also the siunitx package for help with decimal alignment (and more) –  cmhughes Aug 18 '13 at 1:00

In addition to the issue with the widths of columns 3 and 5 not being the same as those of columns 2 and 4, respectively, I'd say your table has a second issue: The horizontal lines you're trying to draw between the first and second header rows touch each other and thus don't provide visual clues as to how the columns are grouped. (This is a shortcoming caused by the properties of \cline which can't be remedied easily short of using a different group of line-drawing commands -- see below for an alternative.)

• To fix the first issue, you could use the tabularx package and its X column type to guarantee equal widths of columns 2 through 5. By default, material in a column of type X is set left-justified (ragged-right); in the example below I define a new column type, Y, which is a center-set version of X.

• The second issue is best addressed, I believe, by using the line-drawing commands of the booktabs package. In particular, the command \cmidrule can serve to draw short "trimmed" horizontal lines that don't touch. Other benefits of using the rule-drawing comamnds of the booktabs package is that the spacing above and below the lines is much better than what you'll get with \hline and \cline and that the rules aren't all equally thick, making for a much more interesting-looking table.

\documentclass{article}
\usepackage{tabularx,booktabs}
\newcolumntype{Y}{>{\centering\arraybackslash}X}
\usepackage[margin=1in]{geometry}  % choose page parameters best for your document
\begin{document}
\begin{table}
\begin{tabularx}{\textwidth}{@{} l *{4}{Y} *{5}{c} @{}}
\toprule
Class &
\multicolumn{2}{c}{Similarity Gibbs Sampling} &
\multicolumn{2}{c}{Hand Computation} &
\multicolumn{4}{c}{Combination} &
Graph Cut(S) \\
\cmidrule(lr){2-3} \cmidrule(lr){4-5} \cmidrule(lr){6-9} % left- and right-trimming
& 0 & 1 & 0 & 1 & 1 & 2 & 3 & 4 & \\
\midrule
${V_1}$ & 0.388 & 0.612 & 0.393 & 0.607 & 0 & 0 & 1 & 0 & 2\\
${V_2}$ & 1 & 0 & 1 & 0 & 0 & 0 & 1 & 1 & 2 \\
${V_3}$ & 0 & 1 & 0 & 1 & 1 & 0 & 1 & 0 & 3 \\
${V_4}$ & 0.388 & 0.612 & 0.393 & 0.607 & 1 & 0 & 1 & 1 & 1\\
\bottomrule
\end{tabularx}
\end{table}
\end{document}

-
Thanks a million!!! Thanks for your generosity, thanks for your kindness, thanks for your advice and thanks for your time!!! God bless you!! –  Vincent Benedict Victor Aug 20 '13 at 18:01