我有两个并排的表格,每个表格都在一个小页面中。我的问题是,如何使用\toprule
和\bottomrule
跨越整个table
环境的宽度(而不是仅跨越当前的tabular
)?我说的“整个宽度”并不是字面上的长度等于\textwidth
,而是要像那样巧妙地使用它\toprule
。
\documentclass{article}
\usepackage{booktabs}
\begin{document}
\begin{table}
% I want a \toprule (?) here (?) to (cleverly) span
% the entire table environment.
\begin{minipage}[t]{.5\textwidth}
\begin{tabular}{c}
\toprule % This spans only this (leftmost) table.
\\
% Table Content.
\\
\bottomrule
\end{tabular}
\end{minipage}
~
\begin{minipage}[t]{.5\textwidth}
\begin{tabular}{c}
\toprule % This spans only this (rightmost) table.
\\
% Table Content.
\\
\bottomrule
\end{tabular}
\end{minipage}
\end{table}
\end{document}
答案1
嵌套表格。
\documentclass{article}
\usepackage{booktabs,array}
\begin{document}
\begin{table}
\begin{tabular}{
@{}
p{\dimexpr.5\textwidth}
@{}
p{\dimexpr.5\textwidth}
@{}
}
\toprule
\begin{tabular}{c}
\toprule
Table Content. \\
\bottomrule
\end{tabular}
&
\begin{tabular}{c}
\toprule
Table Content. \\
\bottomrule
\end{tabular}
\\
\bottomrule
\end{tabular}
\end{table}
\end{document}