# Latex nubering of subfigures

Hi,

In my report, I want figures to be numbered within sections, so I put the following in the preamble of my document:
Code:
\numberwithin{figure}{section}
This works great, except for when I am referencing subfigures. I have the following code:
Code:
\begin{figure}[h]
\centering
\subfigure[$f(x)$]{
\includegraphics[width=0.4\textwidth]{figures/fx}
\label{fig:fx}
}
\subfigure[$\Phi_{50}(x,y)$]{
\includegraphics[width=0.4\textwidth]{figures/phi_comp}
\label{fig:phi_comp}
}
\caption{$\Phi_{N}(x,y)$ for $N=1,20,50$}
\label{fig:fx_phi_comp}
\end{figure}
Figure \ref{fig:fx} shows that ...

This produces something like "Figure 2(a) shows that ..." instead of "Figure 4.2(a) shows that ...". I have worked around this by doing the following:
Code:
Figure \ref{sec:comparison}.\ref{fig:fx} shows that ...
Where sec:comparison is the label I have applied to the appropriate section.

Is this the only way around this? Or am I doing something wrong?

Thanks,

Ryan

matt grime
\numberwithin{subfigure}{section}