我有一个问题,我不知道该如何解决。我希望每次翻页时背景都会翻转。这样,成对的页面将在左侧有背景边距,而受损的页面将在右侧有背景边距照片。我希望我说清楚了。
\usepackage{background} %see the background doc for more info
\backgroundsetup{%
scale=1,
angle=0,
opacity=.7,
color =black,
contents={\begin{tikzpicture}[remember picture,overlay]
\node at ([yshift=0cm,xshift=-9.7cm]current page) {\includegraphics[scale=1.10]{Margin.png}};
\end{tikzpicture}}
}
答案1
包文档的示例 4 解释了如何实现这一点。其思路是使用条件测试(根据您的具体需求调整位置和内容):
\documentclass{article}
\usepackage[contents={},opacity=1,scale=1]{background}
\usepackage{lipsum}
\AddEverypageHook{%
\ifodd\value{page}\relax%
\backgroundsetup{% settings for odd-numbered pages
angle=90,
position={1.35\textwidth,-0.5\textheight},%
contents={\includegraphics[height=3cm]{example-image-a}}
}%
\else
\backgroundsetup{% settings for even-numbered pages
angle=270,
position={0,-0.5\textheight},%
contents={\includegraphics[height=3cm]{example-image-b}}
}%
\fi%
\BgMaterial}
\begin{document}
\lipsum[1-30]
\end{document}
要省略前几页的背景材料,可以使用另一个条件;例如
\documentclass{article}
\usepackage[contents={},opacity=1,scale=1]{background}
\usepackage{lipsum}
\AddEverypageHook{%
\ifnum\value{page}>3
\ifodd\value{page}\relax%
\backgroundsetup{% settings for odd-numbered pages
angle=90,
position={1.35\textwidth,-0.5\textheight},%
contents={\includegraphics[height=3cm]{example-image-a}}
}%
\else
\backgroundsetup{% settings for even-numbered pages
angle=270,
position={0,-0.5\textheight},%
contents={\includegraphics[height=3cm]{example-image-b}}
}%
\fi%
\BgMaterial
\fi}
\begin{document}
\lipsum[1-30]
\end{document}