1

As a newbie to LaTeX, I am currently preparing my very first paper. Since the conference to which I am going to submit my paper to requires the authors to use the IEEE conference paper template.

I encounter problems with the subfigures. The following is my code.

\documentclass[conference]{IEEEtran}
\usepackage{natbib} % for the bibliography
\usepackage[pdftex]{graphicx}
\usepackage[cmex10]{amsmath} % http://www.ctan.org/tex-archive/macros/latex/required/amslatex/math/
\usepackage{algorithm} % http://ctan.org/pkg/algorithms
\usepackage{algpseudocode} % http://ctan.org/pkg/algorithmicx
\usepackage{array} % http://www.ctan.org/tex-archive/macros/latex/required/tools/
\usepackage{mdwmath}
\usepackage{mdwtab} % http://www.ctan.org/tex-archive/macros/latex/contrib/mdwtools/
\usepackage{eqparbox} % http://www.ctan.org/tex-archive/macros/latex/contrib/eqparbox/
\usepackage[tight,footnotesize]{subfigure} % http://www.ctan.org/tex-archive/obsolete/macros/latex/contrib/subfigure/
\usepackage{fixltx2e} % http://www.ctan.org/tex-archive/macros/latex/base/
\usepackage{stfloats} % http://www.ctan.org/tex-archive/macros/latex/contrib/sttools/
\usepackage{url} % http://www.ctan.org/tex-archive/macros/latex/contrib/misc/

\begin{document}

\title{Title}

\author{
\IEEEauthorblockN{
    Name1\IEEEauthorrefmark{1},
    Name2\IEEEauthorrefmark{2},
    Name3\IEEEauthorrefmark{3} and
    Name4\IEEEauthorrefmark{4}}
\IEEEauthorblockA{\IEEEauthorrefmark{1}institute1\\ Email1}
\IEEEauthorblockA{\IEEEauthorrefmark{2}institute2\\ Email2}}

% make the title area
\maketitle

\begin{abstract}
%\boldmath
The abstract goes here.
\end{abstract}

\section{Conclusion}
% An example of a double column floating figure using two subfigures.
% (The subfig.sty package must be loaded for this to work.)
% The subfigure \label commands are set within each subfloat command, the
% \label for the overall figure must come after \caption.
% \hfil must be used as a separator to get equal spacing.
% The subfigure.sty package works much the same way, except \subfigure is
% used instead of \subfloat.
%
\begin{figure*}[!t]
\centerline{\subfloat[Case I]\includegraphics[width=2.5in]{subfigcase1}%
\label{fig_first_case}}
\hfil
\subfloat[Case II]{\includegraphics[width=2.5in]{subfigcase2}%
\label{fig_second_case}}}
\caption{Simulation results}
\label{fig_sim}
\end{figure*}

\end{document}

Error Messages:

! Undefined control sequence.<argument> \subfloat[Case I]\includegraphics [width=2.5in]{subfigcase1}\lab... \label{fig_first_case}}
! Undefined control sequence. \subfloat
! Extra }, or forgotten \endgroup.\@endfloatbox ...pagefalse \outer@nobreak \egroup\color@endbox \end{figure}
! Extra }, or forgotten \endgroup.\@endfloatbox ...pagefalse \outer@nobreak \egroup\color@endbox \end{figure}
Label `fig_sim' multiply defined.
There were multiply-defined labels.

Where did I do wrong?

  • I think that the subfigure package is obsolete, and you should use the subcaption and caption packages instead. For an example of their use see the paragraph "Subfloats" of this article. – Ludovic C. Sep 26 '13 at 7:19
  • 1
    For the sub-figures you are using the syntax of »subfig«, the direct successor of »subfigure«. So, just replacing subfigure with subfig in your code should already work. – Thorsten Donig Sep 26 '13 at 7:48
  • @ThorstenDonig Sorry but no, I have tried. – Sibbs Gambling Sep 26 '13 at 7:57
  • @LudovicC. I wish to stick with the given format and modify it a bit. – Sibbs Gambling Sep 26 '13 at 7:59
  • 1
    Answering would me much easier if you make your code compilable and reduce it to only the relevant parts. That would end all speculations. – Thorsten Donig Sep 26 '13 at 8:31
4

You have done some minor mistakes in the syntax for the sub-figures. Replacing »subfigure« by »subfig« works in the below approach.

\documentclass[conference]{IEEEtran}
\usepackage[T1]{fontenc}
\usepackage[demo]{graphicx}  % drop `demo` option in actual document!
\usepackage[caption=false]{subfig}

\title{Title}
\author{
  \IEEEauthorblockN{
    Name1\IEEEauthorrefmark{1},
    Name2\IEEEauthorrefmark{2},
    Name3\IEEEauthorrefmark{3} and
    Name4\IEEEauthorrefmark{4}
  }
  \IEEEauthorblockA{\IEEEauthorrefmark{1}institute1\\ Email1}
  \IEEEauthorblockA{\IEEEauthorrefmark{2}institute2\\ Email2}
}

\begin{document}
  \maketitle

  \begin{abstract}
    The abstract goes here.
  \end{abstract}

  \section{Conclusion}
    \begin{figure*}[!tb]
      \centering
      \subfloat[Case I\label{fig:first-case}]{%
        \includegraphics[width=2.5in]{subfigcase1}%
      }
      \hfill
      \subfloat[Case II\label{fig:second-case}]{%
        \includegraphics[width=2.5in]{subfigcase2}%
      }
      \caption{Simulation results}
      \label{fig:sim}
    \end{figure*}
\end{document}

Note that the figure will be shifted to the next page.

  • You should also drop the pdftex driver option for »graphicx«. The package itself does best in choosing the right driver. – Thorsten Donig Sep 26 '13 at 8:49
  • Thanks, it reports no errors, 1) but strangely the pic is just not there. So strange. 2) May I ask what is the use of the '%' after '{'. I am sorry if the question is so trivial. Thanks! – Sibbs Gambling Sep 26 '13 at 9:06
  • 1
    @perfectionm1ng The % character is here to comment everything which could be after it on the same line such as space or hidden character. It just makes sure that you wont have trouble due to an extra unwanted space or hidden character. – Ludovic C. Sep 26 '13 at 10:31
  • Thanks for the clarification! it reports no errors, 1) but strangely the pic is just not there. Could you suggest some solutions to this? – Sibbs Gambling Sep 26 '13 at 12:14
  • @perfectionm1ng: What does "is not there" mean? The presented code produces two pages. As already mentioned the figure appears on the second page. – Thorsten Donig Sep 26 '13 at 17:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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