[Tex/LaTex] Centering an image vertically

graphicspositioning

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:

\documentclass[11pt,a4paper,BCOR10mm,DIV11,toc=listof,parskip=full]{scrbook}

\usepackage[english]{babel}
\usepackage[utf8x]{inputenc}
\usepackage{amsmath}
\usepackage{graphicx}
\usepackage{booktabs}            
\usepackage{multicol}   

I'm currently positioning the image like this:

\centerline\noindent\makebox[\textwidth]{\includegraphics[width=\paperwidth]{MyImage.jpg}

Best Answer

\centerline takes an argument so in

\centerline\noindent\makebox[\textwidth]{\includegraphics[width=\paperwidth]{MyImage.jpg}

the argument is just \noindent

so it is equivalent to

\centerline{\noindent}%
\makebox[\textwidth]{\includegraphics[width=\paperwidth]{MyImage.jpg}}

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

possibly you want

\vspace*{\fill}
\noindent
\hspace*{-\oddsidemargin}%
\makebox[0pt][l]{\includegraphics[width=\paperwidth]{MyImage.jpg}}
\vspace*{\fill}

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.

Related Question