如何將兩個子表堆疊到第三個子表旁邊?

如何將兩個子表堆疊到第三個子表旁邊?

與這個問題中描述的相同如何將兩個子圖堆疊到第三個子圖旁邊?,這次是相反的並且有桌子。而不是這個

| SUBTBL1 | SUBTBL3 |    
| SUBTBL2 | SUBTBL3 |

我懂了:

| SUBTBL1 |  BLANK  |    
| SUBTBL2 | SUBTBL3 |

我嘗試使用 minipage t 的位置而不是與 c 相同的 b,但它不起作用

\documentclass{report}
\usepackage{colortbl}
\usepackage{float}
\usepackage{graphicx}

\begin{document}
\begin{minipage}[b]{0.5\linewidth}
\begin{table}[H]
\begin{tabular}{|c|c|c|c|}
\hline
text & text & text & text \\ \hline
\hline
text & text & text & text \\ \hline
\end{tabular}
\caption{SUBTBL1}
\end{table}
\vspace{0.5cm}

\begin{table}[H]
\begin{tabular}{|c|c|}
\hline
text & text\\ \hline
text & text\\ \hline
text & text\\ \hline
text & text\\ \hline
\end{tabular}
\caption{SUBTBL2}
\end{table}
\end{minipage}\quad
\begin{minipage}[b]{0.5\linewidth}
\begin{table}[H]
\begin{tabular}{|c|c|}
\hline
text & text\\ \hline
text & text\\ \hline
text & text\\ \hline
text & text\\ \hline
\end{tabular}
\caption{SUBTBL3}
\end{table}
\end{minipage}
\end{document}

答案1

不要在stable內包含環境,而是使用一個環境並在其中使用兩個 s 。您可以在同一(或)環境中擁有多個字幕。minipagetableminipagetablefigure

請注意,如果兩個迷你頁0.5\linewidth彼此相鄰並且\quad之間有一個空格,您將得到一個過滿的框,並且第二個迷你頁會稍微伸入右邊距。根據情況,完全刪除小頁面之間的空間,

\end{minipage}% <-- percentcharacter removes space from line feed
\begin{minipage}{0.5\linewidth}

或稍微減小寬度,並使用\hfill代替\quad(如下例所示)。

在此輸入影像描述

\documentclass{report}
\begin{document}
\begin{table}
\begin{minipage}{0.48\linewidth}
\centering
\begin{tabular}{|c|c|c|c|}
\hline
text & text & text & text \\ \hline
\hline
text & text & text & text \\ \hline
\end{tabular}
\caption{SUBTBL1}
\vspace{0.5cm}

\begin{tabular}{|c|c|}
\hline
text & text\\ \hline
text & text\\ \hline
text & text\\ \hline
text & text\\ \hline
\end{tabular}
\caption{SUBTBL2}
\end{minipage}\hfill
\begin{minipage}{0.48\linewidth}
\centering
\begin{tabular}{|c|c|}
\hline
text & text\\ \hline
text & text\\ \hline
text & text\\ \hline
text & text\\ \hline
\end{tabular}
\caption{SUBTBL3}
\end{minipage}
\end{table}
\end{document}

如果您希望右表格底部與左下表格對齊,假設標題具有相同的高度,則將[b]位置參數新增至兩個minipage環境中,這樣您就可以了

\begin{minipage}[b]{0.48\linewidth}

對於他們倆來說。 (如果標題具有不同的高度,並且您希望標題的第一行彼此垂直對齊,則必須採取其他操作,我不知道實現這一目標的最佳方法,但可能可以做到與floatrow包裹一起,並且網站上的某個地方很可能有關於此的問題。

答案2

我想建議您加載該subcaption套件並使用並行subtable環境。左邊的一個包含子表(a)和(b),右邊的一個包含子表(c)。

在此輸入影像描述

\documentclass{report}
\usepackage{float}
\usepackage{subcaption}

\begin{document}
\hrule % just to illustrate width of textblock
\begin{table}[H]
\begin{subtable}{0.5\linewidth}
\centering
\begin{tabular}{|c|c|c|c|}
\hline
text & text & text & text \\ \hline
text & text & text & text \\ \hline
\end{tabular}
\caption{SUBTBL1}

\vspace{0.5cm}

\begin{tabular}{|c|c|}
\hline
text & text\\ \hline
text & text\\ \hline
text & text\\ \hline
text & text\\ \hline
\end{tabular}
\caption{SUBTBL2}
\end{subtable}%
\begin{subtable}{0.5\linewidth}
\centering
\begin{tabular}{|c|c|}
\hline
text & text\\ \hline
text & text\\ \hline
text & text\\ \hline
\end{tabular}
\caption{SUBTBL3}
\end{subtable}
\caption{Overall table caption}
\end{table}
\end{document}

相關內容