Tell me more ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.
\begin{figure} \center
    \begin{subfigure}[b]
        \includegraphics[width=60mm]{a}
        \label{fig:a}
    \end{subfigure} %

    \begin{subfigure}[b]    
        \includegraphics[width=60mm]{b}
        \label{fig:b}    
    \end{subfigure} 
    \caption{my caption}
\end{figure}

I get an error

! Missing number, treated as zero.
<to be read again>
\let
           \includegraphics
                            [width=60mm]{a}

What's wrong?

share|improve this question

2 Answers

up vote 11 down vote accepted

This is how you should be using it.

\documentclass{article}
\usepackage{graphicx,subfigure}
\begin{document}
\begin{figure}
\centering     %%% not \center
\subfigure[Figure A]{\label{fig:a}\includegraphics[width=60mm]{example-image-a}}
\subfigure[Figure B]{\label{fig:b}\includegraphics[width=60mm]{example-image-b}}
\caption{my caption}
\end{figure}
\end{document}

enter image description here

Note: subfigure is outdated and new one is subfig which introduces subfloat command. You may consider using subfig instead of subfigure.

share|improve this answer
This does not actually answer the questions topic, does it? The actual solution to this mismatch would be to rename the question to "How should I use subfigures?" – Jukka Dahlbom Jan 22 at 10:09
@JukkaDahlbom A lot of users seem to find this question through searching for the error, and having a straightforward example of how the package should be used is likely to solve many problems. Thus, I’d leave the title as it is. – doncherry May 16 at 5:02

I believe you're using the subcaption package. The problem you have is that as a second argument to \begin{subfigure} you should tell it how wide you want your figure to be; e.g.

\begin{figure} \centering
    \begin{subfigure}[b]{\linewidth}
        \includegraphics[width=60mm]{a}
        \label{fig:a}
    \end{subfigure} %

    \begin{subfigure}[b]{\linewidth}    
        \includegraphics[width=60mm]{b}
        \label{fig:b}    
    \end{subfigure} 
    \caption{my caption}
\end{figure}

If you have further problems you can refer to the package documentation.

Hope that helps!

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.