Possible Duplicate:
Why does an environment's label have to appear after the caption?
I have a problem using \ref{} to reference table floating object. In my document, I have a table area like this:
\begin{table}
\label{tab:gstexp}
\begin{tabular}{l l p{7.5cm}}
\hline
\hline
\textbf{Nr.} & \textbf{Name} & \textbf{Comment} \\
\hline
%Contents
\hline
\hline
\end{tabular}
\caption{just a table}
\end{table}
In my text, I reference it using Table~\ref{tab:gstexp} The ref is before the label in my text but this should be indifferent. But if I compile my code in the PDF it renders "Table ??" instead of "Table 1".
I am using MacTeX and texmaker to compile my documents.
\labelhas always to be placed after the\captioncommand. – Thorsten Donig Jul 01 '12 at 09:54