I have two same sized images and want them side by side with a caption under them.
My code looks like this:
\begin{figure}[H]
\centering
\begin{minipage}{.5\textwidth}
\centering
\includegraphics[width=\textwidth]{3}
\caption{label1}
\label{fig:test1}
\end{minipage}%
\begin{minipage}{.5\textwidth}
\centering
\includegraphics[width=\textwidth]{4}
\caption{label2}
\label{fig:test2}
\end{minipage}
\end{figure}
which works fine until one of the labels has 2 lines, than it looks like this:
and I woud like to prevent it to look something like this:
How can it be done?
Thanks
Best Answer
You need to specify the
[t]
position specifier for bothminipage
environments.A separate observation: All three
\centering
instructions are redundant.If you want a bit of separation between the
minipage
environments, specify their widths as0.475\textwidth
instead of0.5\textwidth
-- and maximize their horizontal separation by inserting an\hfill
directive.