I use
\inclugraphics[scale=TRYING TO GUESS THE NUMBER FOR PAGE WIDTH]{...}
but I find this errorsome, is there some ready flag to set the image to page width? I usually use PNG and JPG photos.
graphicsscaling
I use
\inclugraphics[scale=TRYING TO GUESS THE NUMBER FOR PAGE WIDTH]{...}
but I find this errorsome, is there some ready flag to set the image to page width? I usually use PNG and JPG photos.
Best Answer
Use
\textwidth
for the width of the text block, and\paperwidth
if you want to fit it into the paper width. You could also use\linewidth
if you want to fit the image within the line width, which may vary depending on the environment you're in (for example, within a list likeenumerate
).Note that if you use
\includegraphics
outside afigure
ortable
environment, you might want to prepend it with\noindent
to avoid the image being pushed over to the right by\parindent
. Also, centering the image within the page width (when using\paperwidth
) is best obtained usingor
In both instances it typesets a box of width
\textwidth
, while the contents may stretch outside this width (given bywidth=\paperwidth
). Fixing it to\textwidth
avoidsOverfull \hbox warnings
.This works as expected within the
article
andreport
document class, while some horizontal re-adjustment is required inbook
. For completeness, and without resorting to page numbering issues that may occur at shipout if the image is placed near a page break, the following\centerimg[<options>]{<image>}
command works for all standard document classes, includingbook
:The horizontal adjustment for
book
(obtained via\adjustimg
) depends on whether the page number is odd or even. The above MWE, with thetiger
image, compiles to the output: