0

This question is related to the answer https://tex.stackexchange.com/a/235607/. The solution there, puts a given image at the top border of the first page.

How to put that image at the top border of every page?

\documentclass[10pt,a4paper]{report}
\usepackage[utf8]{inputenc}
%% Graphics
\usepackage{graphicx}
\usepackage{everypage}
\usepackage{lipsum}
% THESE ARE LaTeX DEFAULTS; CAN CHANGE IF NEEDED.
\def\PageTopMargin{1in}
\def\PageLeftMargin{1in}
\newcommand\atxy[3]{%
 \AddThispageHook{\smash{\hspace*{\dimexpr-\PageLeftMargin-\hoffset+#1\relax}%
  \raisebox{\dimexpr\PageTopMargin+\voffset-#2\relax}{#3}}}}
% VERIFIED THAT SETTING \hoffset AND \voffset DO NOT BREAK SOLUTION.
%\hoffset=0.4in
%\voffset=0.2in
\atxy{0in}{0in}{\raisebox{-\height}{\includegraphics[width=\paperwidth]{someimage.jpg}}}
\begin{document}
%% Titlepage
\vspace*{.2in}
\lipsum[1]
\newpage
\lipsum[1]
\end{document}
3
2

As I said in my comment, change \AddThispageHook to \AddEverypageHook, in the definition to \atxy. Also, I eliminated the \vspace on page 1 and instead added \usepackage[top=160pt]{geometry} to the preamble.

\documentclass[10pt,a4paper]{report}
\usepackage[utf8]{inputenc}
%% Graphics
\usepackage[top=160pt]{geometry}
\usepackage{graphicx}
\usepackage{everypage}
\usepackage{lipsum}
% THESE ARE LaTeX DEFAULTS; CAN CHANGE IF NEEDED.
\def\PageTopMargin{1in}
\def\PageLeftMargin{1in}
\newcommand\atxy[3]{%
 \AddEverypageHook{\smash{\hspace*{\dimexpr-\PageLeftMargin-\hoffset+#1\relax}%
  \raisebox{\dimexpr\PageTopMargin+\voffset-#2\relax}{#3}}}}
% VERIFIED THAT SETTING \hoffset AND \voffset DO NOT BREAK SOLUTION.
%\hoffset=0.4in
%\voffset=0.2in
\atxy{0in}{0in}{\raisebox{-\height}{\includegraphics[width=\paperwidth,
  height=140pt]{example-image}}}
\begin{document}
%% Titlepage
\lipsum[1]
\newpage
\lipsum[2]
\end{document}

enter image description here

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.