表のセル内の画像の配列を自動的に中央揃えする

表のセル内の画像の配列を自動的に中央揃えする

次のようなテーブルがあります:

\begin{tabular}{p{0.5\textwidth}|p{0.5\textwidth}}
caption1 & caption2 \\
\includegraphics[params]{path11} \includegraphics[params]{path12} ... \includegraphics[params]{path1N} & \includegraphics[params]{path21} \includegraphics[params]{path22} ... \includegraphics[params]{path2N} \\ 
\end{tabular}

画像を配列のようにしたいのですが、列の幅を考慮して、スペースがない場合は自動的に新しい画像の行を作成する必要があります。すべての画像は、互いに接触しないように、余白を付けて均等に配置する必要があります。

答え1

画像を\multicolumn{2}{c}{...}マクロに配置し、\hfillその間に余白を追加する必要があります。十分に短い長さにparams設定する必要があります。width=<some length>

以下に 3 つの画像の例を示します。

\documentclass{article}
\usepackage{graphicx}
\begin{document}

\begin{tabular}{p{0.49\textwidth}|p{0.49\textwidth}}
    caption1 & caption2 \\
    \multicolumn{2}{c}{%
    \includegraphics[width=.3\textwidth]{example-image-a} \hfill
    \includegraphics[width=.3\textwidth]{example-image-b} \hfill
    \includegraphics[width=.3\textwidth]{example-image-c}
    }
\end{tabular}

\end{document}

画像を垂直に揃える必要がある場合は、中央揃えの画像を含む表を作成するにはどうすればよいでしょうか?または表内の画像を左上に揃えるにはどうすればいいですか?

関連情報