LaTeX Tables – Create a Table with Two Parts with Different Tabular Features

formattingtables

I'm trying to build a table that has two panels with different numbers of columns. For example:

Table 1: An interesting table

           Panel A: Some stuff
First name      Last name       Product
Bubba           Gump            Shrimp
Steve           Jobs            Happiness

            Panel B: Other stuff
School       State
Harvard      MA
Yale         CT
Brown        RI

I would like the 3 columns of Panel A and the 2 columns of Panel B to fill the horizontal space of the table.

I imagined using two different \tabular commands within a \table would work, but it doesn't. I also found the subfigure package, but I think that only lets you stack tables horizontally, not vertically.

Any ideas? Thanks!

Best Answer

Within a table environment, you can use different tabular environments, of different types and with a different number of columns. Here's an example with sub captions:

\documentclass{article}
\usepackage{caption}
\usepackage{subcaption}
\usepackage{tabularx}
\begin{document}
\begin{table}
\centering
\caption{An interesting table}
\subcaption*{Panel A: Some stuff}
\begin{tabular}{lcr}
First name & Last name  & Product \\
Bubba & Gump & Shrimp \\
Steve & Jobs & Happiness
\end{tabular}
\bigskip
\subcaption*{Panel B: Other stuff}
\begin{tabular}{ll}
School & State \\
Harvard & MA \\
Yale & CT \\
Brown & RI
\end{tabular}
\end{table}
\end{document}

sub tables example

Here I used the subcaption packages. A good alternative is the subfig package. However, the subfigure package is obsolete.

Related Question