Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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)".

\documentclass{article}
\usepackage{graphicx}
\usepackage{amsmath}
\usepackage{subfigure}
\numberwithin{figure}{section}
\begin{document}

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

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

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
add comment

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.

1 Answer

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
add comment

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