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 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.

share|improve this question
    
Welcome to TeX.sx! –  hpesoj626 Dec 3 '12 at 0:33
add comment

2 Answers 2

up vote 3 down vote accepted

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

share|improve this answer
add comment

Why to have \makebox? Removing it and changing the minipage widths, we get:

\documentclass{article}
\usepackage{booktabs}
\usepackage[margin=1in]{geometry}
\begin{document}

\begin{table}[tbh!]
%\makebox[0pt][c]{\parbox{1.2\textwidth}{%
\begin{minipage}[b]{0.5\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.5\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}
\end{document}

enter image description here

share|improve this answer
    
Well, maybe the OP is not allowed to change the page setup. –  egreg Dec 3 '12 at 0:21
    
@egreg: It is a possibility. But then the option is to reduce the font size, or encroach the table into the margin. Both may not be permitted too. :-) –  Harish Kumar Dec 3 '12 at 0:31
add comment

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.