我正在尝试在标题页的右上角添加一个背景图像,顶部和右侧的边距为 1 厘米。
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[ngerman]{babel}
\title{Test}
\author{Test}
\date{\today}
\usepackage{eso-pic}
\usepackage[demo]{graphicx}
\providecommand*\LenToUnit[1]{#1\@gobble}
\newcommand\AtPageUpperRight[1]{\AtPageUpperLeft{
\put(\LenToUnit{0.5\paperwidth},\LenToUnit{-1cm}){#1}}
}
\begin{document}
\AddToShipoutPictureBG*{
\AtPageUpperRight{\raisebox{-\height}{\includegraphics{logo.pdf}}}
}
\maketitle
\end{document}
可以将图像右对齐吗?
答案1
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[ngerman]{babel}
\title{Test}
\author{Test}
\date{\today}
\usepackage{eso-pic}
\usepackage[demo]{graphicx}
\newcommand\AtPageUpperRight[1]{\AtPageUpperLeft{%
\makebox[\paperwidth][r]{#1}}}
\begin{document}
\AddToShipoutPictureBG*{%
\AtPageUpperRight{\raisebox{-\height}{\frame{\includegraphics[width=8cm]{Uni-Logo}}}}}
\maketitle
\end{document}
答案2
小菜一碟tikz
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[ngerman]{babel}
\title{Test}
\author{Test}
\date{\today}
\usepackage{tikz}
\begin{document}
\maketitle
\begin{tikzpicture}[remember picture,overlay]
\node[anchor=north east,inner sep=0pt] at (current page.north east)
{\includegraphics[scale=0.2]{example-image-a}};
\end{tikzpicture}
\end{document}