# How to add "DRAFT" along the left/right margin?

The draftwatermark package emblazons "DRAFT" across a page or pages. The intention appears to be to ruin a document to make it unusable.

\documentclass{article}

\usepackage{draftwatermark}
% \SetWatermarkLightness{0.8}
\SetWatermarkScale{4}

\usepackage{lipsum}
\begin{document}
\lipsum{1-5}
\end{document}


But what if the intention is just to ward against accidental use of a preliminary document by a sleep-deprived individual, without jarring so much or interferring at all with the readability of the text.

Adding "DRAFT" along the left/right margin would do the trick. Is there a package for that?

Update

The selected solution is heavy-handed, because it uses tikz, which interacts poorly with simple \begin\end{verbatim} formatting. ("Package tikz Error: Sorry, some package has redefined the meaning of...").

A lighter solution, one that 1- uses an existing lighter package, and 2- cohabits with many other packages (geometry, perhaps even memoir, ...) without issues, would be nice.

• background does it easily.
– user11232
Mar 4, 2015 at 14:13
• That's a suitable more general solution. I'm having trouble though with the output of both draftwatermark and background packages. It seems that Preview on OS X (Mavericks) does not show their added marks, just the text itself. Debugging... Mar 4, 2015 at 14:21
• Can you show your code?
– user11232
Mar 4, 2015 at 14:23
• ok.. debugging consisted of noticing the big red exclamation mark in the documentation for background :) . It reads "The document needs to be processed twice to get the background material in the right position." Indeed, just adding "\usepackage[placement=bottom]{background}" in the preamble (and processing twice) does it. I'd prefer a minuscule running "draft" continuous mark along the right margin, but this is a good start. Mar 4, 2015 at 14:33

Compile more than 3 times.

\documentclass{article}
\usepackage{lipsum}
\usepackage{background}
\backgroundsetup{
position=current page.east,
angle=-90,
nodeanchor=east,
vshift=-5mm,
opacity=1,
scale=3,
contents=Draft
}
\begin{document}
\lipsum
\end{document}


• This gives me "! Package xkeyval Error: nodeanchor' undefined in families background'." Upgrading to TeX Live 2014 (from 2013), just in case. Mar 4, 2015 at 16:09
• @Calaf Upgrading should solve it. Any way, you won't need nodeanchor with vshift as in this code.
– user11232
Mar 4, 2015 at 16:15
• Upgrading to 2014 indeed solves the problem. Mar 4, 2015 at 16:52
• How could one put one of these in each margin, in the interests of symmetry? I tried adding a similar stanza for the west. And it does indeed appear in the west, but the one in the east disappeared. Nov 29, 2015 at 13:07
• @FaheemMitha: You have to detect the odd and even pages and then put the text accordingly. Search for \ifodd...
– user11232
Jan 1, 2016 at 2:24

It's easy to patch this command. Here a code

\documentclass{article}

\usepackage{draftwatermark}
%
\makeatletter
\renewcommand\sc@watermark{%
\setlength{\@tempdimb}{.1\paperwidth}% change here as you need horiz pos
\setlength{\@tempdimc}{-.5\paperheight}%  change vertical pos
\put(\strip@pt\@tempdimb,\strip@pt\@tempdimc){%
\makebox(0,0){\rotatebox{\sc@wm@angle}{%
\scalebox{\sc@wm@scale}{%
\expandafter\expandafter\expandafter\textcolor
\expandafter\sc@wm@colormodel\expandafter{\sc@wm@colorspecs}{%
\fontsize{\sc@wm@fontsize}{1.2\sc@wm@fontsize}
\selectfont
\sc@wm@text}}}}}}
\makeatother
% \SetWatermarkLightness{0.8}
\SetWatermarkScale{4}
\SetWatermarkAngle{90}
\usepackage{lipsum}
\begin{document}
\lipsum[1-5]
\end{document}

• touhami / Steven: it seems this can be done using a 1- or 2-liner with the background package. Using "\usepackage{background}" followed by "\backgroundsetup[contents=foobar,placement=bottom,color=blue]" in the preamble produces an error "! Package xkeyval Error: [' undefined in families background'." Debugging... Mar 4, 2015 at 14:44
• background is better. Mar 4, 2015 at 14:46
• I can't see the problem with xkeyval. Asked a separate question: tex.stackexchange.com/q/231330/9549 Mar 4, 2015 at 15:01

Here's something I concocted for another application, though it is at top and bottom, not left and right. However, since your intention is "just to ward against accidental use of a preliminary document by a sleep-deprived individual," it may be sufficient. It can be turned on/off easily, changed, color added, etc. Syntax is \PageStamp[] (default "DRAFT") and \StopPageStamp, along with \def\PageStampColor{}.

Its also set up to use \thispagestyle{\PlainStyle} or \thispagestyle{\EmptyStyle} to handle using the page stamp with or without page numbers.

\documentclass{article}
\usepackage{lipsum,xcolor}
\makeatletter
%%
%% SET UP CODE TO USE PAGE STAMPS AT TOP AND BOTTOM OF PAGE.  DEFAULT
%% STAMP IS "DRAFT", BUT IT CAN BE USED FOR CLASSIFICATION MARKINGS.,
%% TOO.
\def\PageStampFlag{F}
\def\thePageStamp{}
\def\thePageStampTOP{\thePageStamp}
\def\EmptyStyle{empty}
\def\PlainStyle{plain}
\def\PageStampColor{black}

\newcommand{\ps@pagestamp}{
\hfil\textbf{\Large\thePageStampTOP}\hfil}
\renewcommand{\@evenfoot}{\sffamily\hfil
\begin{tabular}{c}
\textrm{\thepage}\\
\color{\PageStampColor}
\textbf{\Large\thePageStamp}
\end{tabular}
\hfil}
\renewcommand{\@oddfoot}{\@evenfoot}
}

\newcommand{\ps@emptypagestamp}{
\hfil\textbf{\Large\thePageStampTOP}\hfil}
\renewcommand{\@evenfoot}{\sffamily\hfil
\begin{tabular}{c}
~\\
\color{\PageStampColor}
\textbf{\Large\thePageStamp}
\end{tabular}
\hfil}
\renewcommand{\@oddfoot}{\@evenfoot}
}
\newcommand\PageStamp[1][DRAFT]{
\def\PageStampFlag{T}
\def\thePageStamp{#1}
\def\PlainStyle{pagestamp}
\def\EmptyStyle{emptypagestamp}
\pagestyle{\PlainStyle}
}

\newcommand\StopPageStamp[0]{
\def\PageStampFlag{F}
\def\PlainStyle{plain}
\def\EmptyStyle{empty}
\pagestyle{\PlainStyle}
}
\makeatother
\begin{document}
\PageStamp[DRAFT \today]
\lipsum[1-7]
\StopPageStamp
\lipsum[8-13]
\def\PageStampColor{red}
\PageStamp[This is a Test]
\end{document}