0

I have the following Latex code:

\begin{figure} [H]
     \centering
     \label{3.1_Gravity}
     \includegraphics[height=.3\textwidth,width=.45\textwidth]{3.1_Gravity_1D_phi}
     \includegraphics[height=.3\textwidth,width=.45\textwidth]{3.1_Gravity_1D_energy}
     \caption{Results for system from \ref{EnergyScalings} with $\psi=\psi_g$. On the right is the evolution of the concentration profile and on the left is the free-energy of the system calculated at each time step.}
     \label{3.1_SAW}
     \includegraphics[height=.3\textwidth,width=.45\textwidth]{3.1_SAW_1D_phi}
     \includegraphics[height=.3\textwidth,width=.45\textwidth]{3.1_SAW_1D_energy}
     \caption{Results for system from \ref{EnergyScalings} with $\psi=\psi_s$. On the right is the evolution of the concentration profile and on the left is the free-energy of the system calculated at each time step.}
\end{figure} \noindent

which produces enter image description here Now later on in the document, I want to reference the third and fourth pictures in this single figure. I use "\ref{3.1_SAW}" in the middle of a paragraph of text, however, it appears in the compiled PDF as "3.1" and links up to the top of the figure.

My question is: Why doesn't this come up as "3.2"? Am I putting the "\label" command in the wrong spot? I know I could solve this by using two separate figures however, then there is a large unnecessary spacing between them that I do not want. Any ideas are much appreciated

Mjoseph
  • 133
  • 3
    You asked, "Am I putting the \label command[s] in the wrong spot?" Indeed: the \label instruction should be placed after, not before, the associated \caption directive. – Mico Jun 23 '23 at 15:15
  • 2
    ah thank you so much! – Mjoseph Jun 23 '23 at 15:43

0 Answers0