我想同时定义一个图片的最大高度和最大宽度。我想一定有一个包可以做到这一点,但实际上我无法找到它......
你可以使用keepaspectratio
键,将你的图形定义为:
\includegraphics[width=10cm,height=10cm,keepaspectratio]{image}
MWE的情况如下:
\documentclass{article}
\usepackage{graphicx}
\begin{document}
\includegraphics[width=2cm,height=3cm,keepaspectratio]{./graphics/amato}
\includegraphics[width=2cm,height=3cm,keepaspectratio]{./graphics/cardtrick}
\end{document}
用不同长宽比的图片进行实验,看看效果如何。
你可以使用graphicx
包,如下所示。
\documentclass{article}
\usepackage{graphicx}
\begin{document}
\begin{figure}
\centering
\includegraphics[width=\textwidth]{imagefile.pdf}
\caption{Caption of the figure}
\end{figure}
\end{document}
imagefile.pdf
是你的图文件的文件名,它可以是.png, .jpg......等。