[Tex/LaTex] Two images inside minipage (side by side) with one common caption that says “Figure 1 & 2:”

captionsgraphicsminipage

I have two images inside a minipage, so I can have them side by side. When I make a caption for the images it only comes up as "figure 3: text", but I would like to have it showing "Figure 3 & 4: text".

I tried to \end{figure} and \begin{figure} in each minipage but the images would not show side by side anymore. The code I have at the moment is:

\begin{figure}[h]
\begin{minipage}[h]{0.3\textwidth}
\includegraphics[scale=0.58]{fig1}
\end{minipage} \hspace{0.2\textwidth}
\begin{minipage}[h]{0.3\textwidth}
\includegraphics[scale=0.58]{fig2}
\end{minipage}
\caption{text}
\end{figure}

Best Answer

This isn't quite what you've asked for, but how about the following? I'm using the subcaption package to put your two pictures into two 'subfigures'. The pictures can then be referenced individually (Figure 1a and Figure 1b), or as a pair (Figure 1).

Code

\documentclass{article}

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

\begin{document}

\begin{figure}[h]
    \begin{subfigure}{0.3\textwidth}
        \includegraphics[scale=0.58]{fig1}
        \caption{horse}
        \label{fig:horse}
    \end{subfigure} \hspace{0.2\textwidth}
    \begin{subfigure}{0.3\textwidth}
        \includegraphics[scale=0.58]{fig2}
        \caption{zebra}
        \label{fig:zebra}
    \end{subfigure}
\caption{animals}
\label{fig:animals}
\end{figure}

Figure~\ref{fig:animals} shows some animals. Figure~\ref{fig:horse} shows a horse.

\end{document}

Result

enter image description here