添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
相关文章推荐
高大的香蕉  ·  JS Math.random() ...·  1 年前    · 
开朗的花生  ·  c++ - OpenCV 2.4.2 ...·  1 年前    · 
爱运动的灌汤包  ·  Azure Functions ...·  1 年前    · 
玉树临风的弓箭  ·  Add new item to ...·  2 年前    · 

Stack Exchange Network

Stack Exchange network consists of 183 Q&A communities including Stack Overflow , the largest, most trusted online community for developers to learn, share their knowledge, and build their careers. Visit Stack Exchange

TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It only takes a minute to sign up.

Sign up to join this community

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

The width and height keys can be used without the other, in which case the aspect ratio of the image is kept and it is just scaled to that width or height, respectively. So \includegraphics[width=\textwidth]{<file>} and \includegraphics[height=\textheight]{<file>} will both keep the aspect ratio.

Another usage would be to use both simultaneously, in which case the image will get distorted to match both dimensions, having the specified width and height , so \includegraphics[width=\textwidth,height=\textheight]{<file>} will have exactly those dimensions.

The third variant is to use both and additionally the keepaspectratio option. In this case the image will keep its aspect ratio and will be scaled such that it is as big as possible without having a bigger width or height than the specified values, so \includegraphics[keepaspectratio,width=\textwidth,height=\textheight]{<file>} will have the biggest possible size while staying in those constraints without being distorted.

An example document using the three variants:

\documentclass[]{article}
\usepackage[]{graphicx}
\begin{document}
\includegraphics[width=5cm]{example-image-duck}
\includegraphics[height=4cm]{example-image-duck}
\includegraphics[width=5cm,height=4cm]{example-image-duck}
\includegraphics[keepaspectratio,width=5cm,height=4cm]{example-image-duck}
\end{document}