0

I would like to have side by side two images in latex using mini page. In order to do so i have the following code:

\begin{figure}[!tbp]
\centering
\begin{minipage}[b]{0.49\textwidth}
 \includegraphics[width=\textwidth]{imgs/fid_score.jpg}
  \caption{my caption 1.}
  \label{fig:1}
 \end{minipage}
 \hfill
 \begin{minipage}[b]{0.49\textwidth}
  \includegraphics[width=\textwidth]{imgs/is.png}
  \caption{my caption 2}
  \label{fig:2}
 \end{minipage}
 \caption{total caption}
 \end{figure}

My problem is that with the previous code I got three captions:

Figure 1: my caption 1 Figure 2: my caption 3 Figure 3: total caption

Ideally, I would like to have Figure 1 and Figure 1 b. How can I do it in such a way?

1 Answer 1

5

Load the subcaption package and use this code:

\begin{figure}[!tbp]
\begin{subfigure}[b]{0.5\textwidth}
 \includegraphics[width=\linewidth]{imgs/fid_score.jpg}
  \caption{my caption 1.}
  \label{fig:1}
 \end{subfigure}
 \begin{subfigure}[b]{0.5\textwidth}
  \includegraphics[width=\linewidth]{imgs/is.png}
  \caption{my caption 2}
  \label{fig:2}
 \end{subfigure}
 \caption{total caption}\label{fig:total}
 \end{figure}
4
  • I modified it in such a way, now it works properly but I am facing another issue, both images even if they have the same exact size and there is not any white framing they are not depicted with the same size. How can I align them?
    – Jose Ramon
    Jun 14, 2019 at 12:27
  • I'm not sure I understand your problem. How can the original images have the same size, be scaled by the same factor and not have the same size in the resulting .pdf? Also, align how? Horizontally?
    – Bernard
    Jun 14, 2019 at 12:34
  • It was only due to the different size of the caption between the two images.
    – Jose Ramon
    Jun 14, 2019 at 13:47
  • In this case, you might be interested in the floatrow package, which has quite some tools for the alignment.
    – Bernard
    Jun 14, 2019 at 13:50

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .