Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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[caption=false,font=footnotesize]{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.

share|improve this question
    
Welcome to tex.sx! A tip: If you indent lines by 4 spaces, then they are marked as a code sample. You can also highlight the code and click the "code" button (with "{}" on it). –  Paulo Cereda Jun 15 '11 at 12:26
    
Thanks @Paulo and noted. –  Md Oliya Jun 15 '11 at 14:47

1 Answer 1

up vote 2 down vote accepted

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), 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}
share|improve this answer
    
Thank you; didnt know that the blank lines between the subfigures that effective. –  Md Oliya Jun 15 '11 at 14:56

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.