![插入图像,并在边距之外覆盖文本作为标题](https://linux22.com/image/374783/%E6%8F%92%E5%85%A5%E5%9B%BE%E5%83%8F%EF%BC%8C%E5%B9%B6%E5%9C%A8%E8%BE%B9%E8%B7%9D%E4%B9%8B%E5%A4%96%E8%A6%86%E7%9B%96%E6%96%87%E6%9C%AC%E4%BD%9C%E4%B8%BA%E6%A0%87%E9%A2%98.png)
答案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}