Graphics, Figures & Tables ⇒ Figure references all have same number
Figure references all have same number
When the figures are embedded in the text, the numbering and referencing is correct. When I simply move the lines embedding the figures (see below) to the end of the text, the figures are numbered correctly in the captions under the figures, but all references in the text are to Figure 5. I can see this in the .aux file.
Here is as sample of the lines to insert the figures. [removing \singlespacing makes no difference]
\begin{figure}[p!]
\centering
\includegraphics[width=0.5\textwidth]{ModalValues.pdf}
\singlespacing{ \caption{Modal values of the limit distribution.}
\label{fig:mode}
\end{figure}
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
Figure references all have same number
Removing that got the referencing right. Though at the expense of having double spaced captions.
- Stefan Kottwitz
- Site Admin
- Posts: 10324
- Joined: Mon Mar 10, 2008 9:44 pm
Figure references all have same number
welcome to the forum!
The command
\singlespacing
is a simple switch. It switches to single spacing. It is not a command that takes an argument. By using the curly braces, the \caption
command got its own local scope, grouped in braces. So it did not step up the figure counter, since the caption command effect stays local within the braces.This would be different:
Code: Select all
\begin{figure}[p!]
\centering
\includegraphics[width=0.5\textwidth]{ModalValues.pdf}
\singlespacing
\caption{Modal values of the limit distribution.
\label{fig:mode}
\end{figure}
Figure references all have same number
The odd thing is that when the figures were embedded in the text, rather than all put together at the end, that syntax (error) for \singlespacing{\caption{...}} didn't matter---caption still stepped up the counter. Only when the figures were bunched at the end did it matter.
But thanks---that was the problem.
-
- Posts: 707
- Joined: Tue Mar 25, 2008 5:02 pm