Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I'm modified the following code from this post to add a couple of vertical watermarks on a page. However, the code places these watermarks on every page.

Is there a way to restrict watermarking to the first page or certain pages of my 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}
share|improve this question
add comment

5 Answers

The background package allows you to do this easily; simply use the some package option together with the \BgThispage command for those pages which should exhibit the watermark; the package also allows you to control all the aspects of the watermark (opacity, color, scale, placement, etc.). A little example:

\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}
share|improve this answer
add comment

You can use directly atbegshi

\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}

A simpler code, that avoids guessing the number 515 is

\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}}}%
}}

Or, with eso-pic,

\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}

Note that the picture package allows for directly using dimensions in the picture commands.

share|improve this answer
add comment

Here is a command that I use frequently for watermarks. It also uses eso-pic. It puts the contents at the center of the text block.

  • \WaterMark{<picture>} - puts watermark on ever page (can be stopped with \ClearShipoutPictureBG)

  • \WaterMark*{<picture>} - puts watermark on single page

It is also useful if you want to put a logo watermark on every page (use Gimp to downtone the picture)

\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}
share|improve this answer
add comment

I recommended to use pdftk for such things. If watermark.pdf is the (LaTeX generated) watermark (1 page) with an additional empty page and mydocument.pdf is the (may be LaTeX generated) own document, you can can "watermark" it:

pdftk mydocument.pdf multibackground watermark.pdf output mydocumentwatermark.pdf
share|improve this answer
add comment

I use the following, which does what I want, and seems to satisfy your needs as well:

 \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}}}}}
 }
}

If you want the 'draft' watermark on the first page only, simply use the asterisk as shown below:

 \AddToShipoutPicture*{%
share|improve this answer
1  
Seems to be simular to egregs answer? Only the star version is new. –  Kurt Aug 11 '13 at 16:45
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.