# Set \bottomrule of two uneven tables to same height

I have two parallel tables not equal in height. I'd like to set \bottomrule of the shorter left table to the same height as the right one. Is this even possible without rearranging the rows? Using \vspace{} is one approach I tried, but it's too tricky. So I asked myself if there is a better solution?

\documentclass{article}

\usepackage{ragged2e, tabularx, makecell, booktabs}

\newcommand\mc[1]{%
\multicolumn{1}{c}{#1}}

\renewcommand\tabularxcolumn[1]{%
>{\RaggedRight}m{#1}}

\begin{document}

\begin{table}[!htb]\centering\small\setlength{\extrarowheight}{2pt}
\caption{Two uneven parallel tables.\label{tab:test}}
\begin{tabularx}{.45\columnwidth}[t]{XX}
\toprule
\mc{Column1} & \mc{Column2} \\
\midrule
Row 1 & Row 1 \\
Row 2 & Row 2 \\
Row 3 & Row 3 \\
Row 4 & Row 4 \\% \vspace{3.05pt} \\
\bottomrule
\end{tabularx}
\begin{tabularx}{.45\columnwidth}[t]{XX}
\toprule
\mc{Column1} & \mc{Column2} \\
\midrule
Row 1 & \makecell[l]{Row 1 with \\ line break} \\
Row 2 & Row 2 \\
\makecell[l]{Row 2 with \\ line break} & Row 2 \\
\bottomrule
\end{tabularx}
\end{table}

\end{document}

• (1) welcome (2) wjy make it as two tables, and not just one, and then use a black column between the two parts and use \cmidrule for the lines? – daleif Aug 10 at 12:07
• This is just a snippet. It's a bigger table with text above and underneath. I divided it so it doesn't take too much vertical space. – pCC Aug 10 at 12:12

You can \hbox the two tables up and then display them in two tables which add the contents of the other table as a \vphantom and below that a \bottomrule. Note that you should not use \bottomrule in both tables, it's added automatically.

\documentclass{article}

\usepackage{ragged2e, tabularx, makecell, booktabs}

\newcommand\mc[1]{%
\multicolumn{1}{c}{#1}}

\renewcommand\tabularxcolumn[1]{%
>{\RaggedRight}m{#1}}

\newsavebox\resizeboxA
\newsavebox\resizeboxB
\newcommand\BottomRuleAligned
{%
\begingroup
\setbox\resizeboxA\hbox\bgroup
\ignorespaces
}
\newcommand\EndFirstTable
{%
\ifhmode\unskip\fi
\egroup
\setbox\resizeboxB\hbox\bgroup
\ignorespaces
}
\newcommand\EndSecondTable
{%
\ifhmode\unskip\fi
\egroup
\begin{tabular}[t]{@{}l@{}}
\vphantom{\usebox\resizeboxB}\usebox\resizeboxA\\
\bottomrule
\end{tabular}%
\BottomRuleAlignedTableSep
\begin{tabular}[t]{@{}l@{}}
\vphantom{\usebox\resizeboxA}\usebox\resizeboxB\\
\bottomrule
\end{tabular}%
\endgroup
}
\newcommand\BottomRuleAlignedTableSep{\hskip1em}

\begin{document}

\begin{table}[!htb]\centering\small\setlength{\extrarowheight}{2pt}
\caption{Two uneven parallel tables.\label{tab:test}}
\BottomRuleAligned
\begin{tabularx}{.45\columnwidth}[t]{XX}
\toprule
\mc{Column1} & \mc{Column2} \\
\midrule
Row 1 & Row 1 \\
Row 2 & Row 2 \\
Row 3 & Row 3 \\
Row 4 & Row 4 \\% \vspace{3.05pt} \\
\end{tabularx}
\EndFirstTable
\begin{tabularx}{.45\columnwidth}[t]{XX}
\toprule
\mc{Column1} & \mc{Column2} \\
\midrule
Row 1 & \makecell[l]{Row 1 with \\ line break} \\
Row 2 & Row 2 \\
\makecell[l]{Row 2 with \\ line break} & Row 2 \\
\end{tabularx}
\EndSecondTable
\end{table}

\end{document}


EDIT: Same vertical above the table as a single \begin{tabularx} has and horizontal spacing reduced to just a space. Now you shouldn't use \toprule and \bottomrule as both are added automatically (this fixes your spacing difference):

\documentclass{article}

\usepackage{ragged2e, tabularx, makecell, booktabs}

\newcommand\mc[1]{%
\multicolumn{1}{c}{#1}}

\renewcommand\tabularxcolumn[1]{%
>{\RaggedRight}m{#1}}

\newsavebox\resizeboxA
\newsavebox\resizeboxB
\newcommand\BottomRuleAligned
{%
\begingroup
\setbox\resizeboxA\hbox\bgroup
\ignorespaces
}
\newcommand\EndFirstTable
{%
\ifhmode\unskip\fi
\egroup
\setbox\resizeboxB\hbox\bgroup
\ignorespaces
}
\newcommand\EndSecondTable
{%
\ifhmode\unskip\fi
\egroup
\begin{tabular}[t]{@{}l@{}}
\toprule
\vphantom{\usebox\resizeboxB}\usebox\resizeboxA\\
\bottomrule
\end{tabular}%
\BottomRuleAlignedTableSep
\begin{tabular}[t]{@{}l@{}}
\toprule
\vphantom{\usebox\resizeboxA}\usebox\resizeboxB\\
\bottomrule
\end{tabular}%
\endgroup
}
\newcommand\BottomRuleAlignedTableSep{\space}

\begin{document}

\begin{table}[!htb]\centering\small\setlength{\extrarowheight}{2pt}
\caption{Two uneven parallel tables.\label{tab:test}}
\BottomRuleAligned
\begin{tabularx}{.45\columnwidth}[t]{XX}
\mc{Column1} & \mc{Column2} \\
\midrule
Row 1 & Row 1 \\
Row 2 & Row 2 \\
Row 3 & Row 3 \\
Row 4 & Row 4 \\% \vspace{3.05pt} \\
\end{tabularx}
\EndFirstTable
\begin{tabularx}{.45\columnwidth}[t]{XX}
\mc{Column1} & \mc{Column2} \\
\midrule
Row 1 & \makecell[l]{Row 1 with \\ line break} \\
Row 2 & Row 2 \\
\makecell[l]{Row 2 with \\ line break} & Row 2 \\
\end{tabularx}
\EndSecondTable
\end{table}

\end{document}


• This solution worked for me, thanks! But there is a bit more space between the caption and the table now, at least in my document. Can't tell exactly why. – pCC Aug 10 at 13:35
• @pCC I fixed the spacing. – Skillmon Aug 10 at 13:58
• @pCC appreciation is usually expressed in votes (and accepting the most helpful answer -- which you fortunately already did). – Skillmon Aug 10 at 14:24

Since you load makecell, we can have different values of \arraystretch for the column heads and the rest of the tables, so here is a solution playing with \arraystretch:

\documentclass{article}

\usepackage{ragged2e, tabularx, makecell, booktabs}
\usepackage{setspace}

\renewcommand\tabularxcolumn[1]{>{\RaggedRight}m{#1}}

\begin{document}

\begin{table}[!htb]\centering\small\setlength{\extrarowheight}{2pt}
\caption{Two uneven parallel tables.\label{tab:test}}
\begingroup\renewcommand{\arraystretch}{1.097}
\begin{tabularx}{.45\columnwidth}[t]{XX}
\toprule
\midrule
Row 1 & Row 1 \\
Row 2 & Row 2 \\
Row 3 & Row 3 \\
Row 4 & Row 4 \\% \vspace{3.05pt} \\
\bottomrule
\end{tabularx} \endgroup
\begin{tabularx}{.45\columnwidth}[t]{XX}
\toprule