答案1
eso-pic
以下是带有及其命令的简单代码\AddToShipoutPictureBG*
。带星号的命令版本仅添加一次图像。此外,我们使用该 titling
包方便地放置标题并将其设置为白色粗体字符,而不会产生副作用。
\documentclass[12pt, a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{fourier, erewhon}
\usepackage{geometry}
\usepackage{lipsum}%
\usepackage{titling}
\setlength{\droptitle}{-12ex}
\renewcommand{\maketitlehooka}{\color{white}\bfseries}
\usepackage{eso-pic}
\usepackage{adjustbox}
\AddToShipoutPictureBG*{%
\AtPageUpperLeft{\adjincludegraphics[width=\paperwidth, valign=t]{Paul_Gauguin}}
}%
\title{D’où venons-nous ? Que sommes nous ? Où allons-nous ?}
\author{Paul Gauguin (1897)}
\date{}
\begin{document}
\maketitle
\lipsum[1-15]
\end{document}
答案2
使用,通过宏\atxy{<x>}{<y>}{<content>}
实现,其中和是相对于纸张左上角的坐标。everypage
\AddThispageHook
<x>
<y>
\documentclass[10pt,a4paper]{report}
%% Graphics
\usepackage{graphicx,xcolor}
\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}}}}
\atxy{0in}{0in}{\raisebox{-\height}{\includegraphics[height=2in,width=\paperwidth]{example-image}}}
\atxy{.5\paperwidth}{\dimexpr1in+8pt\relax}{\makebox[0pt]{%
\Huge\color{red!90!black}\bfseries This is my added header test}}
\begin{document}
%% Titlepage
\vspace*{.2in}
\lipsum[1]
\end{document}