\pdfoptionpdfminorversion=5
\documentclass[12pt]{article}
\usepackage{amsmath}
\usepackage[demo]{graphicx}
\usepackage{float}
\usepackage{hyperref}
\begin{document}
\section{Intro}
Intro section to show whatever...
\section{Whatever}\label{definitelyNOTouch}
The following should read Figure 1: Figure~\ref{ouch}
But it reads Figure 2!! What is going on???
\begin{figure}[H] \label{ouch}
\begin{center}
\includegraphics{anypic.pdf}
\caption{Some nice caption}
\end{center}
\end{figure}
\end{document}
Just see what happens. I compile it and it calls the figure "figure 1", but it refers to it as "Figure 2"!! And the link points to the section 2, not figure 1.
I've tried cleaning the help files and recompiling thousands of times, so that's not it. I've also tried this in a different computer with a different OS.
NEW: TikZ book now 40% off at Amazon.com for a short time.
And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p
Just use \label after \caption, this order is important. You will see, it will work fine then. \caption prepares an internal macro which can be used by \label. Without it, \label refers to the anchor before, which is the section here, that's why you got the number 2.
By the way, by simply adding the demo option to graphicx you can ensure that people are able to compile it even without the image. I edited the code line above for you. Now readers can just click the "Open" link above the code and see the output. That's why it's great that you posted a minimal example.
The \label needs to be placed after\caption, otherwise it will reference to the last command which had produced a reference which is \section{Whatever} here.
\newpage
\section{Electrospun nanofibers as host scaffold for the growth of hierarchical nanostructures}
\begin{figure}[ht]
\centering
\includegraphics[width=0.9\textwidth]{D:/Dharani/Theisis/Thesis/Figures/14.png}
\caption[blah.]{blah.}
\label{fig:14}
\end{figure}
I used the above format and for section 1 it worked but for section 2 it didnt work, it always recalls the image as Fig. 2.2. I dont understand whats going wrong.
Can you please help me?
Impossible to tell the reason for the behaviour described. The safest way to find the problem cause, is to prepare a minimal working example and come back here.
Another thing, do you know the difference between \newpage and \clearpage? Maybe the latter is of more use for you.
Best regards
Johannes
BTW: Please insert code into the code-environment, this gives nice markup.
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
I had the same problem you were mentioning before.
I could find a solution by just disabling the \centering option, like this (with the "%" symbol):
\newpage
\section{Electrospun nanofibers as host scaffold for the growth of hierarchical nanostructures}
\begin{figure}[ht]
%\centering
\includegraphics[width=0.9\textwidth]{D:/Dharani/Theisis/Thesis/Figures/14.png}
\caption[blah.]{blah.}
\label{fig:14}
\end{figure}
It worked perfectly to me. All the references and ordinal numbers for my figures were right!
BTW: You should not use the center environment inside a float like figure or table, because it does add extra vertical space. An indeed if you would use center, the \label has to be in the same group level as the \caption.
Sorry, but I can no longer participate here as the administrator is trampling on my wishes on one of his other platforms.
NEW: TikZ book now 40% off at Amazon.com for a short time.
And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p