[Tex/LaTex] Subfigure Caption Problem

floats

I am trying to have subfigures within one figure lets say Figure 1 , below is the code I have now. The problem is it doesn't show after I compile the tex and under the figures the following caption Fig1a:fishfigure and Fig1a:catfigure it shows instead: the following (a)fishfigure (b)catfigure…

Does anyone know what the problem is?

\begin{figure}
\centering
\subfigure[fish figure]{%
\includegraphics[width=0.45\textwidth]{fish}%
\label{fig:fish}%
}
\hfil
\subfigure
[cat figure]{%
\includegraphics[width=0.45\textwidth]{cat}%
\label{fig:cat}%
}
\hfil
\subfigure
[dogfigure]{%
\includegraphics[width=0.45\textwidth]{dog}%
\label{fig:dog}%
       }
     \end{figure}

Best Answer

Use the subcaption package instead of the obsolete subfigure, redefine \thesubfigure and declare the desired format for the label using \DeclareCaptionLabelFormat:

A little example, using \subcaptionbox (another options would be to use the subfigure environment from subcaption):

\documentclass{article} 
\usepackage[demo]{graphicx} 
\usepackage{subcaption}

\makeatletter
\renewcommand\thesubfigure{\thefigure(\alph{subfigure})}
\renewcommand\p@subfigure{}
\makeatother
\DeclareCaptionLabelFormat{prefixsubfig}{Fig#1#2:}
\captionsetup[subfigure]{labelformat=prefixsubfig}

\begin{document} 

\begin{figure}
\centering
\subcaptionbox{fish figure\label{fig:fish}}{%
  \includegraphics[width=0.45\textwidth]{fish}}\hfill
\subcaptionbox{cat figure\label{fig:cat}}{%
\includegraphics[width=0.45\textwidth]{cat}}\par
\subcaptionbox{dogfigure\label{fig:dog}}{%
  \includegraphics[width=0.45\textwidth]{dog}}
\end{figure}

As we see in subfigures~\ref{fig:fish}, \ref{fig:cat}, and~\ref{fig:dog}

\end{document}

enter image description here

The demo option for graphicx simply replaces actual figures with black rectangles; do not use that option in your actual document.