0

I have an image which spans the paperwidth. I have added the image by setting its width = \paperwidth and anchoring it at (current page.north) or at (current page.center) using tikz. Now to align the top edge of the image I had to manually add a yshift with trial and error to make it work. Is there any way in which the image can be made to align to the top of the page automatically? I have several images of varying heights and hence doing this manually would mean to adjust yshift for each image separately. I tried to use shift={(current page.north) along the line suggested here, but somehow it leaves a small gap between the top and the image. How do I achieve this without a manual adjustment?

MWE

\documentclass{article}

\usepackage{tikz}

\begin{document}
\begin{tikzpicture}[remember picture,overlay] 
 \node  [yshift=-9.45cm] at (current page.north) {\includegraphics[width=\paperwidth]{Rose.jpg}};
\end{tikzpicture}


\end{document}

Source for the image: https://upload.wikimedia.org/wikipedia/commons/a/ac/Rose_hip_02_ies.jpg

0
2

Using the options anchor=north, inner sep=0pt seems to place it at the correct spot:

enter image description here

I have included the showframe package so that it is clear where the normal text would go.

Note:

  • The small gray border is an artifact of the image capture process.

Code:

\documentclass{article}

\usepackage{tikz}
\usepackage{showframe}

\begin{document}
\begin{tikzpicture}[remember picture,overlay] 
 \node  [anchor=north, inner sep=0pt] at (current page.north) 
     {\includegraphics[width=\paperwidth]{../images/Rose.jpg}};
\end{tikzpicture}%

\end{document}
1
  • [below] also works. Still need [inner sep=0pt] of course. Now, trying to avoid writing over the top is a bit tricky. Jul 14 at 3:33

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.