# How to distribute space equally for cells?

I have problems with a regression table in my thesis, as LaTeX does not assort cell space equal despite of having stated exact proportions in the code.

Here is the relevant code for it:

\documentclass[12pt]{article}
\usepackage{graphicx}
\usepackage{epstopdf}
\usepackage{palatino,url}
\usepackage{amssymb}
\usepackage{threeparttable}
\usepackage{caption}
\begin{document}

...

\begin{table}[htbp]\footnotesize
\caption{OLS Estimates}
\begin{center}
\begin{threeparttable}[b]
\scalebox{0.8}{%

\begin{tabular}{|p{3cm}|p{3cm}|p{3cm}|p{3cm}|p{3cm}|p{3cm}|p{3cm}|}
\hline
\multicolumn{ 1}{|c|}{Constant} & \multicolumn{ 1}{|c|}{GNI} & \multicolumn{ 1}{|c|}
{CPI} & \multicolumn{ 1}{|c|}{Inflation} & \multicolumn{ 1}{|c|}{Liquidity} &
\multicolumn{  1}{|c|}{DebtExports} & \multicolumn{ 1}{|c|}{GDPGrowth} \\ \hline
\multicolumn{ 1}{l}{} & \multicolumn{ 1}{l}{} & \multicolumn{ 1}{l}{} & \multicolumn{
1}{l}{} & \multicolumn{ 1}{l}{} & \multicolumn{ 1}{l}{} & \multicolumn{ 1}{l}{}\\\hline
\multicolumn{ 1}{|c|}{14.303\tnote{***}} & \multicolumn{ 1}{|c|}{-1.704\tnote{**}} &
\multicolumn{ 1}{|c|}{-1.28\tnote{**}} & \multicolumn{ 1}{|c|}{0.127\tnote{**}} &
\multicolumn{ 1}{|c|}{-0.042\tnote{***}} & \multicolumn{ 1}{|c|}{0.368\tnote{**}} &
\multicolumn{ 1}{|c|}{0.052} \\
\multicolumn{ 1}{|c|}{(8.91)} & \multicolumn{ 1}{|c|}{(3.01)} & \multicolumn{ 1}{|c|}
{(2.52)} & \multicolumn{ 1}{|c|}{(2.93)} & \multicolumn{ 1}{|c|}{4.47)} & \multicolumn{
1}{|c|}{(2.16)} & \multicolumn{ 1}{|c|}{(1.04)} \\ \hline
\multicolumn{ 3}{l}{Note: Absolute values of t-Statistics are reported in parentheses}
\end{tabular}}
\begin{tablenotes}
\item[\tnote{***}]Significant at the 1 percent level.
\item[\tnote{**}]Significant at the 5 percent level.
\item[\tnote{*}]Significant at the 10 percent level.
\end{tablenotes}
\end{threeparttable}
\end{center}
\label{}
\end{table}


Has someone an idea about how to bring also cell 3, CPI, back in line? So far, all other included tables work perfectly.

-
Welcome to TeX.sx! Is there a reason you're first defining your table with paragraph-columns (p{3cm}) and then doing all the magic with centered multicolumns spanning only one column? That looks unnecessarily complicated to me. (Also, your question was migrated here from Stack Overflow. Please register on this site, too, and make sure that both accounts are associated with each other (by using the same OpenID), otherwise you won't be able to comment on or accept answers or edit your question.) –  doncherry May 6 '12 at 13:04
Thank you very much for your help, worked very well! –  user14281 May 6 '12 at 14:28

## migrated from stackoverflow.comMay 6 '12 at 12:55

This question came from our site for professional and enthusiast programmers.

The problem is in the final \multicolumn{3}{...} which should be \multicolumn{7}{...}: the text doesn't fit in three cells, so the excess is put in the last of the spanned columns.

However, your input is very complicated and I suggest a simpler method:

\begin{table}[htbp]\footnotesize
\caption{OLS Estimates}\label{xxx}
\centering
\begin{threeparttable}[b]
\begin{tabular}{|*{7}{>{\centering\arraybackslash}p{\dimexpr(\textwidth-2\tabcolsep)/7\relax}|}}
\hline
Constant & GNI & CPI & Inflation & Liquidity & DebtExports & GDPGrowth \\
\hline
\hline
14.303\tnote{***} & $-$1.704\tnote{**} & $-$1.28\tnote{**} & 0.127\tnote{**} &
$-$0.042\tnote{***} & 0.368\tnote{**} & 0.052 \\
(8.91) & (3.01) & (2.52) & (2.93) & (4.47) & (2.16) & (1.04) \\
\hline
\multicolumn{7}{l}{Note: Absolute values of t-Statistics are reported in parentheses}
\end{tabular}
\begin{tablenotes}
\item[\tnote{***}]Significant at the 1 percent level.
\item[\tnote{**}]Significant at the 5 percent level.
\item[\tnote{*}]Significant at the 10 percent level.
\end{tablenotes}
\end{threeparttable}
\end{table}


Each column is allocated one seventh of the available space, and the contents is centered.

I'd suggest also to load the booktabs package and avoid vertical rules: the tabular would become

\begin{tabular}{|*{7}{>{\centering\arraybackslash}p{\dimexpr(\textwidth-2\tabcolsep)/7\relax}|}}
\toprule
Constant & GNI & CPI & Inflation & Liquidity & DebtExports & GDPGrowth \\
\midrule
14.303\tnote{***} & $-$1.704\tnote{**} & $-$1.28\tnote{**} & 0.127\tnote{**} &
$-$0.042\tnote{***} & 0.368\tnote{**} & 0.052 \\
(8.91) & (3.01) & (2.52) & (2.93) & (4.47) & (2.16) & (1.04) \\
\bottomrule
\multicolumn{7}{l}{Note: Absolute values of t-Statistics are reported in parentheses}
\end{tabular}

-

It's because you override the column types by using the \multicolumn command. So you should not use those here. It looks like you want to have p{3cm} columns in which text is centered; to do so you can define a new column type using the \newcolumntype command from the array package. Here is your table formatted with centered columns of 1.5cm each (to fit on the page). Notice how much more readable the table contents is as well!

\documentclass[12pt]{article}

\usepackage{threeparttable}
\usepackage{array}

% define a new column type Z
\newcolumntype{Z}{>{\centering\hspace{0pt}\arraybackslash}p{1.5cm}}

% notice that we could have defined a parametrized column type like this:
% \newcolumntype{C}[1]{>{\centering\hspace{0pt}\arraybackslash}p{#1}}
% this would be used as C{1.5cm} inside the column definition of tabular

\begin{document}

\footnotesize
\begin{tabular}{|Z|Z|Z|Z|Z|Z|Z|}
\hline
Constant & GNI & CPI & Inflation & Liquidity &  DebtExports & GDPGrowth \\
\hline
&  &  &  &  &  & \\
\hline
14.303\tnote{***} & -1.704\tnote{**} & -1.28\tnote{**} & 0.127\tnote{**} & -0.042\tnote{***} & 0.368\tnote{**} & 0.052 \\
(8.91) & (3.01) & (2.52) & (2.93) & 4.47) & (2.16) & (1.04) \\
\hline
\multicolumn{7}{l}{Note: Absolute values of t-Statistics are reported in parentheses}
\end{tabular}
\begin{tablenotes}
\item[\tnote{***}]Significant at the 1 percent level.
\item[\tnote{**}]Significant at the 5 percent level.
\item[\tnote{*}]Significant at the 10 percent level.
\end{tablenotes}

\end{document}

-
The p{3cm} will set the minimum width of a column. But if one of your \multicolumn is larger than the columns will adjust.
\multicolumn{7}{l}{Note: Absolute values of t-Statistics are reported in parentheses}