As part of a larger display, I am placing two tabular environments together, one above the other. These two environments are going to appear in one column of a larger tabular, and I want the two environments to have the same width. I would prefer not to use tabular*
, because I don't want to have to guess the width and keep adjusting it as the contents change.
I tried setting them in a single tabular
, but then both columns got too wide, making the total both too wide and unpleasant to read. In other words, it won't do have both tables share a first column, because that column will be too wide for the first table to be readable. And they can't share a second column, because the second table won't really have room for a second column of that width.
However, if they have the same total width, everything should look good. But I don't know how to find that total width other then playing guessing games with tabular*
and explicit widths.
Is there a way to change the following MWE so that the second table is set to the width of the first table? (With suitable \extracolsep
).
\documentclass{article}
\usepackage{booktabs}
\begin{document}
\thispagestyle{empty}
\begin{center}
\begin{tabular}[t]{@{}l@{}}
\begin{tabular}{@{}ll@{}}
\multicolumn2{c}{(a) Names}\\[\medskipamount]
\toprule
$x, f$&Name of a variable (or function)\\
$X$& Name of a module\\
$K$& Name of a value constructor\\
$t$& Name of a type\\
$T$& Name of a module type\\
\bottomrule
\end{tabular}
\\
\begin{tabular}{@{}ll@{}}
\strut\\
\multicolumn2{c}{(b) Declarations in the theory}\\[\medskipamount]
\toprule
\mbox{(abstype $t$)}&$t :: *$ or $t :: * \mathrel @ \pi$\\
\mbox{(type $t$ $\tau$)}&$t = \tau$\\
\mbox{(val $x$ $\tau$)}&$x : \tau$\\
\bottomrule
\end{tabular}
\end{tabular}
\end{center}
\end{document}