LaTex: Fixing Wrong Figure Numbers
The post is copied from: Terminally IncoherentWhat I tell you right now may save you hours of extensive debugging, cursing under your breath, commenting out custom code dealing with figure layout and much frustration. Whenever you use figures, always (and I mean ALWAYS EVER FOREVER ALWAYS) put \caption first, and \label second like this:
If you put the \label above \caption you will run into trouble when referencing figures inside subsections. In my case, the caption underneath the figure would say Fig. 4.2 but the output of \ref would be 4.3.10 because somehow it was picking up the section numbers wrong.\begin{figure}[htp]
\centering
\includegraphics{image.eps}
\caption{Some Image}
\label{fig:some-image}
\end{figure}
I had to submit the document today n all chapters except chapter 1 had \label above \caption n i was so *&^*&%^&$%* but i found on google search a blog Terminally Incoherent. It helped me n i m really thankful to the owner of the blog.
Blogged with Flock
38 comments:
Thanks a lot for the post! It saves me time :)
Me too! The default way TeXnicCenter creates a figure is the very way that creates this problem. I guess I'll be contacting the developers.
Thanks a million! I was about to resort to entering table numbers manually.
Wonderful!, i was breaking my head where the problem was. Thank you so much.
Thanks very much for the post, i was starting to bang my head on the table...
I also want to mention that when using centered figures, the \labe{} should be after \caption but before \end{center}.
Thanks so much! TexnicCenter can really be frustrating some times..
Thanks! You solved my problem!
Thanks man! I have almost torn off all my hair before I found your blog.
Nice! Manually entering numbers will not the task my friend has to face all thanks to you :)
Thanks a lot! I am one hour away from sending my thesis out and I was going nots on this one. Wish you a beer!
Thanks a lot : )
Thank you so much.. I can't tell you how much I wonaa thank you. I've been trying to correct these wrong numbers for about 6 hours and I was going nuts. These were the only thing left to finish my thesis and I've finished writing now because of your post.. Thank you.. Thank you.. Thank you
Thank you very much. I just had the problem and was very confused. In my case I had caption before a table, then the table and then the label. That didnt work either. When I moved the label after the caption but before the table it was correct.
Thanks for the tip, I couldn't figure out why my numbers were wrong in the \ref{}. Still think its strange that you have to put the label after the caption as I put the label right after \begin{table} to make them easier to identify.
This is huge!
Thanks for the hint, as I already spent a couple of hours trying to figure out why my figures are sometimes mislabeled.
Thanks!!!! Much appreciated post!!!
Just what I was looking for, thanks so much! As Richard said the default TeXnicCenter template does this incorrectly, you always just assume those things are the correct way of doing things...
Thanks dude!
THANK YOU! THANK YOU! THANK YOU! And thanks to google for finding your post.
Thanks indeed for this post. Now my figure references don't all say "figure 5".
My hero
You saved me hours of frustration. Amazing. I never would have thought of moving the caption and label around to fix the problem. You are probably some sort of god or something. Can I shine your shoes?
This is EXACTLY what I was looking for. These kinds of small things can be a complete pain in the ...
Thanks!
I'm glad this post is still up--it saved me a LOT of time. Thank you!!
Thank you dude, you're the MacDaddy!
thanks! very helpful indeed.
Thanks! 5 seconds of reading saving n+ minutes of debugging ;)
Thanks! A nice succinct solution to what I was having trouble with.
Thanks a lot! So much time saved.
Thaaaaaaaaaaanks :)
Tons of thanks !! :)
I had gone crazy because of this.
Your post came like a blessing!!
THANK YOU.
Wow! Thank you so much. This has saved me many hours of debugging :)
Thank you very much. It's 2013 now and you are still saving people!
Thanks.
One of the reasons why a lot of people don't like Latex: it has its own personality :-)
Thank you very much. Saved me a lot of time!
I LOVE THIS, it fixed all my figure numbering problems!
Post a Comment