3

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

4
  • 2
    The subcaptions should go before \includegraphics
    – dustin
    Jul 31, 2013 at 21:40
  • 1
    Welcome to TeX.SX!
    – mafp
    Jul 31, 2013 at 21:57
  • 1
    Please complete your code snippet to a full compilable document. In particular include information about how you load the subfigure package, as this will affect the answer. Aug 1, 2013 at 11:02
  • The way I understand it, you want to remove the subcaptions. However, your code snippet, when placed in a document loading just the necessary packages, produce no subcaption. So please do as Andrew suggested, and produce a complete, compilable example, a minimal working example (MWE), that demonstrates the problem. Aug 6, 2013 at 19:02

2 Answers 2

3

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

In you code snippet, you should put your subcaptions before \includegraphics; that is,

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

Also, many will tell you to use descriptive labels and not numbers. I ran into this problem awhile ago. If you place a figure in front of it, you would have to re-index your whole document or you would have fig 1, fig just placed in between, fig 2 which is now 3, etc.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .