Float reference only appears when using [h] here float placement [closed]

I'm typesetting an article using PNAS' template for two-column articles: http://www.pnas.org/misc/PNASTWO.CLS

My problem is that if I include a figure or table:

\begin{figure}
\caption{my figure}
\label{fig:myfig}
\end{figure}


and reference my figure or table,

I now reference Figure \ref{fig:myfig}, a decent figure


the Figure number does not appear:

I now reference Figure , a decent figure

However, if I specify float placement with the

\begin{figure}[h]


option, the number appears:

I now reference Figure 1, a decent figure

[tbh], [thbp] will not work, but all variants starting with [h] give float number, like [htb]. Pdflatex does not give any warnings when the float reference do not show, not even the normal ??.

The problem with using [h] is that the [h] figure placement is sub-optimal, making my article longer than the 6-page limit for PNAS.

The pnastwo.cls style file is behind this somehow, because when using a normal article style the reference numbers appear.

I'm not asking anyone to correct the pnas style file, but I would be glad if anyone has any ideas about what is happening here.

-

closed as too localized by cgnieder, Stefan Kottwitz♦Dec 13 '12 at 21:03

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question.

Very hard to tell since we do not know what pnastwo.cls is. Perhaps someone has done something not particularly clever. Try \caption{bla bla\label{fig}}, some journal styles does not comply to standard LaTeX –  daleif Dec 13 '12 at 11:47
Can you provide a complete minimal document showing the problem. When I try to put one together, I have no problems with numbering and references to the figures. –  Andrew Swann Dec 13 '12 at 11:51
daleif: Your suggestion worked! Putting the label within the caption solved the issue! Thanks! –  Jorgen Dec 13 '12 at 12:00
Sigh ........ :-) –  daleif Dec 13 '12 at 13:01
Worked for me with placing the \label after \caption{}, too... –  cgnieder Dec 13 '12 at 20:12