How arrange two tables, one besides the other

The following code should work:

\documentclass{article}
\begin{document}
%----------------------------------------
% No space between the tables
\begin{tabular}{|c|c|}
\hline
test & test\\ \hline
\end{tabular}
\begin{tabular}{|c|c|}
\hline
test & test\\ \hline
\end{tabular}
\par
%----------------------------------------
% Added a space between the tables
\begin{tabular}{|c|c|}
\hline
test & test\\ \hline
\end{tabular}
\hspace{2cm}
\begin{tabular}{|c|c|}
\hline
test & test\\ \hline
\end{tabular}
%----------------------------------------
% Centered with a space between the tables
\begin{center}
\begin{tabular}{|c|c|}
\hline
test & test\\ \hline
\end{tabular}
\hspace{2cm}
\begin{tabular}{|c|c|}
\hline
test & test\\ \hline
\end{tabular}
\end{center}
\end{document}

enter image description here


Or else in a minipage

screenshot

\documentclass{article}

\begin{document}

\begin{table}[!htb]
    \begin{minipage}{.5\textwidth}
        \centering
        \caption{}
        \label{tab:first}
        \begin{tabular}{rcl}
            right & center & left \\
            right & center & left 
        \end{tabular}
    \end{minipage}%
    \begin{minipage}{.5\textwidth}
        \centering
        \caption{}
        \label{tab:second}
        \begin{tabular}{rcl}
            right & center & left \\
            right & center & left 
        \end{tabular}
    \end{minipage}
\end{table}

\end{document}

Note the % after the first \end{minipage} to prevent the extra space creating an overfull hbox.

Tags:

Tables