沒有table環境的情況下

沒有table環境的情況下

我有一堆桌子排列如下: 在此輸入影像描述

\documentclass{article}

\begin{document}
\begin{table}
\begin{minipage}[c][1\totalheight][t]{0.45\textwidth}%
\begin{center}
\begin{tabular}{|c|c|c|c|c|c|c|c|}
\hline 
a & b & c & d & e & f & g & h\\ 
\hline 
1 & 2 & 3 & 4 & 5 & 6 & 7 & 8\\
\hline 
a & b & c & d & e & f & g & h\\
\hline 
\end{tabular}
\par\end{center}
\caption{Table \#1}

\begin{center}
\begin{tabular}{|c|c|c|c|c|c|c|c|}
\hline 
a & b & c & d & e & f & g & h\\ 
\hline 
1 & 2 & 3 & 4 & 5 & 6 & 7 & 8\\
\hline 
a & b & c & d & e & f & g & h\\
\hline 
\end{tabular}%
\par\end{center}
\caption{Table \#2}
\end{minipage}\hfill{}%
\begin{minipage}[c][1\totalheight][t]{0.45\textwidth}%

\begin{center}
\begin{tabular}{|c|c|c|c|c|c|c|c|}
\hline 
a & b & c & d & e & f & g & h\\ 
\hline 
1 & 2 & 3 & 4 & 5 & 6 & 7 & 8\\
\hline 
a & b & c & d & e & f & g & h\\
\hline 
\end{tabular}
\par\end{center}
\caption{Table \#3}

\begin{center}
\begin{tabular}{|c|c|c|c|c|c|c|c|}
\hline 
a & b & c & d & e & f & g & h\\ 
\hline 
1 & 2 & 3 & 4 & 5 & 6 & 7 & 8\\
\hline 
a & b & c & d & e & f & g & h\\
\hline 
\end{tabular}%
\par\end{center}
\caption{Table \#4}
\end{minipage}
\end{table}

\end{document}

我正在嘗試讓大括號跨越多個表,如下所示:


在此輸入影像描述


或者:


在此輸入影像描述


或者:


在此輸入影像描述


這是一個例子我嘗試過使用頁邊距的東西。它適用於常規文本,但不適用於表格之類的物件:

\newcommand\BrText[2]{%
  \par\smallskip
   \noindent\makebox[\textwidth][r]{$\text{#1}\left\{
    \begin{minipage}{\textwidth}
    #2
    \end{minipage}
  \right.\nulldelimiterspace=0pt$}\par\smallskip
}    

我嘗試用​​其他幾種方法來解決這個問題,但當時我並沒有想到要堅持不工作的程式碼。無論如何,我記得在某處讀到這是可能的,但不確定在哪裡。任何如何做到這一點的想法將不勝感激。

答案1

在此輸入影像描述

\documentclass{article}

\begin{document}
\begin{table}
$\left\{
\begin{minipage}[c]{0.45\textwidth}%
\begin{center}
\begin{tabular}{|c|c|c|c|c|c|c|c|}
\hline 
a & b & c & d & e & f & g & h\\ 
\hline 
1 & 2 & 3 & 4 & 5 & 6 & 7 & 8\\
\hline 
a & b & c & d & e & f & g & h\\
\hline 
\end{tabular}
\end{center}
\caption{Table \#1}

\begin{center}
\begin{tabular}{|c|c|c|c|c|c|c|c|}
\hline 
a & b & c & d & e & f & g & h\\ 
\hline 
1 & 2 & 3 & 4 & 5 & 6 & 7 & 8\\
\hline 
a & b & c & d & e & f & g & h\\
\hline 
\end{tabular}%
\end{center}
\caption{Table \#2}
\end{minipage}
\begin{minipage}[c]{0.45\textwidth}%

\begin{center}
\begin{tabular}{|c|c|c|c|c|c|c|c|}
\hline 
a & b & c & d & e & f & g & h\\ 
\hline 
1 & 2 & 3 & 4 & 5 & 6 & 7 & 8\\
\hline 
a & b & c & d & e & f & g & h\\
\hline 
\end{tabular}
\end{center}
\caption{Table \#3}

\begin{center}
\begin{tabular}{|c|c|c|c|c|c|c|c|}
\hline 
a & b & c & d & e & f & g & h\\ 
\hline 
1 & 2 & 3 & 4 & 5 & 6 & 7 & 8\\
\hline 
a & b & c & d & e & f & g & h\\
\hline 
\end{tabular}%
\end{center}
\caption{Table \#4}
\end{minipage}
\right\}$
\end{table}

\end{document}

答案2

我提供了兩個環境mybraceleftmybraceright,以便方便地支撐水平材料。它們都產生所需尺寸的水平材料(您可以在段落中間使用它們)。

與大衛的解決方案相比,我的解決方案的一個顯著特性是,它產生緊密包裹環境的水平材料tabular,或者您決定在其位置使用的任何東西(您不必猜測長度0.45\textwidth)。如果減少這些元素的寬度,您會發現我的大括號\myhsep與大括號內容之間的距離保持在可自訂的距離,而大衛的解決方案則不是這種情況(大括號和內容之間的間隙會更大,因為大括號和內容之間的間隙會minipage更大)表格材料的左側和右側有更多空白)。

根據我設定的要求,工作中一個棘手的部分是找到適當的寬度,以將兩個tabular環境和兩個標題放在一起居中。為此,我使用該eqparbox包。這個套件依賴標籤的正確使用(對於每個標籤,它會找到最大寬度並允許您將其用作正常長度 - 這是非常方便的,很棒的套件!)。注意來源中的標籤,它們以三個(對於一個minipage緊緊包圍的 tabular環境及其相關的標題)。這個過程至少需要編譯兩次文檔。

沒有table環境的情況下

在這個解決方案中,table沒有使用環境,因此沒有任何東西漂浮。這主要是拳擊工作。包\captionof中的caption內容用於產生標準表格標題的習慣外觀。

\documentclass{article}
\usepackage[hscale=0.65]{geometry} % enlarge margins a little bit for the example
\usepackage{eqparbox}
\usepackage{caption}

\makeatletter

\newsavebox{\mybox}
\newlength{\myhsep} % Horizontal separation between brace and contents
\setlength{\myhsep}{0.7em}

\newenvironment{mybraceleft}{%
  \begin{lrbox}{\mybox}
  }{%
  \end{lrbox}%
  $\m@th \left\{ \kern\myhsep \vcenter{\hbox{\usebox{\mybox}}} \right.$%
  \kern-\nulldelimiterspace
  \ignorespacesafterend
}

\newenvironment{mybraceright}{%
  \begin{lrbox}{\mybox}
  }{%
  \end{lrbox}%
  \leavevmode
  \kern-\nulldelimiterspace
  $\m@th \left. \vcenter{\hbox{\usebox{\mybox}}} \kern\myhsep \right\}$%
  \ignorespacesafterend
}

\makeatother

\begin{document}

\noindent
\begin{mybraceleft}
  \begin{minipage}{\eqboxwidth{tag1}}
    \centering
    \begin{eqminipage}[c]{tag1}
    \begin{tabular}{@{}|c|c|c|c|c|c|c|c|@{}}
      \hline
      a & b & c & d & e & f & g & h\\
      \hline
      1 & 2 & 3 & 4 & 5 & 6 & 7 & 8\\
      \hline
      a & b & c & d & e & f & g & h\\
      \hline
    \end{tabular}
    \end{eqminipage}%
    \captionof{table}{Table \#1}
    \bigskip

    \begin{eqminipage}[c]{tag1}
    \begin{tabular}{@{}|c|c|c|c|c|c|c|c|@{}}
      \hline
      a & b & c & d & e & f & g & h\\
      \hline
      1 & 2 & 3 & 4 & 5 & 6 & 7 & 8\\
      \hline
      a & b & c & d & e & f & g & h\\
      \hline
    \end{tabular}
    \end{eqminipage}%
    \captionof{table}{Table \#2}
  \end{minipage}
\end{mybraceleft}% spaces would be ignored here anyway because of the
                 % \ignorespacesafterend we used
\hfill
\begin{mybraceleft}
  \begin{minipage}{\eqboxwidth{tag2}}
    \centering
    \begin{eqminipage}[c]{tag2}
    \begin{tabular}{@{}|c|c|c|c|c|c|c|c|@{}}
      \hline
      a & b & c & d & e & f & g & h\\
      \hline
      1 & 2 & 3 & 4 & 5 & 6 & 7 & 8\\
      \hline
      a & b & c & d & e & f & g & h\\
      \hline
    \end{tabular}
    \end{eqminipage}%
    \captionof{table}{Table \#3}
    \bigskip

    \begin{eqminipage}[c]{tag2}
    \begin{tabular}{@{}|c|c|c|c|c|c|c|c|@{}}
      \hline
      a & b & c & d & e & f & g & h\\
      \hline
      1 & 2 & 3 & 4 & 5 & 6 & 7 & 8\\
      \hline
      a & b & c & d & e & f & g & h\\
      \hline
    \end{tabular}
    \end{eqminipage}%
    \captionof{table}{Table \#4}
  \end{minipage}
\end{mybraceleft}

\vspace{2cm}
\noindent
\begin{mybraceleft}
  \begin{minipage}{\eqboxwidth{tag3}}
    \centering
    \begin{eqminipage}[c]{tag3}
    \begin{tabular}{@{}|c|c|c|c|c|c|c|c|@{}}
      \hline
      a & b & c & d & e & f & g & h\\
      \hline
      1 & 2 & 3 & 4 & 5 & 6 & 7 & 8\\
      \hline
      a & b & c & d & e & f & g & h\\
      \hline
    \end{tabular}
    \end{eqminipage}%
    \captionof{table}{Table \#5}
    \bigskip

    \begin{eqminipage}[c]{tag3}
    \begin{tabular}{@{}|c|c|c|c|c|c|c|c|@{}}
      \hline
      a & b & c & d & e & f & g & h\\
      \hline
      1 & 2 & 3 & 4 & 5 & 6 & 7 & 8\\
      \hline
      a & b & c & d & e & f & g & h\\
      \hline
    \end{tabular}
    \end{eqminipage}%
    \captionof{table}{Table \#6}
  \end{minipage}
\end{mybraceleft}% spaces would be ignored here anyway because of the
                 % \ignorespacesafterend we used
\hfill
\begin{mybraceright}
  \begin{minipage}{\eqboxwidth{tag4}}
    \centering
    \begin{eqminipage}[c]{tag4}
    \begin{tabular}{@{}|c|c|c|c|c|c|c|c|@{}}
      \hline
      a & b & c & d & e & f & g & h\\
      \hline
      1 & 2 & 3 & 4 & 5 & 6 & 7 & 8\\
      \hline
      a & b & c & d & e & f & g & h\\
      \hline
    \end{tabular}
    \end{eqminipage}%
    \captionof{table}{Table \#7}
    \bigskip

    \begin{eqminipage}[c]{tag4}
    \begin{tabular}{@{}|c|c|c|c|c|c|c|c|@{}}
      \hline
      a & b & c & d & e & f & g & h\\
      \hline
      1 & 2 & 3 & 4 & 5 & 6 & 7 & 8\\
      \hline
      a & b & c & d & e & f & g & h\\
      \hline
    \end{tabular}
    \end{eqminipage}%
    \captionof{table}{Table \#8}
  \end{minipage}
\end{mybraceright}

\end{document}

螢幕截圖

將支撐材料包裹在桌子內

這與前面的範例很接近,唯一的區別是我們允許兩個大塊(每個區塊包含四個tabular環境)浮動。因此,我們table可以使用環境\caption來取代\captionof.caption在這種情況下不需要包。這與 David 所做的類似,除了輸入語法(mybraceleftmybraceright此處)和大括號周圍的水平間距:我的大括號與支撐材料保持恆定的、可自訂的距離(\myhsep)。

正如已經提到的,這需要兩次編譯運行才能eqparbox完成其工作。

\documentclass{article}
\usepackage[hscale=0.65]{geometry} % enlarge margins a little bit for the example
\usepackage{eqparbox}

\makeatletter

\newsavebox{\mybox}
\newlength{\myhsep} % Horizontal separation between brace and contents
\setlength{\myhsep}{0.7em}

\newenvironment{mybraceleft}{%
  \begin{lrbox}{\mybox}
  }{%
  \end{lrbox}%
  $\m@th \left\{ \kern\myhsep \vcenter{\hbox{\usebox{\mybox}}} \right.$%
  \kern-\nulldelimiterspace
  \ignorespacesafterend
}

\newenvironment{mybraceright}{%
  \begin{lrbox}{\mybox}
  }{%
  \end{lrbox}%
  \leavevmode
  \kern-\nulldelimiterspace
  $\m@th \left. \vcenter{\hbox{\usebox{\mybox}}} \kern\myhsep \right\}$%
  \ignorespacesafterend
}

\makeatother

\begin{document}

\begin{table}
\centering
\begin{mybraceleft}
  \begin{minipage}{\eqboxwidth{tag1}}
    \centering
    \begin{eqminipage}[c]{tag1}
    \begin{tabular}{@{}|c|c|c|c|c|c|c|c|@{}}
      \hline
      a & b & c & d & e & f & g & h\\
      \hline
      1 & 2 & 3 & 4 & 5 & 6 & 7 & 8\\
      \hline
      a & b & c & d & e & f & g & h\\
      \hline
    \end{tabular}
    \end{eqminipage}%
    \caption{Table \#1}
    \bigskip

    \begin{eqminipage}[c]{tag1}
    \begin{tabular}{@{}|c|c|c|c|c|c|c|c|@{}}
      \hline
      a & b & c & d & e & f & g & h\\
      \hline
      1 & 2 & 3 & 4 & 5 & 6 & 7 & 8\\
      \hline
      a & b & c & d & e & f & g & h\\
      \hline
    \end{tabular}
    \end{eqminipage}%
    \caption{Table \#2}
  \end{minipage}
\end{mybraceleft}% spaces would be ignored here anyway because of the
                 % \ignorespacesafterend we used
\hfill
\begin{mybraceleft}
  \begin{minipage}{\eqboxwidth{tag2}}
    \centering
    \begin{eqminipage}[c]{tag2}
    \begin{tabular}{@{}|c|c|c|c|c|c|c|c|@{}}
      \hline
      a & b & c & d & e & f & g & h\\
      \hline
      1 & 2 & 3 & 4 & 5 & 6 & 7 & 8\\
      \hline
      a & b & c & d & e & f & g & h\\
      \hline
    \end{tabular}
    \end{eqminipage}%
    \caption{Table \#3}
    \bigskip

    \begin{eqminipage}[c]{tag2}
    \begin{tabular}{@{}|c|c|c|c|c|c|c|c|@{}}
      \hline
      a & b & c & d & e & f & g & h\\
      \hline
      1 & 2 & 3 & 4 & 5 & 6 & 7 & 8\\
      \hline
      a & b & c & d & e & f & g & h\\
      \hline
    \end{tabular}
    \end{eqminipage}%
    \caption{Table \#4}
  \end{minipage}
\end{mybraceleft}
\end{table}

\begin{table}
\centering
\begin{mybraceleft}
  \begin{minipage}{\eqboxwidth{tag3}}
    \centering
    \begin{eqminipage}[c]{tag3}
    \begin{tabular}{@{}|c|c|c|c|c|c|c|c|@{}}
      \hline
      a & b & c & d & e & f & g & h\\
      \hline
      1 & 2 & 3 & 4 & 5 & 6 & 7 & 8\\
      \hline
      a & b & c & d & e & f & g & h\\
      \hline
    \end{tabular}
    \end{eqminipage}%
    \caption{Table \#5}
    \bigskip

    \begin{eqminipage}[c]{tag3}
    \begin{tabular}{@{}|c|c|c|c|c|c|c|c|@{}}
      \hline
      a & b & c & d & e & f & g & h\\
      \hline
      1 & 2 & 3 & 4 & 5 & 6 & 7 & 8\\
      \hline
      a & b & c & d & e & f & g & h\\
      \hline
    \end{tabular}
    \end{eqminipage}%
    \caption{Table \#6}
  \end{minipage}
\end{mybraceleft}% spaces would be ignored here anyway because of the
                 % \ignorespacesafterend we used
\hfill
\begin{mybraceright}
  \begin{minipage}{\eqboxwidth{tag4}}
    \centering
    \begin{eqminipage}[c]{tag4}
    \begin{tabular}{@{}|c|c|c|c|c|c|c|c|@{}}
      \hline
      a & b & c & d & e & f & g & h\\
      \hline
      1 & 2 & 3 & 4 & 5 & 6 & 7 & 8\\
      \hline
      a & b & c & d & e & f & g & h\\
      \hline
    \end{tabular}
    \end{eqminipage}%
    \caption{Table \#7}
    \bigskip

    \begin{eqminipage}[c]{tag4}
    \begin{tabular}{@{}|c|c|c|c|c|c|c|c|@{}}
      \hline
      a & b & c & d & e & f & g & h\\
      \hline
      1 & 2 & 3 & 4 & 5 & 6 & 7 & 8\\
      \hline
      a & b & c & d & e & f & g & h\\
      \hline
    \end{tabular}
    \end{eqminipage}%
    \caption{Table \#8}
  \end{minipage}
\end{mybraceright}
\end{table}

\end{document}

螢幕截圖

相關內容