I'm currently having a few problems with centering an image on a page (both vertically and horizontally) while enlarging the image so that it is taking the whole width of the page.

I'm managing to center the picture horizontally, but not vertically. The code below shows the version I made that centers the image horizontally. My question is here what can I do to center it also vertically?

I'm having an srcbook class .tex:



I'm currently positioning the image like this:

  • before the \centerline (which isn't the most "latexy" way to do this), add \vspace*{\fill} and add \vspace{\fill} after it. the starred version will keep the space from disappearing at the top of a page. as for the \centerline, that's a holdover from plain tex. a "better" way (or at least one with better latex syntax) is to use \begin{center} ... \end{center} to "wrap" it. – barbara beeton Jul 22 '14 at 18:42

\centerline takes an argument so in


the argument is just \noindent

so it is equivalent to


so you get one blank white line from the \centerline then an overfull box with the image.

possibly you want


I am assuming here you did intend your image to be as wide as the paper not just as wide as the text block, so covering both margins.

| improve this answer | |
  • the last part results in an compile error for me (runaway argument file ended while scanning \@imakebox (seemingly at \includegraphics)) – Thomas Jul 22 '14 at 18:47
  • @ThomasE. was missing a } If you had supplied a test file in your question I'd have tested it:-) – David Carlisle Jul 22 '14 at 18:49
  • tnx functions that way. albeit a bit smaller in width than pagewidth – Thomas Jul 22 '14 at 18:51
  • tnx = thank you (sry did take up on that shortcut for thank you thanks to MMORPGs). Found an issue with how the graphics is displyed, but that has nothing to do with the original question and the answer to it. will probably make a second question there if I can't solve the problem. So thank you again for the answer helped a lot there! – Thomas Jul 22 '14 at 19:00
  • ah......... :-) – David Carlisle Jul 22 '14 at 19:01

How to prove?



\immediate\write18{pdflatex foo}
\immediate\write18{pdftops -f 1 -l 1 -eps foo.pdf}




enter image description here

| improve this answer | |
  • \centering will not do anything if the image is wider than \textwidth as in the OP's case. – David Carlisle Jul 22 '14 at 18:58
  • @DavidCarlisle: I see. In this answer I mainly just concentrated on the vertical alignment. – kiss my armpit Jul 22 '14 at 19:01
  • Thanks PSTricks for helping me to prove it geometrically. – kiss my armpit Jul 22 '14 at 19:08

The image can easily be centered horizontally and vertically via package pdfpages. It also enlarges the image as much as possible to fit into the paper area without distorting the image.





Option BCOR is not taken into account, when placing the image. Some white space can be added to the left or right of the image via option trim:

\includepdf[trim=-5mm 0 -8mm 0]{MyImage.jpg}

Would add a white margin of 5mm to the left and 8mm to the right of the unscaled image.

| improve this answer | |

Try this

| improve this answer | |
  • 1
    that will be over full (and not centred) in the usual case that \paperwidth is greater than \textwidth – David Carlisle Jul 22 '14 at 18:43

You can try to use TikZ:

    \begin{tikzpicture}[remember picture, overlay]
        \node [inner sep = 0] at (current page.center) {\includegraphics[width=\paperwidth]{image.jpg}};
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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