[Tex/LaTex] How to align two images side by side and to scale them automatically to use whole slide


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?


Best Answer

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.