![仅适用于特定页面的页面背景](https://linux22.com/image/462641/%E4%BB%85%E9%80%82%E7%94%A8%E4%BA%8E%E7%89%B9%E5%AE%9A%E9%A1%B5%E9%9D%A2%E7%9A%84%E9%A1%B5%E9%9D%A2%E8%83%8C%E6%99%AF.png)
考虑以下代码:
\documentclass{article}
\usepackage{background}
\usetikzlibrary{calc}
\usepackage{lipsum}
\backgroundsetup{
color=black,
scale=1,
opacity=1,
angle=0,
contents={\tikz\draw[line width=1pt,rounded corners,black]
( $ (current page.south east) + (-4,6) $ ) rectangle ( $ (current page.north west) + (2,2) $ );}
}
\begin{document}
\lipsum[1-4]
\newpage
\lipsum[1-8]
\end{document}
产生
问题:我怎样才能删除第一页(即前四个段落)的页面背景,并保持最后两页的页面背景不变?
谢谢。
答案1
下面的代码中有两个定义:
\documentclass{article}
\usepackage{background}
\usetikzlibrary{calc}
\usepackage{lipsum}
\def\back{\backgroundsetup{
color=black,
scale=1,
opacity=1,
angle=0,
contents={\tikz\draw[line width=1pt,rounded corners,black]
( $ (current page.south east) + (-4,6) $ ) rectangle ( $ (current page.north west) + (2,2) $ );}
}}
\def\noback{\backgroundsetup{contents={}}}
\begin{document}
\noback{\lipsum[1-4]}
\newpage
\back{\lipsum[1-8]}
\end{document}
带输出