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'm using minipage to put two tables next to each other, and instead it is putting them in vertically. It seems like this is usually caused by having blank lines between the minipages, but that isn't the case here. What can I do to rectify this?

\documentclass{article}
\usepackage{fullpage}
\begin{document}    
\begin{table}[htbp]\centering
\begin{minipage}[c]{\textwidth}
\def\sym#1{\ifmmode^{#1}\else\(^{#1}\)\fi}
\caption{phone T-tests}
\begin{tabular}{l*{1}{c}}
\hline\hline
                    &\multicolumn{1}{c}{Altruism\&Image}\\
\hline
pledge              &       10.00         \\
                &     (16.12)         \\
[1em]
pledge\_zeros        &       8.020         \\
                    &     (4.311)         \\
[1em]
pledge\_binary       &      0.0924\sym{**} \\
                    &    (0.0326)         \\
\hline
Observations        &         710         \\
\hline\hline
\multicolumn{2}{l}{\footnotesize Standard errors in parentheses}\\
\multicolumn{2}{l}{\footnotesize \sym{*} \(p<0.05\), \sym{**} \(p<0.01\), \sym{***} \                        (p<0.001\)}\\
\end{tabular}
\end{minipage}
\begin{minipage}[c]{\textwidth}
\def\sym#1{\ifmmode^{#1}\else\(^{#1}\)\fi}
\caption{phone T-tests}
\begin{tabular}{l*{1}{c}}
\hline\hline
                    &\multicolumn{1}{c}{Alruism\&Pressure}\\
\hline
pledge              &      -3.091         \\
                    &     (15.40)         \\
[1em]
pledge\_zeros        &       0.781         \\
                    &     (4.831)         \\
[1em]
pledge\_binary       &      0.0243         \\
                    &    (0.0350)         \\
\hline
Observations        &         680         \\
\hline\hline
\multicolumn{2}{l}{\footnotesize Standard errors in parentheses}\\
\multicolumn{2}{l}{\footnotesize \sym{*} \(p<0.05\), \sym{**} \(p<0.01\), \sym{***} \    (p<0.001\)}\\

\end{tabular}
\end{minipage}
\end{table}
\end{document}
share|improve this question
    
The width of the minipages is \textwidth each. Two times textwidth won't fit on a page. –  Johannes_B Jul 28 at 20:10

2 Answers 2

up vote 5 down vote accepted

You have \textwidth wide minipages; however, in cases like these, it's better to use threeparttable, so the caption will be properly centered over the table.

\documentclass{article}
\usepackage{fullpage}
\usepackage{threeparttable}
\begin{document}    
\begin{table}[htbp]\centering
\def\sym#1{\ifmmode^{#1}\else\(^{#1}\)\fi}
\begin{minipage}{.45\textwidth}
\begin{threeparttable}
\caption{phone T-tests}
\begin{tabular}{l*{1}{c}}
\hline\hline
                    &\multicolumn{1}{c}{Altruism\&Image}\\
\hline
pledge              &       10.00         \\
                &     (16.12)         \\
[1em]
pledge\_zeros        &       8.020         \\
                    &     (4.311)         \\
[1em]
pledge\_binary       &      0.0924\sym{**} \\
                    &    (0.0326)         \\
\hline
Observations        &         710         \\
\hline\hline
\multicolumn{2}{l}{\footnotesize Standard errors in parentheses}\\
\multicolumn{2}{l}{\footnotesize \sym{*} \(p<0.05\), \sym{**} \(p<0.01\), \sym{***} \                        \(p<0.001\)}\\
\end{tabular}
\end{threeparttable}
\end{minipage}\hfill
\begin{minipage}{.45\textwidth}
\begin{threeparttable}
\caption{phone T-tests}
\begin{tabular}{l*{1}{c}}
\hline\hline
                    &\multicolumn{1}{c}{Alruism\&Pressure}\\
\hline
pledge              &      -3.091         \\
                    &     (15.40)         \\
[1em]
pledge\_zeros        &       0.781         \\
                    &     (4.831)         \\
[1em]
pledge\_binary       &      0.0243         \\
                    &    (0.0350)         \\
\hline
Observations        &         680         \\
\hline\hline
\multicolumn{2}{l}{\footnotesize Standard errors in parentheses}\\
\multicolumn{2}{l}{\footnotesize \sym{*} \(p<0.05\), \sym{**} \(p<0.01\), \sym{***} \    \(p<0.001\)}\\

\end{tabular}
\end{threeparttable}
\end{minipage}
\end{table}
\end{document}

Notice also \begin{minipage}[t], so the vertical alignment will be with respect to the captions.

enter image description here

share|improve this answer

Use

\begin{minipage}{0.49\textwidth}
...
\end{[minipage}\hfill
\begin{minipage}{0.49\textwidth}
...
\end{[minipage}

It must be less or equal to the current line width. But you had both with \textwidth

share|improve this answer
1  
s/nd{\[mi/nd{mi –  Johannes_B Jul 28 at 20:26

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.