作为 LaTeX 的新手,我目前正在准备我的第一篇论文。因为我要提交论文的会议要求作者使用IEEE 会议论文模板。
我在子图方面遇到了问题。以下是我的代码。
\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}
错误消息:
! 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.
我哪里做错了?
答案1
您在子图的语法上犯了一些小错误。替换 »子图“ 经过 ”子图« 采用以下方式起作用。
\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}
请注意,图将移至下一页。