[Tex/LaTex] Centre an image, ignoring margins

graphicshorizontal alignmentvertical alignment

I have a document with .5cm margins; I want to include a long image which will span the width of the page, ignoring margins. I don't care about the whole image being visible (or which part of the image is visible, to be honest) so long as it spans the width. At present the image goes off the right-hand side of the page but its left edge is aligned to the margin.

\documentclass[a5paper,twoside]{article}
\usepackage{graphicx}
\usepackage[a5paper,margin=0.7in]{geometry}

\begin{document}

\newgeometry{margin=.5cm} %tiny margins

Text here.

\vfill

\begin{center}
\hspace{-1cm} \includegraphics[height=4cm]{image}
\end{center}

\vfill

Some text here (not very much).

\end{document}

Bonus question: it would also be very helpful if someone could explain how to position the image a set distance from the base of the page, as opposed to just using \vfills to space things out.

Best Answer

For horizontal placement that ignores margins, use Center figure that is wider than \textwidth. For vertical (say) 2cm from the bottom of the text block, use

\vspace*{\fill}

% Your image goes here
\noindent
\makebox[\textwidth]{\includegraphics[..]{...}}%

\vspace*{2cm}

If you have a single line of text at the bottom and you also want the image to be 2cm from the baseline, then use a strut:

\vspace*{\fill}

% Your image goes here
\noindent
\makebox[\textwidth]{\includegraphics[..]{...}}%

\rule{0pt}{2cm}Some text here (not very much).

Here's a complete MWE:

enter image description here

\documentclass[a5paper,twoside]{article}
\usepackage{graphicx}% http://ctan.org/pkg/graphicx
\usepackage[a5paper,margin=5mm,showframe]{geometry}

\begin{document}

\vspace*{\fill}

\noindent\makebox[\textwidth]{\includegraphics[width=\textwidth,height=4cm]{example-image-a}}%

\vspace*{2cm}

\newpage


\vspace*{\fill}

\noindent\makebox[\textwidth]{\includegraphics[width=\textwidth,height=4cm]{example-image-a}}%

\rule{1pt}{2cm}Some text here (not very much).

\end{document}

Note the difference in height placement when you use text with descenders.

Related Question