Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I am using the below table and I am getting A LOT of white space between my first column and my models. The space between my models is fine.

\begin{table}\caption{Regression table\label{tab1}}
\begin{center}
\begin{tabular}{l r l r l r l}
\hline
& \multicolumn{2}{c}{Model 1}&\multicolumn{2}{c}{Model 2}&\multicolumn{2}{c}{Model 3}\\
\hline
\hline
Variable 1 & 12.758 & * &  13.822 & *** & 2.123 & *\\
\hline
\textit{*p < 0.05, ** p < 0.01, *** p < 0.001}
\end{tabular}
\end{center}
\end{table}

How can I trim this down so I do not need to use landscape?

share|improve this question
    
Use \multicolum{4}{l}{...} for the last line –  egreg Mar 17 '13 at 21:51
    
Welcome to TeX.sx! –  Peter Jansson Mar 17 '13 at 22:03
    
@percusse There was an error in my code. I don't see the extra separator –  Chris J Mar 17 '13 at 22:08
    
@egreg Thanks for the response. There was an error in my code, but I do not know what you mean by last line –  Chris J Mar 17 '13 at 22:08

1 Answer 1

up vote 2 down vote accepted

The excessive width of the first column arises because the final line of the tabular environment, \textit{*p < 0.05, ** p < 0.01, *** p < 0.001}, is interpreted as belonging to the first column. Use something like \multicolumn{7}{l}{<Content>} instead. (In your initial example, you had 5 columns of data but only 4 columns were specified in the setup of the tabular environment. I see you've updated the code in the meantime to feature 7 columns.)

Separately, I would recommend using the booktabs package to get some good-looking horizontal rules (produced by \toprule, \midrule, and \cmidrule).

enter image description here

\documentclass{article}
\usepackage{booktabs}
\begin{document}
\begin{table}
\caption{Regression table}\label{tab1}
\centering

\smallskip
\begin{tabular}{@{}l cccccc @{}}
\toprule
& \multicolumn{2}{c}{Model 1}
& \multicolumn{2}{c}{Model 2}
& \multicolumn{2}{c@{}}{Model 3}\\
\cmidrule(lr){2-3} \cmidrule(lr){4-5} \cmidrule(l){6-7}
& Coef. & SE & Coef. & SE & Coef. & SE\\
\midrule
Variable 1 & 12.758 & * &  13.822 & *** & 2.123 & *\\
\midrule[\heavyrulewidth]
\multicolumn{7}{@{}l}{* $p < 0.05$, ** $p < 0.01$, *** $p < 0.001$.}\\
\end{tabular}
\end{table}
\end{document}
share|improve this answer
    
Thanks! This is almost exactly what I wanted. How can I get the caption to center across the entire table and not have the preamble "Table 1:". –  Chris J Mar 17 '13 at 22:29
    
@CJ12 - I guess you don't need a "caption" -- in the LaTeX-specific sense of the word -- for your table. Just insert the instruction \multicolumn{7}{c}{Regression table}\` after \begin{tabular}{@{} l cccccc @{}}, and replace \toprule` with \midrule[\heavyrulewidth]. Oh, and you can also omit the \smallskip statement. –  Mico Mar 17 '13 at 22:41
    
the only problem is my header is several lines stacked and with caption it worked but with this new method is it possible to stack the header? If I want Regression table and under it 'Attempt B' –  Chris J Mar 17 '13 at 23:01
    
@CJ12: To "stack" (and center-set, right?) two consecutive header lines using the \multicolumn method, you might write \multicolumn{7}{c}{Regression table} \\ \multicolumn{7}{c}{Attempt B} \\ –  Mico Mar 18 '13 at 2:19

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.