Graphics, Figures & TablesWrong Figure Reference

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
MatthiasN
Posts: 41
Joined: Sun Mar 11, 2012 1:21 pm

Wrong Figure Reference

Post by MatthiasN »

Hi everyone,

I'm having a problem with a figure reference that keeps being wrong, no matter what I do... I don't think that I've made any mistakes in my code:

Code: Select all

\begin{figure}
\centering
\includegraphics[scale=1]{Adsorptie_interacties}
\label{Adsorptie_interacties}
\caption{Adsorptie interacties}
\end{figure}
and

Code: Select all

\begin{figure}
\centering
\includegraphics[scale=1.05]{Sorptie_isothermen}
\label{Sorptie_isothermen}
\caption{Types sorptie isothermen}
\end{figure}
If I use the command \ref{} afterwards with the label I've given up, it returns a number that differs from the number LaTeX gave to the figure. Other figures in the same document do get a right reference, so I don't see why these two don't...

Maybe it also has something to do with the fact I used sub-figures somewhere in the document before these two figures?
FYI, I've also tried to save the document under another name and build it again.

I hope anyone can help me.

Thanks in advance!

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

Learn LaTeX easily with newest books:

The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis

The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more

LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis

User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Wrong Figure Reference

Post by localghost »

The \label has always to placed after the \caption command. Only the latter one creates the anchor for the reference.

I recommend to do some basic reading [1]. That's the best and most efficient way to solve this kind of problems quickly and time saving.

[1] View topic: LaTeX Resources for Beginners


Thorsten
MatthiasN
Posts: 41
Joined: Sun Mar 11, 2012 1:21 pm

Re: Wrong Figure Reference

Post by MatthiasN »

Thanks for your help!! I think the (not so) short introduction will help me a lot furhter too. I'm gonna try to read it in my free time.

Greetings
Post Reply