\toprule 超過兩個小頁面?

\toprule 超過兩個小頁面?

我有兩張並排的桌子,每張一張小頁。我的問題是,如何使用\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}

在此輸入影像描述

相關內容