1. Limited time only! Sign up for a free 30min personal tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Latex nubering of subfigures

  1. May 5, 2009 #1
    Hi,

    In my report, I want figures to be numbered within sections, so I put the following in the preamble of my document:
    Code (Text):
    \numberwithin{figure}{section}
    This works great, except for when I am referencing subfigures. I have the following code:
    Code (Text):
    \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 (Text):
    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
     
  2. jcsd
  3. May 5, 2009 #2

    matt grime

    User Avatar
    Science Advisor
    Homework Helper

    What does altering the subfigure counter do? Something like

    Code (Text):
    \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).
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook




Similar Discussions: Latex nubering of subfigures
  1. Latex help (Replies: 4)

  2. Images on latex (Replies: 3)

  3. Figures in Latex (Replies: 1)

  4. LatEX help (Replies: 4)

  5. Latex problems (Replies: 1)

Loading...