Table of images with captions

Or you could use the subfig package:

\documentclass{article}

\usepackage{subfig}
\usepackage{graphicx}

\begin{document}

\begin{figure}
    \centering
    \subfloat[Caption 1]{
        \label{ref_label1}
        \includegraphics[width=0.5\textwidth]{example-image-a}
    }
    \subfloat[Caption 2]{
        \label{ref_label2}
        \includegraphics[width=0.5\textwidth]{example-image-b}
    }
    \caption{Overall caption}
    \label{ref_label_overall}
\end{figure}

\end{document}

You can use the subcaption package for this but I think you don't need table for such use. You can embed everything into a general figure environment and place them as you wish. See the manual for that. Here is the version with Table.

\documentclass{article}
\usepackage{mwe} % For dummy images
\usepackage{subcaption}
\begin{document}
{\centering
\begin{table}[ht]
\begin{tabular}{cc}
\begin{subfigure}{0.4\textwidth}\centering\includegraphics[width=0.3\columnwidth]{example-image-a}\caption{Figure A}\label{fig:taba}\end{subfigure}&
\begin{subfigure}{0.4\textwidth}\centering\includegraphics[width=0.3\columnwidth]{example-image-b}\caption{Figure B}\label{fig:tabb}\end{subfigure}\\
\newline
\begin{subfigure}{0.4\textwidth}\centering\includegraphics[width=0.3\columnwidth]{example-image-c}\caption{Figure C}\label{fig:tabc}\end{subfigure}&
\begin{subfigure}{0.4\textwidth}\centering\includegraphics[width=0.3\columnwidth]{example-image-a}\caption{Figure A again}\label{fig:taba2}\end{subfigure}\\
\end{tabular}
\caption{A table with figures}
\label{tab:mytable}
\end{table}
}

We can see that Figure \ref{fig:taba} and Figure \ref{fig:taba2} is the same. Also the table counter value is used for the reference.
\end{document}

enter image description here


You could simply use capt-of which provides stand-alone captionof command

\documentclass{book}
\usepackage[demo]{graphicx}
\usepackage{capt-of}
\usepackage{tabu}

\begin{document}

\begin{table}[ht]
\caption{Simple but not clever}
\centering
\begin{tabu}to \textwidth {X[c]X[c]}
  \includegraphics[width=45mm]{w.png}\captionof{figure}{fd} &\includegraphics[width=45mm]{x.png}\captionof{figure}{fd} \\
  \includegraphics[width=45mm]{y.png}\captionof{figure}{fd} &\includegraphics[width=45mm]{z.png}\captionof{figure}{fd} \\
\end{tabu}
\end{table}

\end{document}

enter image description here

This has two disadvantages: first it's not elegant and the table caption is much to close to the first picture. In my opinion one of the subfig or subcaption solutions is much better. When using a KOMA class there is no need to load capt-of.

Tags:

Tables

Floats