考虑以下代码:
\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}
带输出