I want to make a figure consisting of two subfigures. Having read the Wikipedia subentry on subfloats, I tried to follow it exactly, so I did not use the subfig
or subfigure
package, only the caption
and subcaption
packages. Nevertheless, I am getting a Missing number, treated as zero
error, pointing to the line with \begin{subfigure}
.
What am I doing wrong?
Below is my code:
% In preamble:
\usepackage{url}
\usepackage{graphicx}
\usepackage{caption}
\usepackage{subcaption}
\usepackage{rotating}
\usepackage[table]{xcolor}
\usepackage{multirow}
\usepackage{amsfonts}
% In document:
\begin{figure}[htpb]
\begin{subfigure}[b]{width=0.45\textwidth}
\centering
\includegraphics[width=\textwidth]{img_a}
\end{subfigure}
\begin{subfigure}[b]{width=0.45\textwidth}
\centering
\includegraphics[width=\textwidth]{img_b}
\end{subfigure}
\caption{A caption.}
\label{fig:my-figure}
\end{figure}
I am using TeXShop 2.47 on Mac OS X 10.8.1 (x86_64).
Thanks!