# Two tables side by side in two column document

I need two tables to be placed on top of the page and side by side in a two-column document. Each table should have its own caption, in its own column, and needs to be nicely centered to its column.

So I tried this:

\begin{figure*}
\centering
\begin{minipage}{0.3\textwidth}
\centering
\begin{tabular}[c]{|c|c|}
\hline
1 & 2 \\
\hline
3 & 4 \\
\hline
\end{tabular}
\captionof{table}{table 1}
\end{minipage}
\begin{minipage}{0.3\textwidth}
\centering
\begin{tabular}[c]{|c|c|}
\hline
1 & 2 \\
\hline
3 & 4 \\
\hline
\end{tabular}
\captionof{table}{table 2}
\end{minipage}
\end{figure*}


And what it does is actually putting two small minpages at the center of the whole document regardless of any column geometry.

Since I previously used subfigure and I know they nicely center in such scenarios I also tried:

\begin{figure*}
\begin{subfigure}{0.49\textwidth}
\centering
\begin{tabular}[c]{|c|c|}
\hline
1 & 2 \\
\hline
3 & 4 \\
\hline
\end{tabular}
\caption{table 1}
\end{subfigure}%
\hspace*{\fill}
\begin{subfigure}{0.49\textwidth}
\centering
\begin{tabular}[c]{|c|c|}
\hline
1 & 2 \\
\hline
3 & 4 \\
\hline
\end{tabular}
\caption{table 2}
\end{subfigure}
\end{figure*}


The ugly part is that I cannot have separate table captions that way (to the best of my knowledge, I cannot put table in figure). Nor can I use captionof{table} in the figure environment.

All in all, what do you suggest? How to have them nicely centered but still to have two separate table captions?

Why Mico's answer does not work? Seems like tables are not always centered.

\documentclass[twocolumn]{article}
\usepackage[T1]{fontenc}
\usepackage{graphicx}
\usepackage{lipsum}
\begin{document}
\begin{table*}
\begin{minipage}{\columnwidth}
\centering
\hrule
\resizebox{\columnwidth}{!}{%
\begin{tabular}{|c|c|}
\hline 1 & 2 \\ \hline 3 & 4 \\ \hline
\end{tabular}
}
\caption{table 1}
\end{minipage}\hfill % maximize the horizontal separation
\begin{minipage}{\columnwidth}
\centering
\hrule
\resizebox{\columnwidth}{!}{%
\begin{tabular}{|c|c|}
\hline 1 & 2 \\ \hline 3 & 4 \\ \hline
\end{tabular}
}
\caption{table 2}
\end{minipage}
\end{table*}

\lipsum[1-15] % filler text
\end{document}


Mico provided the solution to this problem; add % after each tabular. The idea is to suppress the space after tabular. That spacing does not work well with \resizebox. For more details see the comments to Mico's answer.

• You might try the floatrow environment, from the homonymous package. Sep 16 at 22:45
• Why are you using a figure* environment instead of a table* environment? And why are you using subfigure instead of subtable environments?
– Mico
Sep 16 at 22:55
• @foki - Please see the comment I left below my answer for a suggestion for how to deal with the newly-introduced facts that (a) the natural widths of the tabular environments may exceed \columnwidth and (b) you apply the \resizebox sledgehammer to force their widths back down to \columnwidth.
– Mico
Sep 17 at 6:19

I suggest you use a table* environment (not a figure* environment), 2 minipage environments (each of width \columnwidth) within the table* environment, and centered tabular environments and \caption directives within each minipage.

\documentclass[twocolumn]{article}
\usepackage[T1]{fontenc}
\usepackage{lipsum}
\begin{document}
\begin{table*}
\begin{minipage}{\columnwidth}
\centering
\begin{tabular}{|c|c|}
\hline 1 & 2 \\ \hline 3 & 4 \\ \hline
\end{tabular}
\caption{table 1}
\end{minipage}\hfill % maximize the horizontal separation
\begin{minipage}{\columnwidth}
\centering
\begin{tabular}{|c|c|}
\hline 1 & 2 \\ \hline 3 & 4 \\ \hline
\end{tabular}
\caption{table 2}
\end{minipage}
\end{table*}

\lipsum[1-15] % filler text
\end{document}

• Well, that does not render the same for me. If you put the tabular's into \resizebox{\columnwidth}{!}{...}, doesn't it look a little bit off from center. Doesn't it look a little bit more to the left?
– foki
Sep 16 at 23:58
• I mean, it does look centered when the tables are small, but when I maximize their size, it seems like they are not centered. Or maybe resizebox screws it up.
– foki
Sep 17 at 0:16
• There is an automatic \columnsep gap between columns. Try adding an \hrule inside the minipage to show the column width. Sep 17 at 0:38
• @JohnKormylo - The OP's decision (which, frankly, I failed to anticipate!) to want to encase the tabular environment in a box of width \columnwidth -- via a whack with the \resizebox sledgehammer -- causes a secondary problem, viz., LaTeX no longer removes the whitespace after \end{tabular} automatically, even if \centering is in effect. In such an extreme case, it's necessary to suppress the offending whitespace character manually, by changing \end{tabular} to \end{tabular}%. For what it's worth, I'm not too embarrassed by this particular failure of mine...
– Mico
Sep 17 at 7:05
• @Mico Thank you for the explanation. My intent was not to embarrass you and I am sorry if any of my comments were too harsh.
– foki
Sep 19 at 16:24