我使用 minipage 将两个表格并排放置,但它却将它们垂直放置。这似乎通常是由于 minipage 之间有空行造成的,但这里的情况并非如此。我该怎么做才能纠正这个问题?
\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}
答案1
您有\textwidth
较宽的迷你页面;但是,在这种情况下,最好使用threeparttable
,这样标题就会正确地位于表格中央。
\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}
还请注意\begin{minipage}[t]
,垂直对齐将相对于标题。
答案2
使用
\begin{minipage}{0.49\textwidth}
...
\end{[minipage}\hfill
\begin{minipage}{0.49\textwidth}
...
\end{[minipage}
它必须小于或等于当前线宽。但你同时使用了\textwidth