two tables side by side

LaTeX side-by-side tables

StartLaTeX faqLaTeX topicsLaTeX course
< spacing in math mode     > line break within table cell

side by side tables

If two (or more) tables are to be placed side by side in LaTeX, there are several ways to do this. The main difference is whether the tables (tabular environment) should be placed inside or outside a table environment.

In case the tables are to be set in a table environment, the following options are available: First, you use the caption package. Or second, one uses the supcaption package

caption

An example of two tables set side by side with minipage and captionof (usepackage caption).

\documentclass{article}
%...
\usepackage{caption}
%...
\begin{document}
%...
\listoftables
%...
\begin{minipage}[c]{0.5\textwidth}
\centering
\begin{tabular}{|c|c|c|}
\hline
A & B & C \\
\hline
1 & 2 & 3  \\
\hline
4 & 5 & 6 \\
\hline
\end{tabular}
\captionof{table}{table no. 1}
\end{minipage}
\begin{minipage}[c]{0.5\textwidth}
\centering
\begin{tabular}{c|c|c}
A & B & C \\
\hline
1 & 2 & 3  \\
\hline
4 & 5 & 6 \\
\end{tabular}
\captionof{table}{table no. 2}
\end{minipage}
%...
\end{document}


supcaption

An example of two tables set side by side with subtable (usepackage supcaption) , which have a common caption in addition to their own caption.

\documentclass{article}
%...
\usepackage{subcaption}
%...
\begin{document}
%...
\begin{table}
\begin{subtable}[c]{0.5\textwidth}
\centering
\begin{tabular}{|c|c|c|}
\hline
A & B & C \\
\hline
1 & 2 & 3  \\
\hline
4 & 5 & 6 \\
\hline
\end{tabular}
\subcaption{subtable no. 1}
\end{subtable}
\begin{subtable}[c]{0.5\textwidth}
\centering
\begin{tabular}{c|c|c}
A & B & C \\
\hline
1 & 2 & 3  \\
\hline
4 & 5 & 6 \\
\end{tabular}
\subcaption{subtable no. 2}
\end{subtable}
\caption{two tables side by side}
\end{table}
%...
\end{document}


In case the tables are to be set without table environment, there are two ways to put two tables side-by-side. First just put the two tables in a first one, second minipage.

By using the first option \hline have to replaced by \cline.

example three tables

\documentclass{article}
\begin{document}

\begin{tabular}{ll}
\begin{tabular}{ccc}
A & B & C \\
\cline{1-3}
1 & 2 & 3 \\
\cline{1-3}
C & B & A \\
\end{tabular}
&
\begin{tabular}{ccc}
D & E & F \\
\cline{1-3}
4 & 5 & 6 \\
\cline{1-3}
F & E & D \\
\end{tabular}
\end{tabular}
\end{document}

Output

example minipage

\documentclass{article}
\begin{document}
\begin{minipage}{1.5in}
\begin{tabular}{ccc}
A & B & C \\
\hline
1 & 2 & 3 \\
\hline
C & B & A \\
\end{tabular}
\end{minipage}
\begin{minipage}{1.5in}
\begin{tabular}{ccc}
D & E & F \\
\hline
4 & 5 & 6 \\
\hline
F & E & D \\
\end{tabular}
\end{minipage}
\end{document}

Output