Hunger Learn
Hunger Learn

Reputation: 127

How can somene create two tables side by side in beamer?

How can somene create two tables side by side in beamer? I use the following to insert one table

\begin{table}
\begin{tabular}{l | c | c | c | c | c}
Model & intercept & X & Y & Adjusted $R^2$ & \\
\hline \hline
Coeff & 2.229 & -0.274 & 1.221 & 38\%\\ 
t-value & 3.404 & -0.49 & 3.907  \\
GMM-t & 2.542 & -0.444 & 3.814\\
\end{tabular}
\end{table}

which command should I use to have two tables side by side like the aforementioned table?

Upvotes: 0

Views: 8783

Answers (2)

xxks-kkk
xxks-kkk

Reputation: 2608

As suggested by this blog, you can try columns environment. For example, with code like

\begin{frame}{Example}
    \begin{columns}
        \begin{column}{0.3\textwidth}
            \begin{table}
            \begin{tabular}{c|c|c} 
            sid & bid & day \\ \hline \hline 
            22 & 101 & 10/10/96 \\ 
            58 & 103 & 11/12/96 \\ 
            \end{tabular}
            \caption{reserves}
            \end{table}
        \end{column}
        \begin{column}{0.3\textwidth}
            \begin{table}
            \begin{tabular}{c|c|c|c} 
            sid & sname & rating & age \\ \hline \hline 
            22 & dustin & 7 & 45.0 \\ 
            31 & lubber & 8 & 55.5 \\ 
            58 & rusty & 10 & 35.0 \\
            \end{tabular}
            \caption{Sailors}
            \end{table}
        \end{column}
    \end{columns}
 \end{frame}

You can get something like below (ignoring the background image)

demo

Upvotes: -1

If your tables are narrow enough to fit side by side, you can simply place them next to each other like you would do for any normal letter.

\documentclass{beamer}
\begin{document}
\begin{frame}
\begin{table}
\begin{tabular}{l | c | c | }
Model & intercept & X \\
\hline \hline
Coeff & 2.229 & -0.274  \\ 
t-value & 3.404 & -0.49\\
GMM-t & 2.542 & -0.444 \\
\end{tabular}
\hfill
\begin{tabular}{l | c | c | }
Model & intercept & X \\
\hline \hline
Coeff & 2.229 & -0.274  \\ 
t-value & 3.404 & -0.49\\
GMM-t & 2.542 & -0.444 \\
\end{tabular}
\end{table}
\end{frame}
\end{document}

enter image description here

Upvotes: 2

Related Questions