I just figured out how this could happen but still don't know why: previously I used \begin{figure}\begin{center}...\end{center}\label{fig:demo}\end{figure} which produced the wrong reference number, then I changed to \begin{figure}\centering ...\label{fig:demo}\end{figure} now it produced the correct number.
s*t
6 楼
do you have a \caption in your figure env? it's \caption who produces the label. figure or table by itself doesn't produce labels.
【在 J*****n 的大作中提到】 : I just figured out how this could happen but still don't know why: : previously I used : \begin{figure}\begin{center}...\end{center}\label{fig:demo}\end{figure} : which produced the wrong reference number, : then I changed to : \begin{figure}\centering ...\label{fig:demo}\end{figure} : now it produced the correct number.
J*n
7 楼
sorry, its my typo. I did use \label{fig:demo} in my figure and \ref{fig:demo} in text. still not working.