Latex nubering of subfigures

  • Thread starter ryan88
  • Start date
  • #1
42
0

Main Question or Discussion Point

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
 

Answers and Replies

  • #2
matt grime
Science Advisor
Homework Helper
9,395
3
What does altering the subfigure counter do? Something like

Code:
\numberwithin{subfigure}{section}

I've never used that numberwithin command, instead I would have defined the figure counter afresh with a \newcounter declaration for subfigures (please don't ask me to work out what it should be on the fly - I googled it and found at least 3 different suggestions for syntax, none of which I can verify as working).
 

Related Threads for: Latex nubering of subfigures

  • Last Post
Replies
5
Views
30K
  • Last Post
Replies
1
Views
1K
  • Last Post
Replies
6
Views
2K
  • Last Post
Replies
6
Views
3K
  • Last Post
Replies
3
Views
5K
  • Last Post
Replies
6
Views
22K
  • Last Post
Replies
1
Views
1K
  • Last Post
Replies
10
Views
4K
Top