I defined a Table with lable the following way:
\begin{table}[t]
\centering
\begin{tabular}{|c|c|}
\hline Transaktionsnummer & Enthaltene Items \\
\hline 1 & f,a,c,d,g,i,m,p \\
\hline 2 & a,b,c,f,l,m,o \\
\hline 3 & b,f,h,j,o \\
\hline 4 & b,c,k,s,p \\
\hline 5 & a,f,c,e,l,p,m,n \\
\hline
\end{tabular}
\label{tab:transaktionsdatenbank}
\caption{Transaktionsdatenbank nach \cite{han2000mining}}
\end{table}
The caption shows: Tabelle 5.1: Transaktionsdatenbank nach [HPY00]
When using the reference:
\begin{figure}[t]
\centering
\includegraphics[width=0.5\textwidth]{img/FrequentPatternTree58.png}
\caption{Frequent Pattern Tree aus Transaktionsdatenbank in Tabelle \ref{tab:transaktionsdatenbank}}
\label{fig:frequentPatternTree}
\end{figure}
I get: Abbildung 5.1: Frequent Pattern Tree aus Transaktionsdatenbank in Tabelle 5.2.2 where 5.2.2 is the subsection the table was defined in instead of 5.1.
What could I have done wrong?
\labelhave to be placed after (or within) the\caption. See e.g. Why does an environment's label have to appear after the caption? – Torbjørn T. Feb 11 '15 at 17:40