TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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 have two images. How do I align them side by side and scale them so that both of them together occupy the whole horizontal space in a beamer presentation?

share|improve this question
up vote 22 down vote accepted

If vertical size do not matter, then you could use

\includegraphics[width=<X>\textwidth]{<first image>}%
\includegraphics[width=<1-X>\textwidth]{<second image>}

Here <X> denotes a number in (0,1), while <1-X> denotes its complement in the interval (0,1). Note the % to remove any space between the images. For equally-sized images, <X>=<1-X>=.5. Using only width as the scaling dimension will scale the height proportionally, maintaining the aspect ratio.

If vertical size does matter, you can also specify the height.

share|improve this answer
why do I get Illegal unit of measure (pt inserted) error? for \includegraphics[width=0.5\textwidth]{peer} – zcqwevb Apr 30 '12 at 21:13
@user494461: I don't know. You need to provide more context (either in comment, but preferably by editing your original question). – Werner Apr 30 '12 at 21:23
@user494461: This should work perfectly. Could you check it again. If the issue is still there, please post a full compilable example which causes the issue. – Martin Scharrer Apr 30 '12 at 22:38

Just use width=0.5\textwidth instead of scale=3. The width option will scale an image to match the given width while keeping the aspect ratio.

To get a little white space between them you may use something like this.

share|improve this answer

You can use the columns enviroment:


share|improve this answer
This won't scale the images to the required size. – Martin Scharrer Apr 30 '12 at 22:37
I had wrongly interpreted the question, my bad. – gcedo May 1 '12 at 12:04

Your Answer


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.