5

I am wanting to vertically stack two tables, as described here by Stefan. I am wanting to include a \toprule and \bottomrule to enclose the entirety of the table (both tabulars).

The problem I get is that the \toprule is the width of the columns of tabular one, and \bottomrule is the width of the second tabular.

Modifying the code used from the above link (to use the packages only relevant to me), this is how I am trying to do it.

\documentclass{article}
\usepackage{caption}
\usepackage{booktabs}
\begin{document}
\begin{table}
\centering
\caption{An interesting table}
\begin{tabular}{lcr}
\toprule
First name & Last name  & Product \\
Bubba & Gump & Shrimp \\
Steve & Jobs & Happiness
\end{tabular}
\bigskip
\begin{tabular}{ll}
School & State \\
Harvard & MA \\
Yale & CT \\
Brown & RI \\
\bottomrule
\end{tabular}
\end{table}
\end{document}

enter image description here

5

For example it's possible to use an outer tabular that spreads out the width of the other tables using @{}c@{} as column specifier applying \toprule and \bottomrule for the outer table, then putting the other two tabular environments inside.

\documentclass{article}
\usepackage{caption}
\usepackage{booktabs}
\begin{document}
\begin{table}
\centering
\caption{An interesting table}
\begin{tabular}{@{}c@{}}
\toprule
\begin{tabular}{lcr}
First name & Last name  & Product \\
Bubba & Gump & Shrimp \\
Steve & Jobs & Happiness
\end{tabular} \\ 
\midrule[0pt] % Empty midrule which adds vertical spacing anyway above and below but is not drawn itself
\begin{tabular}{ll}
School & State \\
Harvard & MA \\
Yale & CT \\
Brown & RI
\end{tabular} \tabularnewline
\bottomrule
\end{tabular}
\end{table}
\end{document}

enter image description here

  • Thanks work beautifully, one question is there any reason for using \\ before the \midrule[0pt] and \tabularnewline before the \bottomrule. As far as I can tell they are doing identical things so why the difference? – George Feb 17 '16 at 21:17
  • \tabularnewline is more outstanding (easier to recognize) -- I always use \tabularnewline in my own code, but do not change in foreign code ;-) – user31729 Feb 17 '16 at 21:19

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.