2

I am trying to use \columns in conjunction with \includegraphics to show a "list" of pictures.

Sadly this code:

\begin{frame}
  \frametitle{Einführung}
    \begin{columns}
    \column{0.5\textwidth}
        \centering
        \includegraphics[width=5cm,height=3.5cm]{FiguresAndPictures/AlleAktien-Netflix-Logo.png}\\
        \includegraphics[width=5cm,height=4cm]{FiguresAndPictures/Amazon-Logo.jpg}
    \column{0.5\textwidth}
        \centering
        \includegraphics[width=5cm,height=3.5cm]{FiguresAndPictures/facebook.png}\\
        \includegraphics[width=5cm,height=4cm]{FiguresAndPictures/nn.png}
    \end{columns}
\end{frame}

Only creates this slide:

fail

What i would like, is that all images are scaled proportionally to each other, but not be strechted like that ... how do i do that?

1
  • 1
    Specify the width or height, but not both. Commented May 18, 2019 at 15:58

1 Answer 1

6

The graphicx package provides the keepaspectratio key. If you set this, the used keys width and height are meant as limits, the image is scaled to not exceed either of the two while keeping the same aspect ratio, so instead of using \usegraphics[width=5cm, height=3.5cm]{<file>} use \usegraphics[width=5cm, height=3.5cm, keepaspectratio]{<file>}.

\documentclass[]{article}

\usepackage{duckuments} % for random duck pics
\usepackage[]{graphicx}

\begin{document}
\includegraphics{example-image-duck}

%distorted
\includegraphics[width=7cm, height=3.5cm]{example-image-duck}

%using either of the two
\includegraphics[width=7cm]{example-image-duck}

%using either of the two
\includegraphics[height=3.5cm]{example-image-duck}

% using both and keepaspectratio, results in the smaller of the two above
\includegraphics[width=7cm, height=3.5cm, keepaspectratio]{example-image-duck}
\end{document}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .