TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Possible Duplicate:
Numbers of figure references

I'm having some problem about subfigure numeration. The figures in my work are numbered inside the section using the line \numberwithin{figure}{section}, so they are like figure 2.1, 2.2, 2.3...

I tried to use the subfigure command and make reference to that figure, so the numeration should be 2.1(a), but it ignores the section number, showing just "figure 1(a)".


\subfigure[subfigure a]{\includegraphics{image1} \label{image1}}
\subfigure[subfigure b]{\includegraphics{image2} \label{image2}}

According to figure \ref{image1} we ...

Is that a way I could use this kind of numeration and the subfigure command?

If I remove the line \numberwithin{figure}{section} the numeration is fine

share|improve this question

marked as duplicate by Kurt, Martin Schröder, Martin Scharrer Jan 23 '13 at 21:13

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.

up vote 2 down vote accepted

You can do this by redefining the command \thesubfigure and a couple of others. Take a look at this question for the details (read the whole thing). Incidentally, that answer recommends switching to a newer package that does the same thing.

Your question is basically a duplicate of that one. (You don't need to redefine \section and \subsection, as the sample code shows; that's all irrelevant to the question).

share|improve this answer
You are completely right. I could solve the problem using the \ref{fig}\subref{subfig} command. – Eduardo Goncalves Jan 22 '13 at 22:23
Note that links to other answers do not qualify as new answers. If this question is solved by an answer of a similar question it is a duplicate and should be closed as such instead. – Martin Scharrer Jan 23 '13 at 21:12
Go ahead and close it then. As you see there was some irrelevant fluff in the original answer that I wanted to highlight, and anyway I don't have enough privileges to vote to close. – alexis Jan 23 '13 at 21:16

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