2

I am producing a two-column document that will have full page-width header images on various pages.

\documentclass[12pt,a4paper,twocolumn]{article}
\usepackage{graphicx,tikz,lipsum,fancyhdr}
\usetikzlibrary{calc}

\fancypagestyle{head}{%
    \fancyhead{
        \begin{tikzpicture}[remember picture,overlay]
            \node[inner sep=0pt,anchor=north] at (current page.north) {\includegraphics[width=\paperwidth,height=15cm]{example-image-a}};
        \end{tikzpicture}
    }
}

\begin{document}
\thispagestyle{head}
\lipsum[3-56]
\end{document}

enter image description here

I would like to increase the top margin to have the text start below the image. I have two questions:

  1. what is the best way to make a change to the margin that affects only the page on which \thispagestyle is invoked? I know that I can use \newgeometry and \restoregeometry to change the margins of arbitrary pages, but it seems like quite an awkward solution because this ends up affecting adjacent pages unless I pay close attention to exactly where the commands are situated relative to the automatically generated pagebreaks. Is there a way to say "only change the geometry for the single page affected by \thispagestyle"?
  2. the header images will all have different aspect ratios, meaning that they will have different heights when displayed at \paperwidth. Is there a way to automatically adjust the margin each time to accommodate the height of the image in question?

Alternatively, perhaps there is a better way of including a full-page width image at the top of a page than putting it into a header?

  • I discovered the changepage package. By putting \changepage{-16.5cm}{}{}{}{}{16.5cm}{}{}{} inside the fancypagestyle definition, I can add (in this e.g.) 16.5cm to the top margin. The -16.5cm argument is supposed to shrink the textheight to compensate for the space lost to the increased margin. But instead, the textheight remains unchanged and the text runs of the bottom of the page... – Ubiquitous Apr 28 '18 at 21:47

Your Answer

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

Browse other questions tagged or ask your own question.