TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question
\includegraphics[width=\textwidth]{...} – egreg Dec 22 '11 at 21:56
Simply use width=\textwidth to scale it to the width of the text area, as egreg already noted. (The whole page would be \paperwidth and would cause an overfull error.) You should have a look at the Graphic Guide for all the possible options for \includegraphics. Also check the adjustbox package which adds several more options to it. – Martin Scharrer Dec 22 '11 at 22:03
Similar question in SO here, contacted mod to look for this. Perhaps merging? – hhh Dec 26 '11 at 21:46
up vote 99 down vote accepted

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 like enumerate).

Note that if you use \includegraphics outside a figure or table 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 using




In both instances it typesets a box of width \textwidth, while the contents may stretch outside this width (given by width=\paperwidth). Fixing it to \textwidth avoids Overfull \hbox warnings.

This works as expected within the article and report document class, while some horizontal re-adjustment is required in book. 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, including book:


\newcommand{\adjustimg}{% Horizontal adjustment of image
\newcommand{\centerimg}[2][width=\textwidth]{% Center an image

\mbox{} \par


\mbox{} \par

The horizontal adjustment for book (obtained via \adjustimg) depends on whether the page number is odd or even. The above MWE, with the tiger image, compiles to the output:

enter image description here

share|improve this answer
I don't think the \paperwidth works other than in the article class, provided no change is made to the pagination parameters. – egreg Dec 22 '11 at 22:03
Better would be \makebox[\textwidth]{\includegraphics[width=\paperwidth]{...}} (see Center figure that is wider than \textwidth) or \includegraphics[width=\paperwidth,center]{...} with \usepackage[export]{adjustbox}. – Martin Scharrer Dec 22 '11 at 22:06
@egreg: I'm using it with success in tex.stackexchange.com/questions/23860/… and it works with memoir as well. – Martin Scharrer Dec 22 '11 at 22:14
@egreg: Do you know the horizontal length causing the difference in book? – Werner Dec 22 '11 at 22:18
It depends on whether the page is odd or even: \oddsidemargin and \evensidemargin. Look at package layout for getting a nice drawing. However the problem is to know what's the page number! – egreg Dec 22 '11 at 22:23

This worked for me

      \caption{Normal Case: 1 Request \& 1 Response.}
share|improve this answer
figure is a float and is therefore not directly typeset inside the current environment, but rather floats to the next best position. Therefore putting it into a center environment doesn't make sense and doesn't result in a centered image. For this the \centering macro is used inside figure as you also did. – Martin Scharrer Jan 18 '13 at 8:11
Thanks Martin! – Mayank Agarwal Jan 20 '13 at 10:56

I used pdfpages package to include a png. Simple and effective. Fills the entire page with the graphic.


Happy TeXing!

share|improve this answer

Maybe you should work with the easyfig package from Martin Scharrer : CTAN.

Or, maybe, look at this post post where I've ask a similar question (I think at least).


share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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