TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to place two or more figures on top of the two-column page next to each other (horizontally). However, for some reason I can't do this. This is the code that I use, it puts the second figure in the new line. Why is that? Btw, figures are tiny and many of them can fit in one line.

\begin{figure*}[t]
\centering

\subfigure[Market revenue]{
{\epsfig{file = figures/graphs/revenue.pdf, width = 3cm}}
\label{fig:evaluation:revenue}
}

\subfigure[Average price]{
{\epsfig{file = figures/graphs/avgPrice.pdf, width = 3cm}}
\label{fig:evaluation:avgPrice}
}

\caption{Simulation results}
\end{figure*}
share|improve this question
up vote 7 down vote accepted

Don't use an empty line between the two subfigures:

\begin{figure*}[t]
\centering

\subfigure[Market revenue]{%
{\epsfig{file = figures/graphs/revenue.pdf, width = 3cm}}%
\label{fig:evaluation:revenue}%
}\qquad
\subfigure[Average price]{%
{\epsfig{file = figures/graphs/avgPrice.pdf, width = 3cm}}%
\label{fig:evaluation:avgPrice}%
}

\caption{Simulation results}
\end{figure*}

However you should be using the package subfig instead of the obsolete subfigure and graphicx with its more powerful commands instead of epsfig (which should never be used in new documents, it exists only for compatibility with older ones).

\begin{figure*}[t]
\centering

\subfloat[Market revenue]{%
  \includegraphics[width=3cm]{figures/graphs/revenue}%
  \label{fig:evaluation:revenue}%
}\qquad
\subfloat[Average price]{%
  \includegraphics[width=3cm]{figures/graphs/avgPrice}%
  \label{fig:evaluation:avgPrice}%
}

\caption{Simulation results}
\end{figure*}
share|improve this answer
    
What package are these examples? It doesn't compile with graphicx and subfig for me. – Magpie Jan 13 '13 at 19:00

Update to answer from: @egreg

  1. Empty line did cause problem for me as well. Took off the empty line my images went horizontally. There are a few symbols to add space between subfigures: ~, \quad, \qquad, \hfill. (Update from @Werner: a few more symbols to control horizontal space explained here.)

  2. According to this latex page on wikibooks.org, subfig is also deprecated now, and the recommended package is subcaption:

A useful extension is the subcaption package which uses subfloats within a single float. The subfigure and subfig packages are deprecated however they are useful alternatives when used in-conjunction with latex templates (i.e templates for journals from Springer and IOP, IEEETran and ACM SIG) that are not compatible with subcaption. These packages give the author the ability to have subfigures within figures, or subtables within table floats.

share|improve this answer
    
subfig is not marked as obsolete on CTAN... – Werner Mar 21 at 23:50
    
...there are far more horizontal spacing commands than you mention. – Werner Mar 21 at 23:56

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.