我正在尝试\columns
结合使用\includegraphics
来显示图片“列表”。
遗憾的是这个代码:
\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}
仅创建此幻灯片:
我想要的是,所有图像都按比例缩放,但不会像那样被拉伸......我该怎么做?
答案1
该graphicx
软件包提供了keepaspectratio
密钥。如果您设置了该密钥,则使用的密钥width
和height
将作为限制,图像将缩放至不超过两者中的任何一个,同时保持相同的纵横比,因此不要使用,而要\usegraphics[width=5cm, height=3.5cm]{<file>}
使用\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}