# Setting three tables next to each other

I want to set three tables to stand in a row, with each of them has its own name above it.
Let me show you what I mean...

I wrote this code:

\begin{center}
$R_1$\\
\vspace{3 mm}
\begin{tabular}{ |c|c| }
\hline
\textbf{course} & \textbf{type} \\
\hline
Databases & Basic \\
\hline
\hline
\end{tabular}

$R_2$ \\
\vspace{3 mm}
\begin{tabular}{ |c|c| }
\hline
\textbf{course} & \textbf{deg} \\
\hline
Databases & 1 \\
\hline
Math & 1 \\
\hline
Math & 2 \\
\hline
\end{tabular}

$R_3$ \\
\vspace{3 mm}
\begin{tabular}{ |c|c| }
\hline
\textbf{course} & \textbf{course\_num} \\
\hline
Databases & 55281 \\
\hline
Math & 55570 \\
\hline
\end{tabular}
\end{center}


Which produces exactly what I want, except it shows every table above the other:

and the result I'm aiming for is tables that stands one next to each other:

Is there some kind of trick that will allow me to do that?

• Get rid of those empty lines, meaning a new paragraph for LaTeX. If you want the tables to be somehow separated, mask the blank lines with a comment char (%). – Johannes_B Nov 1 '14 at 21:35
• But that messes up the tables' head-titles (R_1, R_2, R_3)... – so.very.tired Nov 1 '14 at 21:37
• Ah, minipages. Set each tabular and the according description in a minipage of it's own. – Johannes_B Nov 1 '14 at 21:38

One possibility is to put your table into table like:

\begin{center}
$R_1$   &   $R_2$   &   $R_3$   \\
\begin{tabular}[t]{|c|c|}
\hline
\textbf{course}     & \textbf{type} \\  \hline
Databases   & Basic         \\  \hline
\end{tabular}
&   \begin{tabular}[t]{|c|c|}
\hline
\textbf{course} & \textbf{deg}  \\  \hline
Databases   & 1             \\  \hline
Math        & 1             \\  \hline
Math        & 2             \\  \hline
\end{tabular}
&   \begin{tabular}[t]{|c|c|}
\hline
\textbf{course} & \textbf{course\_num}  \\  \hline
Databases       & 55281                 \\  \hline
Math            & 55570                 \\  \hline
\end{tabular}
\end{tabular}
\end{center}


Not tested, but this should work as you expect.

I Took Johannes_B's advice, and here's the refined version:

\begin{minipage}[t]{0.32\textwidth} \centering
$R_1$\\
\vspace{3 mm}
\begin{tabular}{ |c|c| }
\hline
\textbf{course} & \textbf{type} \\
\hline
Databases & Basic \\
\hline
\hline
\end{tabular}
\end{minipage}
\begin{minipage}[t]{0.30\textwidth} \centering
$R_2$ \\
\vspace{3 mm}
\begin{tabular}{ |c|c| }
\hline
\textbf{course} & \textbf{deg} \\
\hline
Databases & 1 \\
\hline
Math & 1 \\
\hline
Math & 2 \\
\hline
\end{tabular}
\end{minipage}
\begin{minipage}[t]{0.30\textwidth} \centering
$R_3$ \\
\vspace{3 mm}
\begin{tabular}{ |c|c| }
\hline
\textbf{course} & \textbf{course\_num} \\
\hline
Databases & 55281 \\
\hline
Math & 55570 \\
\hline
\end{tabular}
\end{minipage}


This produced the following result:

Thanks, Johannes_B.