Latex: Wrong reference number
I have 6 figures in my .tex file. Wherever I put a reference to the 6th image, in the pdf I get Figure1.5 instead of Figure1.6 (1 less) but upon clicking the link I go to the right figure Figure1.6.
Similarly, when I refer to 5th image, in the pdf I get Figure1.4 instead of Figure1.5, once again when I click the link I go to Figure1.5.
Same goes to a reference to 4th image, I get 1 less (1.3 instead of 1.4) in the pdf. Same with 1.3, I get 1.2.
But for 1.2 I get exactly 1.2 and 1.1 I get 1.1.
Why is this happening? I thought it was due to \caption
and \label
order in the figure, but I have already verified that they are in the right order. So I don't think so that it is that problem.
Help!
Code for figures from 1.1 to 1.6
\begin{figure}
\begin{center}
\subfigure[\textit{abcd...........xyz}]{\label{fig:Fig1.1a} \includegraphics[width=0.48\textwidth]{Images/Figure001.png}}
\hspace{1.0mm}
\subfigure[\textit{abcd...........xyz}]{\label{fig:Fig1.1b} \includegraphics[width=0.48\textwidth]{Images/Figure002.png}}
\end{center}
\textit{\caption{abcd...........xyz}}
\label{figure1.1}
\end{figure}
%---------------------------------%
\begin{figure}
\begin{center}
\subfigure[\textit{abcd...........xyz}]{\label{fig:Fig1.2a} \includegraphics[width=0.48\textwidth]{Images/Figure004.png}}
\hspace{1.0mm}
\subfigure[\textit{abcd...........xyz}]{\label{fig:Fi开发者_如何学JAVAg1.2b} \includegraphics[width=0.48\textwidth]{Images/Figure005.png}}
\end{center}
\textit{\caption{abcd...........xyz}}
\label{figure1.2}
\end{figure}
%---------------------------------%
\begin{figure}
\begin{center}
\subfigure[\textit{abcd...........xyz}]{\label{fig:Fig1.3a} \includegraphics[width=0.45\textwidth]{Images/Figure006.png}}
\hspace{2.0mm}
\subfigure[\textit{abcd...........xyz}]{\label{fig:Fig1.3b} \includegraphics[width=0.45\textwidth]{Images/Figure007.png}}
\subfigure[\textit{abcd...........xyz}]{\label{fig:Fig1.3c} \includegraphics[width=0.95\textwidth]{Images/Figure008.png}}
\end{center}
\textit{\caption{abcd...........xyz}}
\label{figure1.3}
\end{figure}
%---------------------------------%
\begin{figure}[H]
\begin{center}
\subfigure[\textit{abcd...........xyz}]{\label{fig:Fig1.4a} \includegraphics[width=0.30\textwidth]{Images/Figure009a.png}}
\end{center}
\begin{center}
\subfigure[\textit{abcd...........xyz}]{\label{fig:Fig1.4b} \includegraphics[width=0.45\textwidth]{Images/Figure010.png}}
\hspace{2.0mm}
\subfigure[\textit{abcd...........xyz}]{\label{fig:Fig1.4c} \includegraphics[width=0.45\textwidth]{Images/Figure011.png}}
\end{center}
\begin{center}
\subfigure[\textit{abcd...........xyz}]{\label{fig:Fig1.4d} \includegraphics[width=0.403\textwidth]{Images/Figure012.png}}
\hspace{2.0mm}
\subfigure[\textit{abcd...........xyz}]{\label{fig:Fig1.4e} \includegraphics[width=0.45\textwidth]{Images/Figure013.png}}
\end{center}
\textit{\caption{abcd...........xyz}}
\label{figure1.4}
\end{figure}
%---------------------------------%
\begin{figure}
\begin{center}
\subfigure[\textit{abcd...........xyz}]{\label{fig:Fig1.5a} \includegraphics[width=0.403\textwidth]{Images/Figure014a.png}}
\hspace{2.0mm}
\subfigure[\textit{abcd...........xyz}]{\label{fig:Fig1.5b} \includegraphics[width=0.403\textwidth]{Images/Figure014b.png}}
\end{center}
\begin{center}
\subfigure[\textit{abcd...........xyz]{\label{fig:Fig1.5c} \includegraphics[width=1\textwidth]{Images/Figure015.png}}
\end{center}
\textit{\caption{abcd...........xyz}}
\label{figure1.5}
\end{figure}
%---------------------------------%
\begin{figure}[H]
\begin{center}
\includegraphics[width=0.80\textwidth]{Images/Figure015a.png}
\textit{\caption{abcd...........xyz}}
\end{center}
\label{figure1.6}
\end{figure}
OK. The problem started with this step - I wanted to have italicized captions, which out of my intuition, I was doing it this way:
\textit{\caption{abcd...........xyz}}
For all my captions I have the \textit
enclosing the \caption{}
, this was what was causing the problem. I don't understand why.
So I removed all of them and the references now work perfectly.
But I still wanted the italics captions.
So, I did this, I gave options to the package directly
\usepackage{caption}
\captionsetup{font=it, labelfont=bf}
Here, font=it
italics the entire caption including the label and labelfont=bf
bolds only the label.
But this ONLY italicized the captions of a figure, for the captions of a sub-figure I had to once again give options to sub-figure package
\usepackage[bf, it, IT]{subfigure}
Where bf
and it
options bolds and italics the label and IT
option will only italics the text.
Thats it, the problem is solved!
Verify whether the reference to figure 2 is set correctly.
精彩评论