Beamer: align two tables side by side with caption

beamercaptionsminipagetables

I am using the "begin minipage" to put two tables side by side, but the result is not perfect. As you can see from the output below, there are two things that I need to change:

  1. The outline of the table: is it possible to get a better visualization of the table?
  2. The caption: it is possible to get the caption outside the table?

Output:

enter image description here

Code:

\documentclass{beamer}

\mode<presentation> {
\usetheme{Madrid}
}
\usepackage{amsfonts}
\usepackage{booktabs}
\usepackage{siunitx}

\usepackage{subcaption}% <-- added
\usepackage[showframe]{geometry}
\usepackage{enumitem}   
\setlist[itemize]{nosep,
             leftmargin=*,
             label=\textbullet,
             after =\vspace{-\baselineskip},
             before=\vspace{-\baselineskip} 
             }
\begin{document}
\begin{frame}{Appendix B}\framesubtitle{Tables}

\fboxsep=0pt
\noindent\fbox{%
\begin{minipage}[c]{0.40\linewidth}
        \begin{tabular}{c   c   c}
        \toprule
        \tabhead{Name1} &  \tabhead{Values} \\
        \midrule
         first       &  1 \\
         second      &  2 \\
         third       &  3 \\
         n-th         &  n \\
        \bottomrule
        \end{tabular}
        \captionof{table}{text}
\end{minipage}}%
\hfill%
\fbox{%
\begin{minipage}[c]{0.40\linewidth}
        \begin{tabular}{c   c   c}
        \toprule
        \tabhead{Name1} &  \tabhead{Values} \\
        \midrule
         first       &  1 \\
         second      &  2 \\
         third       &  3 \\
         n-th         &  n \\
        \bottomrule
        \end{tabular}
        \captionof{table}{text}
\end{minipage}
}

\end{frame}

\end{document}

Best Answer

It is not clear what is your problem. Also is not defined tabhead, so I guess that you looking for something like this:

enter image description here

MWE, which produce above image is:

\documentclass{beamer}

\mode<presentation> {
\usetheme{Madrid}
}
\usepackage{capt-of}
\usepackage{tabularray}
\UseTblrLibrary{booktabs}

\begin{document}
\begin{frame}{Appendix B}\framesubtitle{Tables}
    \begin{center}
\begin{minipage}{0.30\linewidth}\centering
    \begin{tblr}{vline{1,Z},
                 cells={c},
                 row{1}={font=\bfseries}
                 }
    \toprule
Name1   &   Values  \\
    \midrule
first   &  1        \\
second  &  2        \\
third   &  3        \\
n-th    &  n        \\
    \bottomrule
    \end{tblr}
\captionof{table}{text}
\end{minipage}
    \hfil
\begin{minipage}{0.30\linewidth}\centering
    \begin{tblr}{vline{1,Z}, 
                 cells={c},
                 row{1}={font=\bfseries}
                 }
    \toprule
Name1   &   Values  \\
    \midrule
first   &  1        \\
second  &  2        \\
third   &  3        \\
n-th    &  n        \\
    \bottomrule
    \end{tblr}
\captionof{table}{text}
\end{minipage}
    \end{center}
\end{frame}

\end{document}

or maybe this:

enter image description here

for which in table specifications (tblr options) in above MWE you only need to replace vline{1,Z} by vlines.

Related Question