2 つのサブテーブルを 3 番目のサブテーブルの隣に積み重ねるにはどうすればよいでしょうか?

2 つのサブテーブルを 3 番目のサブテーブルの隣に積み重ねるにはどうすればよいでしょうか?

この質問で説明されているものと同じ2 つのサブフィギュアを 3 番目のサブフィギュアの隣に積み重ねるにはどうすればよいでしょうか?今回は逆で、表を使っています。

| SUBTBL1 | SUBTBL3 |    
| SUBTBL2 | SUBTBL3 |

私はこれを得た:

| SUBTBL1 |  BLANK  |    
| SUBTBL2 | SUBTBL3 |

ミニページの位置をbではなくtにしてcと同じにしてみましたが、うまくいきませんでした

\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

tableの中に環境を置く代わりにminipage、 1 つのtable環境とminipageその中に 2 つの を使用します。同じtable(またはfigure) 環境内に複数のキャプションを置くことができます。

2つのミニページを0.5\linewidth隣り合わせにして\quad間にスペースを入れると、ボックスがいっぱいになり、2番目のミニページが右端に少しはみ出してしまうことに注意してください。状況に応じて、ミニページ間のスペースを完全に削除します。

\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}

関連情報