3

I made 2 tables, side by side, based upon egreg's answer here: table positions within a minipage

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

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

\begin{document}
\begin{table}[tbh!]

\begin{lrbox}{\leftbox}
\addtolength{\tabcolsep}{2pt}%
\begin{tabular}{ | p{1.7cm} | p{4cm}| p{0.8cm} | }
  \hline
  col 1-1 & col 1-2 & col 1-3 \\
  \hline
\end{tabular}
\end{lrbox}

\begin{lrbox}{\rightbox}
\begin{tabular}{ |c|c| }
  \hline
  col 2-1 & col 2-2\\
  \hline
\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}

It gives this:

enter image description here

As you see the tables are not equal and the description of the second table is shrunk too much.

How can I put the second table to the center of the empty space left and make the description text wider? So the text stretched from the first table right margin to the page right margin.

4

For this case the original idea can still be used, with some modifications:

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

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

\begin{document}
\begin{table}[tbh!]

\begin{lrbox}{\leftbox} % this is the wider table (top alignment)
\begin{tabular}[t]{ | p{1.7cm} | p{4cm}| p{0.8cm} | }
  \hline
  col 1-1 & col 1-2 & col 1-3 \\
  \hline
\end{tabular}
\end{lrbox}

\begin{lrbox}{\rightbox} % the narrower table (top alignment)
\begin{tabular}[t]{ |c|c| }
  \hline
  col 2-1 & col 2-2\\
  \hline
\end{tabular}
\end{lrbox}

\centering
\makebox[0pt]{%
\begin{minipage}[t]{\wd\leftbox} % A minipage that contains the wider table
\centering
\caption{obs=1000, Coverage Probability}
\usebox{\leftbox}
\end{minipage}\quad
%%%% The narrower table is set in a box as wide as allowed
%%%% The complex of the tables will stick out at left and right
%%%% Play with the coefficient (here 1.1) until the caption
%%%% to the narrower table fits
\begin{minipage}[t]{1.1\columnwidth-1em-\wd\leftbox}
\centering
\caption{obs=1000, Test Statistic}
\usebox{\rightbox}
\end{minipage}%
}
\end{table}
\end{document}

Look at the comments in the code for modifying the appearance.

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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