我想隐藏某些页面上的文档水印,但是不指定页码(例如使用 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}