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


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?

  • 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 ;-) – user31729 Oct 20 '17 at 16:57
  • @TeXnician Please provide your comment as answer and I'll happily accept. – Walter Oct 21 '17 at 9:29
  • @ChristianHupfer If this is so, please close as duplicate with an appropriate well-asked and well-answered question. – Walter Oct 21 '17 at 9:30
  • @Walter: It was closed already for about 16 hours at the time you wrote your comment ;-) – user31729 Oct 21 '17 at 14:55