[Tex/LaTex] Draft watermark in both margins using the background package

backgroundstikz-pgfwatermark

I tried to adapt How to add “DRAFT” along the left/right margin? to have symmetrical "DRAFT"s along both margins, one running down the right margin, and one running down the left margin. Trying the obvious thing of using \backgroundsetup twice doesn't work – only the second one is printed.

I tried an approach based on How do you add multiple watermarks?, but had trouble getting it to work.

Here is my code based on the approach described in
How to set two backgrounds?:

I tried replacing (0,0) with current page.east, but the watermark disappeared. How do I get something similar to the example in
How to set two backgrounds??

I'm open to other approaches to this.

\documentclass{article}
\usepackage{lipsum}
\usepackage{background}

\backgroundsetup{
  angle=0,
  opacity=1,
  scale=3,
  contents={%
\begin{tikzpicture}[remember picture,overlay]
\node[text=gray,rotate=-90,anchor=east, yshift=5mm] at (0,0) {DRAFT1};
\node[text=gray,rotate=90,anchor=west, yshift=5mm] at (0,0) {DRAFT2};
\end{tikzpicture}}
}

\begin{document}
  \lipsum
\end{document}

Best Answer

You can use the tikzpagenodes package to easily access the textarea as a node.

Code

\documentclass{article}
\usepackage{tikz}
\usepackage{background}
\usepackage{tikzpagenodes}
\usepackage{lmodern}

\usepackage{lipsum}

\backgroundsetup%
{   angle=0,
    opacity=1,
    scale=1,
    contents=%
    {   \begin{tikzpicture}[remember picture,overlay, scale=3]
            \fontsize{100}{120}\selectfont
            \node[text=gray!50!red,rotate=90, above=1cm] at (current page text area.west) {DRAFT 1};
            \node[text=gray!50!blue,rotate=-90, above=1cm] at (current page text area.east) {DRAFT 2};          
        \end{tikzpicture}
    }
}

\begin{document}

\lipsum \lipsum

\end{document}

Output

enter image description here


Edit 1: You can also place the "Draft" watermarks automatically in the middle of the margin. I assume you want them to be centered at the text area rather than the page area. While for most cases it will be almost the same, I constructed an extreme case to show the differences.

Here, the top margin is only 5mm while the bottom margin is 90mm. This leads to current page.west (orange dot) being at a much lower position than current page text area.west (green dot). So if one simply computes the midpoint via the calc library's (A)!0.5!(B) one arrives at a quite low postition (blue dot). To work around that, one can use a special syntax:

In general, the meaning of (p |- q) is “the intersection of a vertical line through p and a horizontal line through q.”

With this syntax, one can compute the position of a coordinate that runs vertically through current page.west and horizontally through current page text area.west (black dot). Then one can use the midpoint of this position and current page text area.west to find the final position where the watermark will be placed (red dot).

Code

\documentclass{article}
\usepackage[inner=30mm, outer=50mm, top=5mm, bottom=90mm, twoside]{geometry}
\usepackage{tikzpagenodes}
\usepackage{background}

% for coordinate computations
\usetikzlibrary{calc}

% allows for arbitrarily large font sizes
\usepackage{lmodern}

% dummy text
\usepackage{lipsum}

\backgroundsetup%
{   angle=0,
    opacity=1,
    scale=1,
    color=black,
    contents=%
    {   \begin{tikzpicture}[remember picture,overlay]
            \fontsize{80}{108}\selectfont
            % nodes for illustration purposes
            \node[circle,minimum width=4mm,fill=green] (PTAW) at (current page text area.west) {};
            \node[circle,minimum width=4mm,fill=orange] (PW) at (current page.west) {};         
            \node[circle,minimum width=4mm,fill=red] (BMW) at ($(current page text area.west -| current page.west)!0.5!(current page text area.west)$) {};
            \node[circle,minimum width=4mm,fill=blue] (GMW) at ($(current page.west)!0.5!(current page text area.west)$) {};
            \node[circle,minimum width=4mm,fill=black] (GW) at (current page text area.west -| current page.west) {};
            % the watermarks
            %\node[text=gray,rotate=90] at ($(current page text area.west -| current page.west)!0.5!(current page text area.west)$) {DRAFT 1};
            \node[text=gray,rotate=-90] at ($(current page text area.east -| current page.east)!0.5!(current page text area.east)$) {DRAFT 2};          
        \end{tikzpicture}
    }
}

\begin{document}

\lipsum \lipsum

\end{document}

Output

enter image description here