Sign up ×
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.

Possible Duplicate:
Shrink figure only when necessary?

Consider that you have this:


This will now take its original width, but if you want it to take up 100% of the text width you do it like this:


How about if you want to include images and use their original size if they fit, otherwise have it resized?

In this example, the second image should get [width=\textwidth] because it is going to exceed the bounds of the document.

share|improve this question

marked as duplicate by Werner, Peter Grill, qubyte, Joseph Wright Jan 21 '12 at 9:19

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

2 Answers 2

up vote 11 down vote accepted

The adjustbox package provides a max width=\textwidth key option for this. So, you can use

\includegraphics[max width=\textwidth]{some_image_in_pdf.pdf}
\includegraphics[max width=\textwidth]{some_image_in_pdf_that_is_too_wide.pdf}
share|improve this answer
Does not work in twocolumn mode of document class book. – gentlesea Nov 22 at 7:23
@gentlesea: For twocolumn mode you're probably interested in max width=\columnwidth. – Werner Nov 22 at 12:24

works also for images which are wrongly set to a width greater than the text width:

\parindent=0pt % for demo


share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.