0

I have a figure that I don't want to float, i.e. I generate it with

\begin{center}
    \includegraphics[width=80mm]{figure_file}
\end{center}

\stepcounter{figure}
Figure~\arabic{figure}. \label{fig:A}
Caption text here.

As shown in Fig.~\ref{fig:A}, this does not work!

However, the \label{} command does, of course, not generate the desired reference marker. My question: how can I force this?

Walter
  • 1,227
  • 3
  • 12
  • 15
  • 3
    Change \stepcounter to \refstepcounter and then put label after that command. It will work then. – TeXnician Oct 20 '17 at 16:53
  • This kind of question pops up occasionally. It is apparently not really obvious that the reference \ref macro and \refstepcounter are closely related ;-) –  Oct 20 '17 at 16:57
  • @TeXnician Please provide your comment as answer and I'll happily accept. – Walter Oct 21 '17 at 09:29
  • @ChristianHupfer If this is so, please close as duplicate with an appropriate well-asked and well-answered question. – Walter Oct 21 '17 at 09:30
  • @Walter: It was closed already for about 16 hours at the time you wrote your comment ;-) –  Oct 21 '17 at 14:55
  • @ChristianHupfer Yes, I see this now, but when I typed the comment, this was not apparent. Perhaps I should have refreshed the page? – Walter Oct 21 '17 at 14:56

0 Answers0