[Tex/LaTex] 2×3 images spanning over a two column text

positioningsubfloats

I am trying to align 6 figures in a 2 by 3 organization over a two column text, but all my tries are in vain, the figures end up vertical. I've also tried minipages but no luck.

the tex:

\documentclass[10pt, conference, compsocconf]{IEEEtran}

\usepackage[utf8]{inputenc}   

\usepackage{array}

\usepackage{mdwmath}

\usepackage{mdwtab}

\usepackage{subfig}

\usepackage{graphicx}

\usepackage{epsfig}

%%%%%%%%%%
%%%%%%%%%%

\begin{figure*}[t]
\centering

\subfloat[A]{
\label{ex0}
\epsfig{figure=qa.eps,width=0.3\textwidth}
}                

\qquad

\subfloat[B]{
\label{ex1}
\epsfig{figure=qb.eps,width=0.3\textwidth}
}                

\qquad

\subfloat[C]{
\label{ex3}
\epsfig{figure=qc.eps,width=0.3\textwidth}
}                


\newline

%a row similar to the above

\end{figure*}

Thanks for any comments.

Best Answer

Do not leave blank lines between the subfigures. You can try something like this:

\documentclass[10pt, conference, compsocconf]{IEEEtran}
\usepackage[utf8]{inputenc}   
\usepackage{array}
\usepackage{mdwmath}
\usepackage{mdwtab}
\usepackage[caption=false,font=footnotesize]{subfig}
\usepackage[demo]{graphicx}

\begin{document}

\begin{figure*}[t]
\subfloat[A]{\label{ex0}
\includegraphics[width=0.3\textwidth]{qa}}\hfill
\subfloat[B]{\label{ex1}
\includegraphics[width=0.3\textwidth]{qb}}\hfill
\subfloat[C]{\label{ex3}
\includegraphics[width=0.3\textwidth]{qc}}\\
\subfloat[D]{\label{ex4}
\includegraphics[width=0.3\textwidth]{qd}}\hfill
\subfloat[E]{\label{ex5}
\includegraphics[width=0.3\textwidth]{qe}}\hfill
\subfloat[F]{\label{ex6}
\includegraphics[width=0.3\textwidth]{qf}}
\end{figure*}

\end{document}

I used \includegraphics form the graphicx package instead of \epsfig from the obsolete epsfig package. Instead of forcing a \quad space between the figures, you can use \hfill which will distribute the spacing evenly.

I used the demo option for the graphicx package to make my example compilable for everyone. Do not use that option in your actual code.

If you don't mind using the subcaption package (this package behaves better than subfig, See subcaption vs. subfig: Best package for referencing a subfigure), you could use something like this:

\documentclass[10pt, conference, compsocconf]{IEEEtran}
\usepackage[utf8]{inputenc}   
\usepackage{array}
\usepackage{mdwmath}
\usepackage{mdwtab}
\usepackage[font=footnotesize]{caption}
\usepackage{subcaption}
\usepackage[demo]{graphicx}

\begin{document}

\begin{figure*}[t]
\begin{subfigure}[b]{0.3\linewidth}
  \centering
  \includegraphics{qa}
  \caption{A}
  \label{ex0}
\end{subfigure}\hfill
\begin{subfigure}[b]{.3\linewidth}
  \centering
  \includegraphics{qb}
  \caption{B}
  \label{ex1}
\end{subfigure}\hfill
\begin{subfigure}[b]{.3\linewidth}
  \centering
  \includegraphics{qc}
  \caption{C}
  \label{ex2}
\end{subfigure}\\
\begin{subfigure}[b]{.3\linewidth}
  \centering
  \includegraphics{qd}
  \caption{D}
  \label{ex3}
\end{subfigure}\hfill
\begin{subfigure}[b]{.3\linewidth}
  \centering
  \includegraphics{qe}
  \caption{E}
  \label{ex4}
\end{subfigure}\hfill
\begin{subfigure}[b]{.3\linewidth}
  \centering
  \includegraphics{qf}
  \caption{F}
  \label{ex5}
\end{subfigure}
\end{figure*}

\end{document}