Graphics, Figures & TablesFigure labelling 2, 8, 8 10 instead of 1, 2, 3, 4

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
loopylouise
Posts: 4
Joined: Thu Oct 13, 2011 4:13 pm

Figure labelling 2, 8, 8 10 instead of 1, 2, 3, 4

Post by loopylouise »

Hello everyone

It's probably a simple fix but I can't spot it. So here's the deal.

I have 7 images in my document, all labelled and happy as below.

Code: Select all

\begin{wrapfigure}{l}{0.5\textwidth}
  \begin{center}
  $\includegraphics[width=0.45\textwidth]{"./Pictures/Maxwell Boltzmann"}$
  \end{center}
  \caption{A graph to show the Maxwell Boltzmann distributions of three temperatures. $T_{red}<T_{green}<T_{blue}$}
\end{wrapfigure}
\label{fig:maxboltz}
(Please let me know if this is unacceptable scruffy code) This figure is the first in the document and appears with a caption labelling it Figure 1 (good so far) but when I come to reference the figure.

Code: Select all

Figure \ref{fig:maxboltz} shows a typical graphical representation of the Maxwell-Boltzmann Distribution of speeds.
I get an output of the image below. The next figure reference (for figure 2 in the caption) prints out figure 8 when referenced. When figure 3 is referenced, it also gets an 8. Am I missing something important here?

Thanks for any help you can give!

PS: I was going to put the preamble up here in spoiler tags so as to not make the post too long and boring but this forum doesn't seem to like then. So Preamble on request :S
Attachments
figure-label dilemma.JPG
figure-label dilemma.JPG (40.86 KiB) Viewed 1565 times

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

Figure labelling 2, 8, 8 10 instead of 1, 2, 3, 4

Post by localghost »

loopylouise wrote:[…] Please let me know if this is unacceptable scruffy code […]
Oh, yes. Indeed it is. Just answer yourself the question why you include the external image in math mode. And it goes without saying that the \label command goes into the wrapfigure environment.

Code: Select all

\begin{wrapfigure}{l}{0.5\textwidth}
  \centering
  \includegraphics[width=0.45\textwidth]{"./Pictures/Maxwell Boltzmann"}
  \caption{A graph to show the Maxwell Boltzmann distributions of three temperatures. $T_{red}<T_{green}<T_{blue}$}
  \label{fig:maxboltz}
\end{wrapfigure}

Thorsten
loopylouise
Posts: 4
Joined: Thu Oct 13, 2011 4:13 pm

Re: Figure labelling 2, 8, 8 10 instead of 1, 2, 3, 4

Post by loopylouise »

Thanks for the tips!
Post Reply