[Tex/LaTex] How to have two tables side by side

positioningtables

Suppose I have two tables that don't have many columns (3, for example). How can I position them side by side?

Best Answer

Just put two tabular environments side by side. Add spacing as desired.

\begin{tabular}{ccc}
\hline
a&b&c\\
\hline
\end{tabular}
\quad
\begin{tabular}{ccc}
\hline
d&e&f\\
\hline
\end{tabular}

If you want to use subfig because you want them to have separate captions, then that is simple as well.

\subfloat[caption]{\begin{tabular}{...}...\end{tabular}}
\subfloat[caption]{\begin{tabular}{...}...\end{tabular}}

If you want two tables that are independent, and thus don't want to use \subfloat, you can use \parbox.

\begin{table}
\parbox{.45\linewidth}{
\centering
\begin{tabular}{ccc}
\hline
a&b&c\\
\hline
\end{tabular}
\caption{Foo}
}
\hfill
\parbox{.45\linewidth}{
\centering
\begin{tabular}{ccc}
\hline
d&e&f\\
\hline
\end{tabular}
\caption{Bar}
}
\end{table}

This is basically the same as before just that I've centered each tabular in a \parbox with an included caption and wrapped the whole thing in a table.

Related Question