# Subcaption: wrong subfigure labels

I am having a problem with \subcaption labeling subfigures (c) and (d) instead (a) and (b).

I don't know where the problem originates from. I have many figures that contain two subfigures and most of them are labelled correctly, i.e. (a) and (b). But for some particular locations within the code, the labels come out as (c) and (d), no matter which figures how I use. I tried reverting to using \subfigure instead but the labels also come out as (c) and (d) instead of (a) and (b) at those particular locations within the code.

Below is the block of code that I use to have two figures placed next to each other with subcaptions.

\usepackage[bf]{caption}
\usepackage[hypcap=true]{subcaption}

\begin{figure}[h]
\centering
\subcaptionbox{Figure a\label{fig:a}}
{\includegraphics[width=0.45\textwidth]{figure-a}}
\subcaptionbox{Figure b\label{fig:b}}
{\includegraphics[width=0.45\textwidth]{figure-b}}
\caption{Figure a and b}
\label{fig:figure}
\end{figure}


EDIT: The following code is the shortest reproduction of the problem I could achieve. I cut down my original document.

\documentclass[12pt,a4paper]{report}
%Declaring packages for use
\usepackage[utf8]{inputenc}
\usepackage{graphicx}
\usepackage[bf]{caption} %Bold equation and figure captions
\usepackage[hypcap=true]{subcaption}

\begin{document}
\chapter{Intro}
\section{The first chapter}

If we remove this big figure then no bad labeling

\begin{figure}[tbhp]
\centering
\Large K
\caption{big figure}
\label{fig:big}
\end{figure}

\section{MIS}
If we remove this than no bad labeling

\begin{figure}
\begin{minipage}[b]{.5\linewidth}
\centering\large A
\subcaption{A subfigure}\label{fig:1a}
\end{minipage}%
\begin{minipage}[b]{.5\linewidth}
\centering\large B
\subcaption{Another subfigure}\label{fig:1b}
\end{minipage}
\caption{A figure}\label{fig:1}
\end{figure}

\chapter{Some chapter}
\section{Some Section}
Some section

\subsection{Transfer}
If we remove this then no bad labeling

\begin{figure}[tbhp]
\centering
\Large K
\caption{big figure}
\label{fig:big}
\end{figure}

\begin{figure}
\begin{minipage}[b]{.5\linewidth}
\centering\large A
\end{minipage}%
\begin{minipage}[b]{.5\linewidth}
\centering\large B
\end{minipage}
\end{figure}

\end{document}

-
I couldn't reproduce the odd behaviour mentioned. Can you please post a complete, minimal and compilable version of code allowing to reproduce the problem? – Gonzalo Medina Mar 24 '11 at 18:29
A reproduction has been made. Thanks for looking into my problem. – ld_pvl Mar 24 '11 at 19:46
The code you posted works OK in my system; I had no problems with the subfigue numbering. Perhaps you are using an outdated version of the subcaption package? – Gonzalo Medina Mar 24 '11 at 19:52
You're right. Updated my caption and subcaption sty files and that solved my problem. Many thanks to you Gonzalo Medina. – ld_pvl Mar 24 '11 at 20:49
Since the problem was due to the use of an outdated version, should we close this as "too localized", or should @Gonzalo first post his comment as an answer? – Hendrik Vogt Mar 24 '11 at 21:48

As pointed out by Gonzalo Medina in a comment, the problem is due to an outdated version of the subcaption package. Updating the caption and subcaption sty files solves the problem.