26

How to put two figures side by side in a two-column document. figure* is not working.

Martin Scharrer
  • 262,582
user4852
  • 653

3 Answers3

31

This should do:

\begin{figure*}
\centering
\begin{minipage}[b]{.4\textwidth}
<Code for the first figure>
\caption{Caption}\label{label-a}
\end{minipage}\qquad
\begin{minipage}[b]{.4\textwidth}
<Code for the second figure>
\caption{Caption}\label{label-b}
\end{minipage}
\end{figure*}
egreg
  • 1,121,712
  • 1
    +1 That's the way I do it for two independent figures, i.e. there aren't subfigures. However I normally use width=.49\textwidth and \hfill not \qquad between them. Having a fixed distance is not a good idea IMHO. – Martin Scharrer Apr 28 '11 at 17:48
  • @Martin: this depends on the size of the figures; also, with just one \hfill in the middle the figures will go to the margins and maybe this is not wanted. However it was worth noting. – egreg Apr 28 '11 at 17:53
  • @egrep: Sorry, with width=.49\textwidth I meant using .49\textwidth in the width argument of minipage. Of course the width depends on the figures, someone might want to have e.g. 70-30 ratio, but I find .49-\hfill-.49 much better and less size dependent than .4-\qquad-.4. For me this doesn't push the figure in the margin: .49+.49=.98 => \hfill will be .02. Of course if the content is wider than the outer minipage than you are in trouble. IMHO using a fixed distance like \quad, \qquad or \hspace{...} causes more trouble, but I guess its also a matter of personal taste. – Martin Scharrer Apr 28 '11 at 18:03
  • Is there any way to \label then \ref the figures? – Geoff Jul 10 '12 at 14:55
  • 2
    @Geoff Isn't there a \label command? – egreg Jul 10 '12 at 15:01
20

I used subfigure package:

\begin{figure*}[htp]
  \centering
  \subfigure[random caption 1]{\includegraphics[scale=0.38]{image1}}\quad
  \subfigure[random caption 2]{\includegraphics[scale=0.38]{image2}}
\end{figure*}

Worked flawlessly :)

dingo_d
  • 2,976
  • 2
    The subfigure package is the way to go if both are subfigure from one figure, i.e. a) and b) and should be labeled as such. However often two different, independent figures should be set side-by-side because of place limitations. Then your method doesn't work. You should prefer width for scale. I would also use \hfill instead of \quad to spread the two figure over the text width. – Martin Scharrer Apr 28 '11 at 17:46
  • That's true, but it does the job :)

    And I agree \hfill align the pictures better...

    – dingo_d Apr 28 '11 at 17:51
  • Not for me. The scaling has to be adjusted for each image and the horizontal alignment is not correct. I'm sorry, I just to pedantic in such things :-) – Martin Scharrer Apr 28 '11 at 17:57
  • 1
    The subfigure package is obsolete. One of its successors is subfig. – Thorsten Donig Apr 28 '11 at 17:58
2

This works for me. You do not need any extra packages, such as subfigure or subcaption.

\begin{figure}[ht]
\begin{minipage}[b]{0.45\linewidth}
\centering
\includegraphics[width=\textwidth]{filename1}
\caption{default}
\label{fig:figure1}
\end{minipage}
\hspace{0.5cm}
\begin{minipage}[b]{0.45\linewidth}
\centering
\includegraphics[width=\textwidth]{filename2}
\caption{default}
\label{fig:figure2}
\end{minipage}
\end{figure}
Lorry
  • 131