4

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.

4
  • 1
    The package caption (and so also subcaption) is not compatible with the sig-alternate class.
    – egreg
    Jan 31, 2014 at 11:55
  • Oh, thanks. Any other option? Subbottom also does not work
    – Espanta
    Jan 31, 2014 at 12:01
  • 1
    Maybe helpful: tex.stackexchange.com/a/129594/41085
    – Crissov
    Jan 31, 2014 at 12:18
  • The suggestion of @Crissov solves the problem, by restoring the (ugly) boldface captions that ACM requires, so why is the below answer accepted ? (it is correct, but leads people to not use the subcaption package, which is newer and maintained).
    – 0 _
    Jun 22, 2014 at 1:54

1 Answer 1

5

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

1
  • great. it works perfect.
    – Espanta
    Feb 2, 2014 at 15:23

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .