[Tex/LaTex] table positions within a minipage

minipage

I have the following code, it should generate 2 side-by-side tables. However, the left table is too left that its last half is there, and the right table thereafter. How can I position them properly?

\begin{table}[tbh!]
\makebox[0pt][c]{\parbox{1.2\textwidth}{%
\begin{minipage}[b]{0.6\linewidth} % A minipage that covers half the page 
\centering
\caption{obs=1000, Coverage Probability}
\begin{tabular}{lcccc}
\toprule
Estimators & G=3 & G=10 & G=30\\ 
\midrule
2SLS & 0.849 & 0.850 & 0.850\\ 
GMM & 0.850 & 0.849 & 0.851\\ 
EL & 0.848 & 0.850 & 0.851\\ 
EL biascorr & 0.848 & 0.850 & 0.851\\ 
\bottomrule
\end{tabular}
\end{minipage}%
 \begin{minipage}[b]{0.4\linewidth}\centering
\caption{obs=1000, Test Statistic}
\begin{tabular}{lcccc}
\toprule
Number of acceptances & G=3 & G=10 & G=30\\ 
\midrule
Overidentification&&&\\
restrictions test & 893 & 831 & 720\\
Wald Test & 893 & 831 & 723\\ 
LM test & 893 & 831 & 718\\ 
\bottomrule
\end{tabular}
\end{minipage}%
}}
\end{table}

If someone can help, it will be great.

Best Answer

It seems that you're happy to make the table stick in the margin. But you have several problems: the caption for the table on the left is wider than the table, and the table on the right is wider than the left one.

So first of all I'd enlarge a bit the left table (with \addtolength{\tabcolsep}{2pt}) and measure the two tables, so as to build minipages of the exact required width.

\documentclass{article}
\usepackage{booktabs,lipsum,calc}

\newsavebox{\leftbox}
\newsavebox{\rightbox}

\begin{document}
\lipsum[2]

\begin{table}[tbh!]

\begin{lrbox}{\leftbox}
\addtolength{\tabcolsep}{2pt}%
\begin{tabular}{lccc}
\toprule
Estimators & G=3 & G=10 & G=30\\ 
\midrule
2SLS & 0.849 & 0.850 & 0.850\\ 
GMM & 0.850 & 0.849 & 0.851\\ 
EL & 0.848 & 0.850 & 0.851\\ 
EL biascorr & 0.848 & 0.850 & 0.851\\ 
\bottomrule
\end{tabular}
\end{lrbox}

\begin{lrbox}{\rightbox}
\begin{tabular}{lccc}
\toprule
Number of acceptances & G=3 & G=10 & G=30\\ 
\midrule
Overidentification&&&\\
restrictions test & 893 & 831 & 720\\
Wald Test & 893 & 831 & 723\\ 
LM test & 893 & 831 & 718\\ 
\bottomrule
\end{tabular}
\end{lrbox}

\centering
\makebox[0pt]{%
\begin{minipage}[b]{\wd\leftbox} % A minipage that covers half the page 
\centering
\caption{obs=1000, Coverage Probability}
\usebox{\leftbox}
\end{minipage}\quad
\begin{minipage}[b]{\wd\rightbox}
\centering
\caption{obs=1000, Test Statistic}
\usebox{\rightbox}
\end{minipage}%
}
\end{table}
\end{document}

enter image description here

If you want to reduce the size, here's how you can do it with the caption package:

\documentclass{article}
\usepackage{booktabs,lipsum,calc}
\usepackage{caption}

\newsavebox{\leftbox}
\newsavebox{\rightbox}

\begin{document}
\lipsum[2]

\begin{table}[tbh!]
\footnotesize\captionsetup{font=footnotesize,aboveskip=2pt}
\begin{lrbox}{\leftbox}
\addtolength{\tabcolsep}{1pt}%
\begin{tabular}{lccc}
\toprule
Estimators & G=3 & G=10 & G=30\\ 
\midrule
2SLS & 0.849 & 0.850 & 0.850\\ 
GMM & 0.850 & 0.849 & 0.851\\ 
EL & 0.848 & 0.850 & 0.851\\ 
EL biascorr & 0.848 & 0.850 & 0.851\\ 
\bottomrule
\end{tabular}
\end{lrbox}

\begin{lrbox}{\rightbox}
\begin{tabular}{lccc}
\toprule
Number of acceptances & G=3 & G=10 & G=30\\ 
\midrule
Overidentification&&&\\
restrictions test & 893 & 831 & 720\\
Wald Test & 893 & 831 & 723\\ 
LM test & 893 & 831 & 718\\ 
\bottomrule
\end{tabular}
\end{lrbox}

\centering
\makebox[0pt]{%
\begin{minipage}[b]{\wd\leftbox} % A minipage that covers half the page 
\centering
\caption{obs=1000, Coverage Probability}
\usebox{\leftbox}
\end{minipage}\quad
\begin{minipage}[b]{\wd\rightbox}
\centering
\caption{obs=1000, Test Statistic}
\usebox{\rightbox}
\end{minipage}%
}
\end{table}
\end{document}

enter image description here