7

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
1
  • 2
    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? – user2574 Jan 6 '13 at 10:43
5

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}
3
  • 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} – JardaFait Jan 6 '13 at 9:35
  • the package subfigure is really outdated, use subfig instead – user2478 Jan 6 '13 at 9:36
  • 3
    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. – user2574 Jan 6 '13 at 10:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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