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:
- subcaption: `caption' package not loaded
- Environment subfigure undefined. \begin{subfigure}
- 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, thecaption
package is not really compatible with it;subcaption
might work, but the result is not guaranteed. You can do withsubfig
: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.