# How to insert subfigure with caption in IEEE trans?

I am trying to insert some subfigures with caption to all the figure in IEEE trans and i don't want to span two columns. But it is not working. I want to do the following: . And what i tried:

\begin{figure}[ht]
\begin{subfigure}[b]{0.25\linewidth}
\centering
\includegraphics[width=0.5\linewidth]{images/1a}
\caption{}
\label{1a}
\vspace{4ex}
\end{subfigure}%%
\begin{subfigure}[b]{0.25\linewidth}
\centering
\includegraphics[width=0.5\linewidth]{images/1b}
\caption{}
\label{1b}
\vspace{4ex}
\end{subfigure}%%
\begin{subfigure}[b]{0.25\linewidth}
\centering
\includegraphics[width=0.5\linewidth]{images/1c}
\caption{}
\label{1c}
\vspace{4ex}
\end{subfigure}%%
\begin{subfigure}[b]{0.25\linewidth}
\centering
\includegraphics[width=0.5\linewidth]{images/1d}
\caption{}
\label{1d}
\vspace{4ex}
\end{subfigure}
\caption{(a),(b)Some examples from CIFAR-10 \cite{4}. The objects in single-label
images are usually roughly aligned.(c),(d) However, the assumption of object alignment is not valid for multi-label
images. Also note the partial visibility and occlusion
between objects in the multi-label images.}
\label{fig1}
\end{figure}


How can i achieve it??

• I cannot run your MWE as I don't have your images, but I imagine the overall width of the figure, having 4 figures in it, each half a linewidth, would be about 2 lines wide. Did you try \includegraphics[width=0.25\linewidth]{images/1a} ? Also, it would be wise for the overall width to be a little less than 1 lines wide, as there will be spaces between figures... maybe 0.2 \linewidth or less ? – Elad Den Apr 21 '16 at 7:59

If you read IEEEtran documentation will see that it recommends not using subfigure package but subfig. And an example with subfig is explained in it.

What I understand you want is something like this:

which can be obtained with following code:

\documentclass{IEEEtran}
\usepackage{lipsum}
\usepackage{graphicx}
\ifCLASSOPTIONcompsoc
\usepackage[caption=false, font=normalsize, labelfont=sf, textfont=sf]{subfig}
\else
\usepackage[caption=false, font=footnotesize]{subfig}
\fi

\begin{document}

\section{A}
\lipsum

\section{B}
\lipsum[1-3]
\begin{figure}
\centering
\subfloat[a\label{1a}]{%
\includegraphics[width=0.45\linewidth]{example-image}}
\hfill
\subfloat[b\label{1b}]{%
\includegraphics[width=0.45\linewidth]{example-image}}
\\
\subfloat[c\label{1c}]{%
\includegraphics[width=0.45\linewidth]{example-image}}
\hfill
\subfloat[d\label{1d}]{%
\includegraphics[width=0.45\linewidth]{example-image}}
\caption{(a), (b) Some examples from CIFAR-10 \cite{4}. The objects in
single-label images are usually roughly aligned.(c),(d) However, the
assumption of object alignment is not valid for multi-label
images. Also note the partial visibility and occlusion
between objects in the multi-label images.}
\label{fig1}
\end{figure}
\lipsum[1-5]
\end{document}

• May I suggest that you update your answer, due to issues in referencing the subfloats which is addressed here? – Pouya Sep 12 '18 at 13:13

here is another way:

\usepackage{subfigure}

\begin{figure}
\centering
\subfigure[First caption]
{
\includegraphics[width=1.0in]{imagefile2}
\label{fig:first_sub}
}
\\
\subfigure[Second caption]
{
\includegraphics[width=1.0in]{imagefile2}
\label{fig:second_sub}
}
\subfigure[Third caption]
{
\includegraphics[width=1.0in]{imagefile2}
\label{fig:third_sub}
}
\caption{Common figure caption.}
\label{fig:sample_subfigures}
\end{figure}


And the output: