Take the 2-minute tour ×
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.

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?

\begin{frame}
\frametitle{Inconsistency}
\begin{itemize}
\item 
\begin{center}
\includegraphics[scale=0.3]{peer}
\includegraphics[scale=0.3]{peer-inconsistent}  
\end{center}
\end{itemize}
\end{frame}
share|improve this question

3 Answers 3

up vote 14 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
1  
why do I get Illegal unit of measure (pt inserted) error? for \includegraphics[width=0.5\textwidth]{peer} –  user494461 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.

\begin{figure}
   \includegraphics[width=0.475\textwidth]{peer}
   \hfill
   \includegraphics[width=0.475\textwidth]{peer-inconsistent}
\end{figure}
share|improve this answer

You can use the columns enviroment:

\begin{frame}
\frametitle{Incosistency}
\begin{columns}[c]
    \column{.5\textwidth}
        \begin{center}
            \includegraphics[scale=0.3]{peer}
        \end{center}
    \column{.5\texwidth}
        \begin{center}
             \includegraphics[scale=0.3]{peer-inconsistent} 
        \end{center}
\end{columns}

\end{frame}
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. –  Edo May 1 '12 at 12:04

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.