[Tex/LaTex] Figures caption

captions

I am using \subfigure package to place two figures side by side. The following are the code lines for this purpose.

\begin{figure}
\centering
\mbox{\subfigure{\includegraphics[width=2in]{Figure 2a.png}}\quad
\subfigure{\includegraphics[width=2in]{Figure 2b.png} }}
\caption{FE model geometry and boundary conditions; (a) tension/compression, (b) simple shear} %\label{Fig. 2}
\end{figure}

The placement of figures (2a and 2b) are correct but with the caption of the figure 2a.png and 2b.png are appearing (before the caption) in the document. I tried many ways to remove them but havn't succeeded.

Yours valuable suggestions are highly appreciated.

Thanks

Best Answer

You shouldn't be using subfigure, but either subfig or subcaption.

Here's the version for subfig:

\documentclass{article}

\usepackage[demo]{graphicx} % demo is just for the example
\usepackage{subfig}

\begin{document}
\begin{figure}
\centering

\subfloat[]{\includegraphics[width=2in]{Figure 2a.png}}\quad
\subfloat[]{\includegraphics[width=2in]{Figure 2b.png}}

\caption{FE model geometry and boundary conditions; (a)~tension\slash compression,
(b)~simple shear}\label{fig:FEmodel}

\end{figure}

\end{document}

Note that the enclosing \mbox is not needed.

enter image description here

A very similar output is obtained with subcaption:

\documentclass{article}
\usepackage[demo]{graphicx} % demo is just for the example
\usepackage{subcaption}

\begin{document}
\begin{figure}
\centering

\begin{subfigure}{2in}
\centering
\includegraphics[width=2in]{Figure 2a.png}
\subcaption{}
\end{subfigure}\quad
\begin{subfigure}{2in}
\includegraphics[width=2in]{Figure 2b.png}
\subcaption{}
\end{subfigure}

\caption{FE model geometry and boundary conditions; (a)~tension\slash compression,
(b)~simple shear}\label{fig:FEmodel}

\end{figure}

\end{document}