I placed 2 figures side by side using the minipage
method from this post, and the figures look perfectly fine. However, the caption of the right figure stick out into the margin, why is that and how can I fix it?
My code is like this:
\begin{figure}[htbp]
\centering
\begin{minipage}{.5\textwidth}
\centering
\includegraphics[width=6.6cm]{figure1.png}
\caption{Caption for figure 1.}
\label{fig:fig1}
\end{minipage}%
\begin{minipage}{.5\textwidth}
\centering
\includegraphics[width=6.6cm]{figure2.png}
\caption{Caption for figure 2, but longer.}
\label{fig:fig2}
\end{minipage}
\end{figure}
Best Answer
Here's the simplest method to achieve what you want:
Here it's assumed that the two pictures have the same height, so that correct alignment is obtained for the captions.