# 3 images side by side [duplicate]

I want to position 3 images side by side. Actually I am doing like this, but they don't get side by side (see the pic on the bottom). Also is there any way to show only 1 caption for these 3 figures?

\begin{figure}[ht]

\begin{minipage}[b]{0.3\linewidth}
\centering
\includegraphics[scale=1]{i/houghtrain.png}
\caption{default}
\label{fig:figure1}
\end{minipage}

\hspace{0.3cm}

\begin{minipage}[b]{0.4\linewidth}
\centering
\includegraphics[width=\textwidth]{i/houghframe.png}
\caption{default}
\label{fig:figure2}
\end{minipage}

\hspace{0.3cm}

\begin{minipage}[b]{0.4\linewidth}
\centering
\includegraphics[width=\textwidth]{i/houghspace.png}
\caption{default}
\label{fig:figure3}
\end{minipage}
\end{figure}


They are not good positioned:

We can go outside the margin of the document if it is needed

• you have blank lines=paragraph breaks between the images. Jun 13, 2013 at 12:36
• You were right! if you want post an answer. Also if you know how to show only one caption i will sure accept it Jun 13, 2013 at 12:40
• Please take a look at tex.stackexchange.com/questions/65386/…
– user13907
Jun 13, 2013 at 12:47

If you just want three images side by side they can be positioned just as you would position three letters or boxes, no need for minipage wrappers etc. I also added p to your optional argument as not having it makes it more likely the float will go to the end of the document.

\begin{figure}[htp]

\centering
\includegraphics[width=.3\textwidth]{i/houghtrain.png}\hfill
\includegraphics[width=.3\textwidth]{i/houghframe.png}\hfill
\includegraphics[width=.3\textwidth]{i/houghspace.png}

\caption{default}
\label{fig:figure3}

\end{figure}

• is there any way to ignore the margin? I have to reduce the scale of the images to get them on a single line. (and there is plenty of space on the left and right) Jun 13, 2013 at 12:55
• @yes123 put \hspace*{-1cm} before the first and after the last and you steal 1cm from each margin Jun 13, 2013 at 12:58
• I think it goes on conflict with \hfill Jun 13, 2013 at 13:08
• the hfill just pads the space, if that space is too big your images are too small or you have taken too much space out of the margin oh hang on the width key in my answer is wrong: you can not make then all \textwidth wide, will edit... Jun 13, 2013 at 13:18
• @tommy.carstensen It depends if you want subfigures:-) that is if the previous figure was figure 2 and you have three captions in this one, do you want captions labeled 3a,3b,3c or captions labeled 3,4,5 subfigure is about getting 3a,3b,3c Mar 17, 2015 at 13:01