# Warning: \label in float, but not after \caption

In my document, I usually use two following ways to work with pictures:

  \begin{figure}[ht!]
\centering
\includegraphics[scale=0.6]{pic1.pdf}
\caption{ description ...}
\label{enz:fig_usm_1f_RLz}
\end{figure}


and combination with package Subfigure:

 \begin{figure}[ht!]
\centering
\subfigure[my subcaption 1 ]{
\includegraphics[scale=1.2]{subfig1.pdf}\label{my_subfig1}}
\subfigure[my subcaption 2 ]{
\includegraphics[scale=1.2]{subfig2.pdf}\label{my_subfig2}}
\caption{ bla bla bla bla }
\label{enz:fig_ZD_NLO}
\end{figure}


I have got many warnings from compilers like this:: \label in float, but not after \caption ...

• xelatex.exe> This is XeTeX, Version 3.1415926-2.4-0.9998 (MiKTeX 2.9 64-bit)
• editor: Eclipse with Texlipse plugin
-
The warning comes from the nag package but when I put your code above inside a minimal document using nag and subfigure packages I don't get such warning but "No complaints by nag" instead. So my crystal ball is foggy, can you please enlighten it with a minimal but complete document which shows the behavior described by you? –  Axel Sommerfeldt Jan 6 '13 at 10:43

the references for the subcaptions will all be wrong if your caption is below the graphic. Put the label always after or inside the caption argument.

\begin{figure}[ht!]
\centering
\subfigure[my subcaption 1 \label{my_subfig1}]{%
\includegraphics[scale=1.2]{subfig1.pdf}}
\subfigure[my subcaption 2 \label{my_subfig2}]{%
\includegraphics[scale=1.2]{subfig2.pdf}}
\caption{ bla bla bla bla }\label{enz:fig_ZD_NLO}
\end{figure}

-
I drew from this example that is given in the documentation package Subfigure on page 3 There is: \begin{figure}% \centering \subfigure[First]{...}\goodgap \subfigure[Second Figure]{...}\\subfigure[Third]{\label{3figs-c}...}% \caption{Three subfigures.} \label{3figs} \end{figure} –  jafan Jan 6 '13 at 9:35
the package subfigure is really outdated, use subfig instead –  Herbert Jan 6 '13 at 9:36
All examples in the subfig package documentation have their \label in the content (and not in the caption), too. (And they work fine.) So I see it as a documented behavior that one can put the \label inside the content argument, too, and therefore I see nothing wrong in the code of the questioner. –  Axel Sommerfeldt Jan 6 '13 at 10:39