[Tex/LaTex] Table of images with captions

floatstables

I have a table with four images.

\begin{table}[ht]
\caption{table caption...}
\centering
\begin{tabular}{cc}
\includegraphics[width=45mm]{w.png} &\includegraphics[width=45mm]{x.png}\\
\newline
\includegraphics[width=45mm]{y.png}&\includegraphics[width=45mm]{z.png}\\
\end{tabular}
\end{table}

I want to caption each of the images. Normally I would do this by placing includegraphics within a \begin{figure} block using \caption{...}. But when I do this, the images disappear.

What is the proper way to do this, so that I can caption each of the images.

Best Answer

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}
Related Question