1

I'm having an image which I need to display so that it takes up most of a page (the total width of the page to be exact). The picture itself has a larger width than height and is so big in width that it is bigger than the width of the page.

My problems so far have been that I didn't manage to let the image start (left side of the page) exactly at the start of the page and go until the right border of the page (height is no matter there as the height is smaller ofr the picture and it will be vertically centered).

Even with width=\papwerwidth the pic didnt start at one border and go to the other one (also used \noindent). So question is what can I do to fullfill my target there?

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

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

\begin{document}
\newpage
\includegraphics{xyz.jpg}
\end{document}

Edit: [width=\paperwidth] added tot the includegraphics scales thee image but part of it is truncated I guess thanks to the image starting not at the left border.

Thomas
  • 435
  • 1st. Question: Why would you do that? 2nd. question: Have you considered, that there is a margin width, which is the source of the horizontal offset? –  Jul 22 '14 at 19:10
  • 3rd issue: Please post a MWE instead of fragments –  Jul 22 '14 at 19:12
  • \noindent is the command to keep text/content at the left margin of a page, but it does not shift it even more to the left. You probably need an awkward \hspace{-\evensidemargin} or something like that. –  Jul 22 '14 at 19:17
  • 1
    @ChristianHupfer as used in an answer to the OP's previous question a minute or two ago:-) – David Carlisle Jul 22 '14 at 19:20
  • 1
    @DavidCarlisle: I am confused! Is there a similar question? I had no idea –  Jul 22 '14 at 19:22
  • @Christian Hupfer I added the missing begin/end tags (not used still to latex so forgeting time and again what is important there...only my second day using latex^^). As for why: I need it for a cover page and also in between graphic pages. The graphics are no charts,... but pieces of art as the book I'm writing is a sourcebook for a rpg.

    The mentioned question: http://tex.stackexchange.com/questions/192718/centering-an-image-vertically?noredirect=1#comment445048_192718

    – Thomas Jul 22 '14 at 19:23
  • @ThomasE. Perhaps the wallpaper package is what you need? See http://www.ctan.org/pkg/wallpaper, although it's about 8 years old already –  Jul 22 '14 at 19:25
  • @Christian Hupfer \ThisCenterWallPaper{1}{ImageDragonPowers.jpg} functions quite nicely will use that for a few pics there. Although there is still a slight white border left and right(have one pic where that would be a problem). in addition: Is there also a possibility to use that without resorting to a wallpaper (with wallpaper it seems like I need to write something on the page that the wallpaper is on)? – Thomas Jul 22 '14 at 19:33
  • Do you mean your image must fill the whole width of the physical page? – Bernard Jul 22 '14 at 19:45
  • @bernard exactly it must start at the left border and end at the right border of the page – Thomas Jul 22 '14 at 19:47
  • not exactly @werner as one main problem for me there is to get the picture to start at the border and end at the border (which pagewidth alone doesn't accomplish (surprisingly)x – Thomas Jul 23 '14 at 04:22

1 Answers1

1

Here is a solution, the requires the ifoddside package. The idea is to put the insertion point at the exact center of the physical with an invisible rule, then insert the picture scaled to paper width ant put in a box of zero width:

     \documentclass[a4paper]{book}

    \usepackage[utf8]{inputenc}
    \usepackage[nomarginpar]{geometry}
    \usepackage{graphicx}
    \usepackage{ifoddpage}

    \newlength{\relevantmargin}
    \newcommand\insertpaperwidth[1]{%
    \checkoddpage\setlength{\relevantmargin}{\ifoddpageoroneside\oddsidemargin%
    \else\evensidemargin\fi}
    \par\noindent\hspace*{\dimexpr 0.5\paperwidth-1in -\hoffset -\relevantmargin\relax}%
    \makebox[0pt]{\includegraphics[width = \paperwidth]{#1}}}%

    \usepackage{lipsum}

    \begin{document}

     \lipsum[1-4]
     \vspace{2ex}

    \insertpaperwidth{Piero_di_Cosimo_1}

    \lipsum[5]\vspace{2ex}

    \insertpaperwidth{Piero_di_Cosimo_1}

    \end{document} 

enter image description here

Bernard
  • 271,350
  • You don't need the rule, but just \noindent\hspace*{-\dimexpr 1in+\hoffset+\relevantmargin}\makebox[0pt][l]{...} – egreg Jul 22 '14 at 22:52
  • Perfectly right. It's there because I first checked with my viewer and a rule of width 1pt that it was really the physical centre of the page. I'll change the code at once. – Bernard Jul 22 '14 at 22:56