# Automatically center array of images inside table cell

I have this kind of table:

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


I want images to be like array, but they should consider column width and make new row of images automatically if there is no room. all images should be placed equally with margins so they don't touch each other.

-
Welcome to TeX.sx! Part of your question seems to be missing. Could you complete it? Also, please provide a complete minimal example document, instead of just a snippet, and tell us what you've tried so far. –  Jake Aug 21 '12 at 14:24

You need to place the images into a \multicolumn{2}{c}{...} macro and then you can add \hfill between them to get some margin between them. You need to set params to width=<some length> with a length small enough.

Here an example with three images:

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


If you need to vertical align the images see How to make a table with centered images? or How to align picture top left in a table?.

-