1

This question already has an answer here:

I have included a graphic using \includegraphics into a \begin{figure} \end{figure} in revtex4-1. The figure appears in section II (i.e. 2) but the caption of the figure says Fig.1 (this is not a problem per se).

The problem is when I refer to the figure by saying e.g.

See Figure \ref{Figure: Fig1} then the output is See Figure II. I suspect because the figure occurs in section II. How to fix this? Or perhaps this is OK for journals (e.g. J math phys)? Below you can find a MWE

    \documentclass{revtex4-1}
    \usepackage{amsmath}
    \usepackage{graphicx}
    \usepackage{verbatim}
    \usepackage{color}
    \usepackage{subfigure}
    \usepackage{hyperref}
    \begin{document}
    \section{First Section}
    hey
    \section{Second Section}
    \begin{figure}
       \includegraphics[width=.5\textwidth]{StupidPicture}\label{Figure: SimplyStupid}
       \caption{This is a stupid picture}
    \end{figure}
Hello dear reader, please see Figure \ref{Figure: SimplyStupid}. Thanks. 
    \end{document}

marked as duplicate by David Carlisle floats Jun 12 '15 at 15:01

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • Since you love learning, you should learn how to provide an minimal working example (MWE) ... – user31729 Jun 12 '15 at 14:27
  • Yeah that part me no love learning – Your Majesty Jun 12 '15 at 14:30
  • Well, others will answer it anyway -- perhaps ;-) – user31729 Jun 12 '15 at 14:32
  • haha OK, but I'll try with that ME thing from now on, I promise. – Your Majesty Jun 12 '15 at 14:33
  • You provided a MWE and we were willing to help ;-) – user31729 Jun 12 '15 at 14:54
1

The \label must be written after \caption, not before. Labels need a \refstepcounter (here with figure counter) such that the latest stepped counter is known and the reference is correctly written.

If \label{Figure: SimplyStupid} is used before \caption, it will use the last counter being stepped, this is section, that's why the reference prints II (the 2nd section)

\documentclass{revtex4-1}
    \usepackage{amsmath}
    \usepackage[demo]{graphicx}
    \usepackage{verbatim}
    \usepackage{color}
    \usepackage{subfigure}
    \usepackage{hyperref}
    \begin{document}
    \section{First Section}
    hey
    \section{Second Section}
    \begin{figure}
       \includegraphics[width=.5\textwidth]{StupidPicture}
       \caption{This is a stupid picture}\label{Figure: SimplyStupid}
    \end{figure}
Hello dear reader, please see Figure \ref{Figure: SimplyStupid}. Thanks. 
    \end{document}

Not the answer you're looking for? Browse other questions tagged or ask your own question.