答案1
我认为您希望将存在的元素定位在每个页面上的完全相同的位置。我不确定您到底想要什么,但最好的选择可能是使用 Tikz 对元素进行绝对定位。无论如何,这是一种方法。
然后,您可以复制带有或不带有某些元素的页面。如下所示(在此代码中,我重新定义了一组坐标,使页面的中心为 0,0,并且水平和垂直方向从 -1 到 +1,如图所示 - 这可能使指定位置变得更容易 - 或者您可以使用其他方法)
类似这样的:
\documentclass{article}
\usepackage{tikz}
% ------------------
% |(-1,1) (0,1) (1,1)|
% | |
% |(-1,0) (0,0) (1,0)|
% | |
% |(-1,-1) (0,-1) (1,-1)|
% ------------------
\makeatletter
\def\parsecomma#1,#2\endparsecomma{\def\page@x{#1}\def\page@y{#2}}
\tikzdeclarecoordinatesystem{page}{
\parsecomma#1\endparsecomma
\pgfpointanchor{current page}{north east}
% Save the upper right corner
\pgf@xc=\pgf@x%
\pgf@yc=\pgf@y%
% save the lower left corner
\pgfpointanchor{current page}{south west}
\pgf@xb=\pgf@x%
\pgf@yb=\pgf@y%
% Transform to the correct placement
\pgfmathparse{(\pgf@xc-\pgf@xb)/2.*\page@x+(\pgf@xc+\pgf@xb)/2.}
\expandafter\pgf@x\expandafter=\pgfmathresult pt
\pgfmathparse{(\pgf@yc-\pgf@yb)/2.*\page@y+(\pgf@yc+\pgf@yb)/2.}
\expandafter\pgf@y\expandafter=\pgfmathresult pt
}
\makeatother
\begin{document}
\clearpage
\thispagestyle{empty}
\begin{tikzpicture}[remember picture,overlay,every node/.style={anchor=center}]
\node [fill = green, anchor = west, minimum height = 6mm, minimum width = 0.4\paperwidth, align = flush left, inner xsep = 3mm, text width=0.40\paperwidth-5mm] at (page cs:-0.2,0.0) {The cat sat on the mat etc etc the dog sat on the cat and the pig sat with the frog The cat sat on the mat etc etc the dog sat on the cat and the pig sat with the frog};
\node [fill = yellow, anchor = north, minimum height = 6mm, minimum width = 0.7\paperwidth, align = flush left, inner xsep = 3mm, text width=0.70\paperwidth-5mm] at (page cs:0.0,0.9) {The cat sat on the mat etc etc the dog sat on the cat and the pig sat with the frog The cat sat on the mat etc etc the dog sat on the cat and the pig sat with the frog};
\node [fill = yellow, anchor = north, minimum height = 6mm, minimum width = 0.7\paperwidth, align = flush left, inner xsep = 3mm, text width=0.70\paperwidth-5mm] at (page cs:0.0,0.7) {The cat sat on the mat etc etc the dog sat on the cat and the pig sat with the frog The cat sat on the mat etc etc the dog sat on the cat and the pig sat with the frog};
\node [fill = yellow, anchor = north, minimum height = 6mm, minimum width = 0.7\paperwidth, align = flush left, inner xsep = 3mm, text width=0.70\paperwidth-5mm] at (page cs:0.0,-0.7) {The cat sat on the mat etc etc the dog sat on the cat and the pig sat with the frog The cat sat on the mat etc etc the dog sat on the cat and the pig sat with the frog};
\end{tikzpicture}
\clearpage
\end{document}