![第二页上的 tikzpicture 图像](https://linux22.com/image/370311/%E7%AC%AC%E4%BA%8C%E9%A1%B5%E4%B8%8A%E7%9A%84%20tikzpicture%20%E5%9B%BE%E5%83%8F.png)
此 tex 文件在第二页上生成了一个全宽的蓝色方块图像,该图像位于完全空白的页面之后。是什么原因导致了多余的页面,以及如何防止这种情况发生?
\documentclass{article}
\usepackage{graphicx}
\usepackage[margin=0cm]{geometry}
\usepackage{tikzpagenodes}
\setlength{\parindent}{0pt}
\setlength{\parskip}{0pt}
\begin{document}
\begin{tikzpicture}
\node[inner sep=0pt] (blue) at (0,0)
{\includegraphics[width=\paperwidth]{b0.jpg}};
\end{tikzpicture}%
\end{document}
pdfTeX 3.14159265-2.6-1.40.16(TeX Live 2015/Debian)
pgf 3.0.1a
答案1
尝试
\documentclass{article}
\usepackage{graphicx}
\usepackage[margin=0cm]{geometry}
\usepackage{tikzpagenodes}
\setlength{\parindent}{0pt}
\setlength{\parskip}{0pt}
\usepackage{eso-pic}
\begin{document}
\AddToShipoutPictureBG*{%
\AtPageLowerLeft{%
\begin{tikzpicture}
\node[inner sep=0pt] (blue) at (0,0)
{\includegraphics[width=\paperwidth]{example-image-10x16}};
\end{tikzpicture}}}
%
~\clearpage
second page
\end{document}
如果您确实只想要一页,请删除\clearpage
其下面的内容。
答案2
我无法重现您的问题...如果您喜欢将此图片放在页面中心,看看这是否是您想要的:
\documentclass{article}
\usepackage[demo]{graphicx}
\usepackage[margin=0cm]{geometry}
\usepackage{tikzpagenodes}
\setlength{\parindent}{0pt}
\setlength{\parskip}{0pt}
\begin{document}
\begin{tikzpicture}[remember picture,overlay]
\node[inner sep=0pt] (blue) at (current page.center) {\includegraphics[width=\paperwidth]{b0.jpg}};
\end{tikzpicture}%
\end{document}
您至少需要编译两次。
附录:全页图片:
\documentclass{article}
\usepackage[demo]{graphicx}
\usepackage[margin=0cm]{geometry}
\usepackage{tikzpagenodes}
%\setlength{\parindent}{0pt}
%\setlength{\parskip}{0pt}
\begin{document}
\begin{tikzpicture}[remember picture,overlay]
\node[inner sep=0pt] (blue) at (current page.center) {\includegraphics[width=\paperwidth,height=\paperheight]{b0.jpg}};
\end{tikzpicture}%
\end{document}