[Tex/LaTex] subcaption: `caption’ package not loaded

acmsubcaptionsubfloats

I am trying to use subfig in ACM class file, but it issues an error that 'caption' package not loaded. I downloaded the 1.3 version of caption (as suggested by ACM), but still the same.
Here is the code

\documentclass{sig-alternate}
\usepackage{graphicx, booktabs, multicol,multirow,bigstrut,rotating}
\usepackage{caption}
\usepackage{subcaption}
\begin{document}
\begin{figure}[t]
\centering
 \begin{subfigure}[b]{0.3\textwidth}
 \includegraphics[scale=0.12]{figures/fig3} \caption{Comparison} \label{Fig:Speed}
 \end{subfigure}
  \begin{subfigure}[b]{0.3\textwidth}
 \includegraphics[scale=0.12]{figures/fig3} \caption{Comparison} \label{Fig:Time}
  \end{subfigure}%
\end{figure}
\end{document}

when compiling there are couple of errors including:

  1. subcaption: `caption' package not loaded
  2. Environment subfigure undefined. \begin{subfigure}
  3. Missing number, treated as zero \begin{subfigure}[b]{0.3\textwidth}

Any hint is appreciated.

Best Answer

Since sig-alternate defines its own \caption command, the caption package is not really compatible with it; subcaption might work, but the result is not guaranteed. You can do with subfig:

\PassOptionsToPackage{demo}{graphicx} % just for the example
\documentclass{sig-alternate}

\usepackage[caption=false]{subfig}
\usepackage{lipsum} % just for the example

\begin{document}

\lipsum[1-2]

\begin{figure}[ht]
\centering

\subfloat[Comparison one]{%
  \includegraphics[width=0.3\textwidth]{figures/fig3}%
  \label{Fig:Speed}%
}

\subfloat[Comparison two]{%
  \includegraphics[width=0.3\textwidth]{figures/fig3}%
  \label{Fig:Time}%
}
\end{figure}

\lipsum
\end{document}

The two lines marked just for the example are for producing the image, don't use them yourself.

Don't use scale=, but prefer setting the width. You should probably use multiples of \columnwidth rather than \textwidth, as the class produces two column documents.

enter image description here