我正在使用“begin minipage”将两个表格并排放置,但结果并不完美。从下面的输出中可以看出,我需要更改两件事:
- 表格的轮廓:是否可以更好地可视化该表格?
- 标题:可以获得表格外面的标题吗?
输出:
代码:
\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}
答案1
不清楚你的问题是什么。 而且也没有定义tabhead
,所以我猜你正在寻找类似这样的内容:
产生上述图像的 MWE 是:
\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}
或者可能是这样:
对于tblr
上面的 MWE 中的表格规格(选项),您只需将其替换vline{1,Z}
为vlines
。