仅第一页有水印

仅第一页有水印

我修改了以下代码这个帖子在页面上添加几个垂直水印。但是,代码将这些水印放在每一个页。

有没有办法将水印限制在我的书籍的第一页或某些页面上amsbook

\documentclass{amsbook}
\usepackage{graphicx}
\usepackage{eso-pic}

\makeatletter
\AddToShipoutPicture{%
\setlength{\@tempdimb}{.5\paperwidth}%
\setlength{\@tempdimc}{.5\paperheight}%
\setlength{\unitlength}{1pt}%
\protect{\put(\strip@pt\@tempdimb,\strip@pt\@tempdimc){%
\makebox(-515,0){\rotatebox{90}{\textcolor[gray]{0.90}%
   {\Huge Draft:  \today}}}
\makebox(515,0){\rotatebox{270}{\textcolor[gray]{0.90}%
   {\Huge  Draft:  \today}}}}}}
\makeatother

\begin{document}

Hi
\newpage
Hi, again.

\end{document}

答案1

背景软件包可让您轻松完成此操作;只需将some软件包选项与\BgThispage应显示水印的页面的命令一起使用即可;软件包还允许您控制水印的所有方面(不透明度、颜色、比例、位置等)。一个小例子:

\documentclass{amsbook}
\usepackage{graphicx}
\usepackage[some]{background}

\SetBgScale{1}
\SetBgContents{\parbox{10cm}{%
  \Huge Draft:  \today\\[14cm]\rotatebox{180}{\Huge Draft:  \today}}}
\SetBgColor{gray}
\SetBgAngle{270}
\SetBgOpacity{0.2}

\begin{document}

Hi\BgThispage
\newpage
Hi, again.

\end{document}

答案2

您可以直接使用阿特别格什

\documentclass{amsbook}
\usepackage{graphicx,color}
\usepackage{atbegshi,picture}

\AtBeginShipoutNext{\AtBeginShipoutUpperLeft{%
\setlength{\unitlength}{1pt}%
\protect{\put(.5\paperwidth,-.5\paperheight){%
\makebox(-515,0){\rotatebox{90}{\textcolor[gray]{0.90}%
   {\Huge Draft:  \today}}}%
\makebox(515,0){\rotatebox{270}{\textcolor[gray]{0.90}%
   {\Huge  Draft:  \today}}}}}}}

\begin{document}

Hi
\newpage
Hi, again.

\end{document}

一个更简单的代码,避免猜测数字 515 是

\AtBeginShipoutNext{\AtBeginShipoutUpperLeft{%
  \Huge
  \put(1cm,-.5\paperheight){%
    \rotatebox[origin=c]{90}{\textcolor[gray]{0.90}{Draft: \today}}}%
  \put(\dimexpr\paperwidth-1cm-\ht\strutbox\relax,-.5\paperheight){%
    \rotatebox[origin=c]{270}{\textcolor[gray]{0.90}{Draft: \today}}}%
}}

或者,埃索一皮克

\documentclass{amsbook}
\usepackage{graphicx}
\usepackage{eso-pic,picture}

\AddToShipoutPicture{%
\setlength{\unitlength}{1pt}%
\protect{\put(.5\paperwidth,.5\paperheight){%
\makebox(-515,0){\rotatebox{90}{\textcolor[gray]{0.90}%
   {\Huge Draft:  \today}}}%
\makebox(515,0){\rotatebox{270}{\textcolor[gray]{0.90}%
   {\Huge  Draft:  \today}}}}}\ClearShipoutPictureBG}

\begin{document}

Hi
\newpage
Hi, again.

\end{document}

请注意图片包允许在picture命令中直接使用尺寸。

答案3

这是我经常用于水印的命令。它也使用eso-pic。它将内容放在文本块的中心。

  • \WaterMark{<picture>}- 在每一页上添加水印(可以使用 停止\ClearShipoutPictureBG

  • \WaterMark*{<picture>}- 在单页上添加水印

如果你想在每一页上都添加徽标水印,它也很有用(使用 Gimp 降低图片的色调)

\documentclass{article}
\usepackage{graphicx}
\usepackage{eso-pic}
\makeatletter
\newcommand\WaterMark{%
    \@ifstar{\@WaterMarkS}{\@watermark}}
\newcommand\@WaterMark[1]{%
    \AddToShipoutPictureBG{\AtTextCenter{\NullGrphBox{#1}}}}
\newcommand\@WaterMarkS[1]{%
    \AddToShipoutPictureBG*{\AtTextCenter{\NullGrphBox{#1}}}}
\newcommand\NullGrphBox[1]{%
    \parbox[c]{0pt}{\makebox[0pt][c]{#1}}}
\makeatother

\newcommand\draftpictA{%
    \setlength{\unitlength}{1mm}%
    \begin{picture}(0,0)(0,0)
        \makebox(-180,0){\rotatebox{90}{\textcolor[gray]{0.10}%
            {\Huge Draft:  \today}}}
        \makebox(180,0){\rotatebox{270}{\textcolor[gray]{0.10}%
            {\Huge  Draft:  \today}}}
    \end{picture}}

\newcommand\draftpictB{%
     \rotatebox[origin=c]{60}{\scalebox{15}{%
        \textcolor[gray]{0.90}{\textbf{DRAFT}}}}}

\begin{document}
\WaterMark*{\draftpictB}
Hi
\newpage
Hi, again.
\newpage
xx
\end{document}

答案4

我使用下面的方法,它可以满足我的需要,而且似乎也能满足你的需求:

 \usepackage{eso-pic,graphicx}
  \definecolor{LtGrey}{rgb}{0.975,0.975,0.975}

  \AddToShipoutPicture{%
  \AtTextCenter{%
  \makebox(0,0)[c]{\resizebox{\textwidth}{!}{%
   \rotatebox{45}{\textsf{\textbf{\color{LtGrey}DRAFT}}}}}
 }
}

如果您只想在第一页上添加“草稿”水印,只需使用星号,如下所示:

 \AddToShipoutPicture*{%

相关内容