Subfigure - Missing number

I have a problem. I want to include 3 figures via subfigures. I want the first pic to be alone in the center and the second and third fig to be beneath. This is my code:

\begin{figure}
\centering
\begin{minipage}{0.8\textwidth}
\centering
\subfigure[First caption]
{
\includegraphics[width=0.39\textwidth]{82.pdf}
\label{fig:first_sub}
}
\\
\subfigure[Second caption]
{
\includegraphics[width=0.39\textwidth]{82.pdf}
\label{fig:second_sub}
}
\subfigure[Third caption]
{
\includegraphics[width=0.39\textwidth]{82.pdf}
\label{fig:third_sub}
}
\caption{Common figure caption.}
\label{fig:sample_subfigures}
\end{minipage}
\end{figure}


The problem is that I get an Error: "! Missing number, treated as zero." After my first pic and I don't know why... Maybe you guys can help me. I'd appreciate it.

• What package are you using to include your \subfigures? – Werner May 18 '16 at 16:56

It seems that you use obsolete package subfigure. Instead it try to use for example subfig which is replacement for it:

\documentclass{article}
\usepackage{graphicx}
\usepackage{subfig}

\begin{document}
\begin{figure}[htb]
\centering
\begin{minipage}{0.8\textwidth}
\centering
\subfloat[First caption]
{
\includegraphics[width=0.39\textwidth]{example-image-a}
\label{fig:first_sub}
}
\\
\subfloat[Second caption]
{
\includegraphics[width=0.39\textwidth]{example-image-b}
\label{fig:second_sub}
}
\subfloat[Third caption]
{
\includegraphics[width=0.39\textwidth]{example-image-c}
\label{fig:third_sub}
}
\caption{Common figure caption.}
\label{fig:sample_subfigures}
\end{minipage}
\end{figure}
\end{document}


It gives:

Addendum: Another better possibility -- as said Torbjørn T. in his comment -- is to use package subcaption. Considering it above code become:

\documentclass{article}
\usepackage{graphicx}
\usepackage{subcaption}

\begin{document}
\begin{figure}[htb]
\centering
\begin{minipage}{0.8\textwidth}
\centering
\begin{subfigure}[b]{0.33\textwidth}\centering
\includegraphics[width=0.9\textwidth]{example-image-a}
\caption{First caption}
\label{fig:first_sub}
\end{subfigure}
\\
\begin{subfigure}[b]{0.33\textwidth}\centering
\includegraphics[width=0.9\textwidth]{example-image-b}
\caption{Second caption}
\label{fig:second_sub}
\end{subfigure}
\begin{subfigure}[b]{0.33\textwidth}\centering
\includegraphics[width=0.9\textwidth]{example-image-c}
\caption{Third caption}
\label{fig:third_sub}
\end{subfigure}
\caption{Common figure caption.}
\label{fig:sample_subfigures}
\end{minipage}
\end{figure}
\end{document}


Obtained image is (almost) the same as before.

• Judging by the error message I would say he/she has \usepackage{subcaption} in the preamble, but is clearly using the syntax of the subfigure package. subcaption works better with hyperref for example, so changing the syntax to using its environment/macro is possibly a better option. – Torbjørn T. May 18 '16 at 20:21
• I will added option with subcaption. I regularly use subfig without any problems, however with option caption=false in memoir document class (so I actually use memoir captions system). – Zarko May 18 '16 at 20:26
• Actually, seems I should correct myself. The manual of subfig states that it works correctly with hyperref, so perhaps this was only a problem with older versions. – Torbjørn T. May 18 '16 at 20:32
• I just tried the second possibility and it just works fine! – Toggo May 19 '16 at 8:19
• @TorbjørnT. No, unfortunately the hyperref problems of subfig were never fixed :-( There is an adaption to hyperref included in subfig, therefore the documentation claims it works correctly, but unfortunately there are bugs in the adaption. I have sent fixes to Steven, and he had planned to integrate them into version 1.4 of the subfig` package, but unfortunately he never published it. – user2574 May 19 '16 at 9:22