删除 eso-pic 制作的指定水印

删除 eso-pic 制作的指定水印

\AddToShipoutPictureBG我通过from 包构建了四个水印,eso-pic如下面的代码所示。

然后我想从第 3 页删除waterpint-1和。我知道可以清除所做的内容,但这个宏将清除所有内容。waterprint-2\ClearShipoutPictureBG\AddToShipoutPictureBG

所以我的问题是:如何删除 eso-pic 制作的指定水印?有没有办法,例如,给每个水印起一个名字,然后按名字删除水印?像这样:

\waterprinton{name1,name2}  
add waterprint here
...
other content
...
\waterprintoff{name1,name2} 

代码:

\documentclass[a4paper]{article}
\usepackage{eso-pic,picture,color}
\begin{document}
\color{red}
\AddToShipoutPictureBG{\AtTextUpperLeft{\parbox{12em}{waterprint-1}}}
\AddToShipoutPictureBG{\AtTextLowerLeft{\parbox{12em}{waterprint-2}}}
\AddToShipoutPictureBG{\AtPageCenter{\parbox{12em}{waterprint-3}}}
\AddToShipoutPictureBG{\AtPageLowerLeft{\parbox{12em}{waterprint-4}}}
fist page
\clearpage
second page
\clearpage
third page
\clearpage
fourth page
\end{document}

答案1

您可以使用命令或布尔值

\documentclass[a4paper]{article}
\usepackage{eso-pic,color,etoolbox}
\newcommand\lylI{\AtTextUpperLeft{\parbox{12em}{waterprint-1}}}
\newbool{lylshow}
\booltrue{lylshow}
\begin{document}
\color{red}
\AddToShipoutPictureBG{\lylI}
\AddToShipoutPictureBG{\ifbool{lylshow}{\AtTextLowerLeft{\parbox{12em}{waterprint-2}}}{}}
\AddToShipoutPictureBG{\AtPageCenter{\parbox{12em}{waterprint-3}}}
\AddToShipoutPictureBG{\AtPageLowerLeft{\parbox{12em}{waterprint-4}}}
fist page
\clearpage
\boolfalse{lylshow}
second page
\clearpage
\booltrue{lylshow}
third page
\renewcommand\lylI{}

\clearpage
fourth page
\end{document}

相关内容