使用下面的代码时,我遇到了奇怪的行为。我的目标是将图像作为背景并居中。当我运行 pdflatex 时,背景图像发生了偏移(图像 1)。当我再次运行 pdflatex(.tex 没有任何变化)时,位置是正确的(不再有背景颜色 - 象牙色,可见)。有什么想法吗?
非常感谢您的回答。
\documentclass[a4paper]{book}
\usepackage[utf8]{inputenc}
\usepackage{adjustbox}
\usepackage{geometry}
\usepackage{graphicx}
\usepackage{tikz}
\usepackage{xcolor}
\usetikzlibrary{patterns}
\usetikzlibrary{patterns.meta}
\usetikzlibrary{shapes.geometric}
\title{Background Test Album}
\author{XXX}
\date{XXX}
\geometry{
paperwidth = 210mm,
paperheight = 297mm,
top = 19mm,
bottom = 36.7mm,
left = 19mm,
right = 13.2mm
}
\definecolor{PTAHcolor0}{HTML}{FFFFF0}
\begin{document}
\pagecolor{PTAHcolor0}
\noindent
\tikz[remember picture, overlay] \node[inner sep=0] at(current page.center) {\resizebox{\paperwidth}{\paperheight}{\includegraphics{images/back1.png}}};
\noindent\adjustbox{max width=\textwidth, max height=\textheight}{\begin{tikzpicture}
\node[minimum width=\textwidth, minimum height=\textheight] {};
\node[] at(0.0mm, 0.0mm) {\includegraphics[width=177.8mm, height=241.3mm, keepaspectratio]{photos/woman.jpg}};
\end{tikzpicture}}
\end{document}