![不使用页码即可隐藏某些页面上的水印](https://linux22.com/image/404254/%E4%B8%8D%E4%BD%BF%E7%94%A8%E9%A1%B5%E7%A0%81%E5%8D%B3%E5%8F%AF%E9%9A%90%E8%97%8F%E6%9F%90%E4%BA%9B%E9%A1%B5%E9%9D%A2%E4%B8%8A%E7%9A%84%E6%B0%B4%E5%8D%B0.png)
我想隐藏某些页面上的文档水印,但是不指定页码(例如使用 xwatermarkpages
选项)。
由于对于长文档来说计算页数不方便,我想建立一个宏来\nowaterpage
隐藏发出命令的页面上的水印?
另请注意,我的文档包含图像,因此我需要在它们上显示水印。
以下是基于的 MWE xwatermark
:
\documentclass{beamer}
\usetheme{Madrid}
\usepackage{tikz}
\usepackage[printwatermark]{xwatermark}
\newsavebox{\wmark}
\sbox{\wmark}{
\parbox{1cm}{\tikz[color=pink,opacity=0.4]\node{Draft};\\%
\tikz[color=pink,opacity=0.5]\node{Do not distribute};}}
\newwatermark*[allpages, angle=30, scale=3, xpos=-35, ypos=-10]{\usebox\wmark}
\begin{document}
\begin{frame}
I want a watermark everywhere
\end{frame}
\begin{frame}
Except here
\end{frame}
\end{document}
答案1
不要假设第三张幻灯片。使用选项pagex={1,2,4,5,6}
一种方法如下:
\documentclass{beamer}
\usetheme{Madrid}
\usepackage{tikz}
\usepackage[printwatermark]{xwatermark}
\newsavebox{\wmark}
\sbox{\wmark}{
\parbox{1cm}{\tikz[color=pink,opacity=0.4]\node{Draft};\\%
\tikz[color=pink,opacity=0.5]\node{Do not distribute};}}
\newwatermark*[pagex={1,2,4,5,6}, angle=30, scale=3, xpos=-35, ypos=-10]{\usebox\wmark}
\begin{document}
\begin{frame}
I want a watermark everywhere \insertframenumber
\end{frame}
\begin{frame}
I want a watermark everywhere \insertframenumber
\end{frame}
\begin{frame}
Except here \color{red}\insertframenumber
\end{frame}
\begin{frame}
I want a watermark everywhere \insertframenumber
\end{frame}
\begin{frame}
I want a watermark everywhere \insertframenumber
\end{frame}
\begin{frame}
I want a watermark everywhere \insertframenumber
\end{frame}
\end{document}
替换为
\newwatermark*[pagex={1,2,4,5,6}, angle=30, scale=3, xpos=-35, ypos=-10]{\usebox\wmark}
或者
\newwatermark*[pages=1-2, angle=30, scale=3, xpos=-35, ypos=-10]{\usebox\wmark}
\newwatermark*[pages=4-6, angle=30, scale=3, xpos=-35, ypos=-10]{\usebox\wmark}
输出:
编辑: 建议
\documentclass{beamer}
\usetheme{Madrid}
\usepackage{tikz}
\setbeamertemplate{background canvas}{%
\ifnum \insertframenumber=3
\else
\begin{tikzpicture}[remember picture,overlay]
\draw ([shift={(0,4.5)}]current page.south) node[color=pink,opacity=0.5,align=left,rotate=45,scale=2.5] {Draft\\[5mm] Do not distribute};
\end{tikzpicture}
\fi
}
\begin{document}
\begin{frame}
I want a watermark everywhere \insertframenumber
\end{frame}
\begin{frame}
I want a watermark everywhere \insertframenumber
\end{frame}
\begin{frame}
Except here \color{red}\insertframenumber
\end{frame}
\begin{frame}
I want a watermark everywhere \insertframenumber
\end{frame}
\begin{frame}
I want a watermark everywhere \insertframenumber
\end{frame}
\begin{frame}
I want a watermark everywhere \insertframenumber
\end{frame}
\end{document}