| 1 |
% \iffalse meta-comment |
| 2 |
% |
| 3 |
% Copyright 2006-2020 |
| 4 |
% Sergio Callegari <[email protected]> |
| 5 |
% |
| 6 |
% --------------------------------------------- |
| 7 |
% This file is part of the draftwatermark package, |
| 8 |
% a contribution to the LaTeX2e system. |
| 9 |
% --------------------------------------------- |
| 10 |
% |
| 11 |
% This work may be distributed and/or modified under the |
| 12 |
% conditions of the LaTeX Project Public License, version 1.3c. |
| 13 |
% This license is in |
| 14 |
% https://www.latex-project.org/lppl/lppl-1-3c/ |
| 15 |
% and is part of all distributions of LaTeX later than |
| 16 |
% 2008-05-04. |
| 17 |
% |
| 18 |
% This work has the LPPL maintenance status "maintained". |
| 19 |
% |
| 20 |
% This program consists of the files listed in the README.md file |
| 21 |
% included in the package. |
| 22 |
% |
| 23 |
%<*driver> |
| 24 |
\documentclass[a4paper]{ltxdoc} |
| 25 |
\usepackage{newtxtext} |
| 26 |
\usepackage{hologo} |
| 27 |
\usepackage[utf8]{inputenc} |
| 28 |
\usepackage[T1]{fontenc} |
| 29 |
\usepackage{textcomp} |
| 30 |
\usepackage{url} |
| 31 |
\EnableCrossrefs |
| 32 |
\CodelineIndex |
| 33 |
\RecordChanges |
| 34 |
\CodelineIndex |
| 35 |
%\RecordChanges |
| 36 |
\begin{document} |
| 37 |
\DocInput{draftwatermark.dtx} |
| 38 |
\end{document} |
| 39 |
%</driver> |
| 40 |
% |
| 41 |
% \fi |
| 42 |
% |
| 43 |
% \CheckSum{577} |
| 44 |
% |
| 45 |
% \def\filename{draftwatermark.dtx} |
| 46 |
% \def\fileversion{3.3} |
| 47 |
% \def\filedate{2024/03/04} |
| 48 |
% \def\docdate{2024/03/03} |
| 49 |
% |
| 50 |
% \DoNotIndex{\\} |
| 51 |
% \DoNotIndex{\begin, \end, \begingroup, \endgroup} |
| 52 |
% \DoNotIndex{\csname, \endcsname} |
| 53 |
% \DoNotIndex{\if, \else, \fi} |
| 54 |
% \DoNotIndex{\ifx, \fi} |
| 55 |
% \DoNotIndex{\ifodd, \fi} |
| 56 |
% \DoNotIndex{\@car, \@empty, \@ifnextchar, \@ifundefined, \@nil, |
| 57 |
% \@onelevel@sanitize, \@tempboxa, \@tempdima, \@tempdimb, \@tfor} |
| 58 |
% \DoNotIndex{\AddEverypageHook, \AddThispageHook, \AddToHook, \AddToHookNext, |
| 59 |
% \addtolength, \author} |
| 60 |
% \DoNotIndex{\bfseries, \box} |
| 61 |
% \DoNotIndex{\color} |
| 62 |
% \DoNotIndex{\DeclareBoolOption, \DeclareComplementaryOption, |
| 63 |
% \DeclareStringOption, \def, \define@key, \depth, \dimexpr, |
| 64 |
% \DisableKeyvalOption, \do, \documentclass, \dp} |
| 65 |
% \DoNotIndex{\edef, \endinput, \expandafter} |
| 66 |
% \DoNotIndex{\fbox, \fontsize} |
| 67 |
% \DoNotIndex{\hbox, \hspace, \hss, \ht} |
| 68 |
% \DoNotIndex{\let, \lipsum} |
| 69 |
% \DoNotIndex{\maketitle, \MyWM, \MessageBreak} |
| 70 |
% \DoNotIndex{\newcommand, \newsavebox, \NeedsTeXFormat} |
| 71 |
% \DoNotIndex{\PackageError, \PackageWarningNoLine, \paperheight, |
| 72 |
% \paperwidth, \ProcessKeyvalOptions, \ProvidesPackage, \put} |
| 73 |
% \DoNotIndex{\raisebox, \relax, \RequirePackage, \RequirePackageWithOptions, |
| 74 |
% \rotatebox} |
| 75 |
% \DoNotIndex{\savebox, \sbox, \scalebox, \section, \selectfont, \setkeys, |
| 76 |
% \SetupKeyvalOptions, \setlength, \sffamily, \shortstack} |
| 77 |
% \DoNotIndex{\thepage, \title} |
| 78 |
% \DoNotIndex{\usebox, \usepackage} |
| 79 |
% \DoNotIndex{\vbox, \vspace, \vss} |
| 80 |
% \DoNotIndex{\wd, \wmbox} |
| 81 |
% |
| 82 |
% \setcounter{IndexColumns}{2} |
| 83 |
% \setlength{\IndexMin}{3cm} |
| 84 |
% |
| 85 |
% \newcommand*{\Lpack}[1]{\textsf {#1}} ^^A typeset a package |
| 86 |
% \newcommand*{\Lopt}[1]{\texttt {#1}} ^^A typeset an option |
| 87 |
% \newcommand*{\file}[1]{\texttt {#1}} ^^A typeset a file |
| 88 |
% \newcommand*{\Lcount}[1]{\textsl {\small#1}} ^^A typeset a counter |
| 89 |
% \newcommand*{\pstyle}[1]{\textsl {#1}} ^^A typeset a pagestyle |
| 90 |
% \newcommand*{\Lenv}[1]{\texttt {#1}} ^^A typeset an environment |
| 91 |
% |
| 92 |
% \title{The \Lpack{draftwatermark} package\thanks{This file |
| 93 |
% (\texttt{\filename}) has version number \fileversion, last |
| 94 |
% revised \filedate.}} |
| 95 |
% |
| 96 |
% \author{% |
| 97 |
% Sergio Callegari\thanks{Sergio Callegari can be reached at |
| 98 |
% \texttt{sergio.callegari at gmail dot com}}} |
| 99 |
% |
| 100 |
% \date{\docdate} |
| 101 |
% |
| 102 |
% \maketitle |
| 103 |
% |
| 104 |
% \begin{abstract} |
| 105 |
% The \Lpack{draftwatermark} package extends \hologo{LaTeX} providing a |
| 106 |
% means to add a watermark (typically textual and light gray, but |
| 107 |
% possibly more sophisticated) on the pages of a document (either on |
| 108 |
% every page, on the first page, or on selected pages). Typical usage |
| 109 |
% may consist in writing words such as ``DRAFT'' or ``CONFIDENTIAL'' |
| 110 |
% across the pages. The package may remind in some sense |
| 111 |
% \Lpack{draftcopy} by Dr.~Juergen Vollmer, but its implementation is |
| 112 |
% lighter (as the reduced code footprint shows) and does not rely on |
| 113 |
% postscript specials, making the package fully compatible with |
| 114 |
% \hologo{pdfLaTeX}, \hologo{XeLaTeX} and \hologo{LuaLaTeX}. Its feature |
| 115 |
% set is somehow restricted because the emphasis is on the simplicity of |
| 116 |
% the interface. For complex layouts, consider \Lpack{scrlayer.sty} from |
| 117 |
% the \emph{KOMA script} bundle or directly using the new \hologo{LaTeX} |
| 118 |
% shipout hooks. |
| 119 |
% \end{abstract} |
| 120 |
% |
| 121 |
% \section{Introduction} |
| 122 |
% |
| 123 |
% \changes{R1.0}{2006/06/30}{Initial release.}% |
| 124 |
% \changes{R1.1}{2012/01/06}{Many small fixes in the documentation.} |
| 125 |
% This package extends \hologo{LaTeX} providing a means to add a textual, |
| 126 |
% usually light gray (but possibly colored) watermark on every page, the |
| 127 |
% first page, or selected pages of a document. Typical usage may consist |
| 128 |
% in writing words such as ``DRAFT'' or ``CONFIDENTIAL'' across document |
| 129 |
% pages. |
| 130 |
% |
| 131 |
% The package may remind in some sense \Lpack{draftcopy} by Dr.~Juergen |
| 132 |
% Vollmer, but its implementation differs in a few points: |
| 133 |
% \begin{enumerate} |
| 134 |
% \item Code footprint is smaller, although this does not mean much on |
| 135 |
% modern computers. |
| 136 |
% \item There is no use of Postscript specials or other driver-dependent |
| 137 |
% tricks, so the package should be compatible with any output driver and |
| 138 |
% with \hologo{pdfLaTeX}, \hologo{XeLaTeX}, and \hologo{LuaLaTeX}\ in |
| 139 |
% particular. Recently, compatibility with PDF generating engines is |
| 140 |
% quite important and its lack in \Lpack{draftcopy} and was the first |
| 141 |
% motivation for writing \Lpack{draftwatermark}. |
| 142 |
% \item Reduced code footprint comes at some price. Many features of |
| 143 |
% \Lpack{draftcopy} are not supported here, most notably |
| 144 |
% \Lpack{draftwatermark} has: |
| 145 |
% \begin{itemize} |
| 146 |
% \item No automatic selection of the watermark text to use, based on |
| 147 |
% the language, relying on pre-stored translations of the word |
| 148 |
% ``DRAFT''. This may be no big loss, since one is free to choose |
| 149 |
% whatever text he/she happens to prefer. |
| 150 |
% \item No automatic possibility to watermark only the first \emph{two} |
| 151 |
% pages of a document. However, it is possible to automatically |
| 152 |
% watermark only the first or to \emph{manually} stop the watermarking |
| 153 |
% after the second page. |
| 154 |
% \end{itemize} |
| 155 |
% Note that some features available as options in \Lpack{draftcopy} |
| 156 |
% (e.g., the possibility of time-stamping the watermark text) can be |
| 157 |
% obtained working on the watermark text itself. |
| 158 |
% \end{enumerate} |
| 159 |
% |
| 160 |
% The emphasis of \Lpack{draftwatermark} is on the simplicity of its |
| 161 |
% interface. In many cases the package will do the right thing by just |
| 162 |
% loading it, without any further configuration. Such simplicity pairs |
| 163 |
% with some limitations. As an example, \Lpack{draftwatermark} is capable |
| 164 |
% of putting some text or an image on the background of the page, below |
| 165 |
% the document text, but not of \emph{stamping}, that is putting it in the |
| 166 |
% foreground, above the document text. Similarly, it is not well suited |
| 167 |
% for complex watermark layouts. As a further note, there may be |
| 168 |
% unexpected behaviors when \Lpack{draftwatermark} is used together with |
| 169 |
% other packages affecting the page building, e.g., with respect to the |
| 170 |
% stacking order of the objects on the page. For any complex layout, or |
| 171 |
% when the Z-ordering is important, the recommendation is to look at the |
| 172 |
% \Lpack{scrlayer} package in the \emph{KOMA script} bundle or to rely |
| 173 |
% directly on the new shipout hook mechanism provided by \hologo{LaTeX}. |
| 174 |
% |
| 175 |
% |
| 176 |
% \section{User interface} |
| 177 |
% When loaded, \Lpack{draftwatermark} sets up a number of defaults |
| 178 |
% (detailed later and modifiable by specific commands) and immediately |
| 179 |
% becomes active. |
| 180 |
% |
| 181 |
% \subsection{Package options and configuration} |
| 182 |
% If loaded as |
| 183 |
% \begin{quote} |
| 184 |
% |\usepackage{draftwatermark}| |
| 185 |
% \end{quote} |
| 186 |
% the package sets up itself to put the a large, grayed background text |
| 187 |
% saying ``DRAFT'' at the center every page. |
| 188 |
% |
| 189 |
% This behavior can be modified by passing options to the package as in |
| 190 |
% \begin{quote} |
| 191 |
% |\usepackage[<options>]{draftwatermark}| |
| 192 |
% \end{quote} |
| 193 |
% |
| 194 |
% \DescribeMacro{\DraftwatermarkOptions} |
| 195 |
% \changes{R2.0}{2020/03/08}{Introduction of a keyval option mechanism.} |
| 196 |
% The package behavior can also be dynamically changed \emph{after the |
| 197 |
% package is loaded} by the command |\DraftwatermarkOptions{<options>}| |
| 198 |
% that can be used anywhere in the document source. In either case, |
| 199 |
% |<options>| is a comma separated list of options, each given as a |
| 200 |
% |<key>| or as a |<key>=<value>| pair. Unless otherwise indicated, all |
| 201 |
% options that can be used at the loading of the package can also be given |
| 202 |
% via the |\DraftwatermarkOptions{<options>}| mechanism. In fact, the two |
| 203 |
% things are almost equivalent, with some cautionary |
| 204 |
% details. Specifically, the parsing of options by the |\usepackage| |
| 205 |
% command is a bit quirky, hence when specifying options with the |
| 206 |
% |<key>=<value>| syntax, some values that are accepted by |
| 207 |
% |\DraftwatermarkOptions| may cause issues when specifying options with |
| 208 |
% |\usepackage|. \medskip |
| 209 |
% |
| 210 |
% The available options are: |
| 211 |
% \begin{itemize} |
| 212 |
% \changes{R1.1}{2012/01/06}{Introduce the ``stamp'', ``nostamp'' and |
| 213 |
% ``final'' options to control whether the watermark should actually |
| 214 |
% be printed.}^^A |
| 215 |
% \item \verb!firstpageonly=true|false!\\ |
| 216 |
% If no value is provided, |true| is assumed. Default is |false|.\\ |
| 217 |
% Instructs \Lpack{draftwatermark} to only apply the watermark on the |
| 218 |
% first page.\\ |
| 219 |
% This option cannot be used with |\DraftwatermarkOptions{<options>}|. |
| 220 |
% \item |firstpage| legacy alias of |firstpageonly|. |
| 221 |
% \item \verb!stamp=true|false!\\ |
| 222 |
% If no value is provided, |true| is assumed. Default is |true|.\\ |
| 223 |
% Instructs \Lpack{draftwatermark} to print the watermark. |
| 224 |
% \item |nostamp| legacy alias of |stamp=false|. |
| 225 |
% \item |final| legacy alias of |stamp=false|. |
| 226 |
% \item |angle=<real>|\\ |
| 227 |
% Default is |45|.\\ |
| 228 |
% Defines the angle, in degrees, at which the watermark text should be |
| 229 |
% printed. |
| 230 |
% \item |scale=<real>|\\ |
| 231 |
% Default is |1|.\\ |
| 232 |
% Defines the scale at which the watermark text should be printed. |
| 233 |
% \item |fontsize=<length>|\\ |
| 234 |
% Default is |0.25\paperwidth|.\\ |
| 235 |
% Defines the font size for the watermark text. See |
| 236 |
% Section~\ref{ssec:fontsize}. |
| 237 |
% \item |text=<token list>|\\ |
| 238 |
% Default is |DRAFT|. |
| 239 |
% Defines the watermark text. See notes in Section~\ref{ssec:text}. |
| 240 |
% \item |hpos=<length>|\\ |
| 241 |
% Default is |0.5\paperwidth|.\\ |
| 242 |
% Defines the horizontal position of the watermark, based on its anchor |
| 243 |
% point. See also the |pos| option. |
| 244 |
% \item |vpos=<length>|\\ |
| 245 |
% Default is |0.5\paperheight|.\\ |
| 246 |
% Defines the horizontal position of the watermark, based on its anchor |
| 247 |
% point. See also the |pos| option. |
| 248 |
% \item |pos={<length>, <length>}|\\ |
| 249 |
% Defines at once the horizontal (first length) and vertical (second |
| 250 |
% length) position of the watermark, based on its anchor point. See also |
| 251 |
% the options |hpos| and |vpos|. |
| 252 |
% \item \verb!hanchor=l|c|r!\\ |
| 253 |
% Default is |c|.\\ |
| 254 |
% Defines the horizontal position of the watermark anchor |
| 255 |
% point. Specifically, |l| stands for \emph{left}, |c| for \emph{center} |
| 256 |
% and |r| for \emph{right}. See also the |anchor| option. |
| 257 |
% \item \verb!vanchor=t|m|b!\\ |
| 258 |
% Default is |m|.\\ |
| 259 |
% Defines the vertical position of the watermark anchor |
| 260 |
% point. Specifically, |t| stands for \emph{top}, |m| for \emph{middle} |
| 261 |
% and |b| for \emph{bottom}. See also the |anchor| option. |
| 262 |
% \item |anchor=<string>|\\ |
| 263 |
% Defines the anchor point for the watermark. The anchor point is placed |
| 264 |
% at the page coordinates specified by the |hpos| and |vpos| |
| 265 |
% options. The string used for the specification is made of the |l|, |
| 266 |
% |c|, |r|, |t|, |m|, and |b| characters, whose meaning is as described |
| 267 |
% for the |hanchor| and |vanchor| options. For instance, if the anchor |
| 268 |
% specification is |lt|, then the top left corner of the watermark is |
| 269 |
% placed at the position specified by the |hpos| and |vpos| options. |
| 270 |
% \item \verb!alignment=l|c|r!\\ |
| 271 |
% Default is |c|.\\ |
| 272 |
% Defines the alignment for the watermark text in case it contains line |
| 273 |
% breaks. Specifically, |l| aligns left, |c| aligns at the center and |
| 274 |
% |r| aligns right. |
| 275 |
% \item |colormodel=<color model>|\\ |
| 276 |
% Defaults to |gray|.\\ |
| 277 |
% Defines the color model for the specification of the color of the |
| 278 |
% watermark text. Can be any color model supported by the \Lpack{color} |
| 279 |
% package. Leaving it empty allows named colors to be specified. See |
| 280 |
% also the |color| option. |
| 281 |
% \item |colorspec=<color specification>|\\ |
| 282 |
% Defaults to |0.8|.\\ |
| 283 |
% Defines a color specification for the watermark text. The |
| 284 |
% specification is interpreted according to the color model. For |
| 285 |
% instance if the model is |rgb|, then the specification can be a color |
| 286 |
% triple. See also the |color| option. |
| 287 |
% \item |color=<full color specification>|\\ |
| 288 |
% Defines the color of the watermark text. The color specification may |
| 289 |
% include an optional color model and must include a color |
| 290 |
% specification, following the standard set by the \Lpack{color} |
| 291 |
% package. For instance, some examples of valid specifications are |
| 292 |
% |red|, or |{[rgb]{1, 0, 1}}|, or |{[gray]{0.5}}|. |
| 293 |
% \item |markcmd=<macro>|\\ |
| 294 |
% Default is |\DraftwatermarkStdMark|.\\ |
| 295 |
% Defines the command used to draw the actual watermark. See also |
| 296 |
% Sect.~\ref{sec:markcmd}. |
| 297 |
% \end{itemize} |
| 298 |
% |
| 299 |
% \section{Some notes on the configuration options} |
| 300 |
% |
| 301 |
% \subsection{The \Lopt{stamp} option and its companion configuration |
| 302 |
% directives} |
| 303 |
% |
| 304 |
% The |stamp|, |nostamp| and |final| options let one control whether the |
| 305 |
% watermark should actually be printed or not. They can be handy for |
| 306 |
% quickly removing the ``draft'' status from a document, without having to |
| 307 |
% alter the actual watermark setup. Option \Lopt{final} is a synonym for |
| 308 |
% \Lopt{nostamp}. Note that \Lopt{final} is a commonly used global |
| 309 |
% (class-level) option that can be simultaneously obeyed by multiple |
| 310 |
% packages. The option \Lopt{stamp} can be used to override a global |
| 311 |
% \Lopt{final} option and to recover the watermarking. |
| 312 |
% |
| 313 |
% Via the |\DraftwatermarkOptions| command, the |stamp| option can be |
| 314 |
% given at arbitrary points in the document to suspend or resume |
| 315 |
% watermarking. In this way one can \emph{manually} apply the watermark |
| 316 |
% only on selected pages of a document. |
| 317 |
% |
| 318 |
% \subsection{The watermark text size} |
| 319 |
% \label{ssec:fontsize} |
| 320 |
% |
| 321 |
% The package lets one control the watermark size in two different |
| 322 |
% ways. One is by picking a font size via the |fontsize| option; the other |
| 323 |
% one is by scaling the watermark with the |scale| option. |
| 324 |
% |
| 325 |
% In principle, using a large font to produce a large textual watermark is |
| 326 |
% the preferred choice. In fact, a font with a large point size is not |
| 327 |
% just a scaled up version of the same font with a small point |
| 328 |
% size. Conversely, it is a font where all the traits are adjusted to |
| 329 |
% actually look well at a large size. This is why \Lpack{draftwatermark} |
| 330 |
% defaults to setting |scale=1| and to a large point size for the font (in |
| 331 |
% fact, sufficiently large to get the word ``DRAFT'', rotated at |
| 332 |
% 45\textdegree, take about half of the page width. |
| 333 |
% |
| 334 |
% Nonetheless asking for a large font may not work, if \hologo{LaTeX} has |
| 335 |
% not been set up to use \emph{scalable} fonts. For this reason, the |
| 336 |
% recommendation is to always use \Lpack{draftwatermark} on \hologo{LaTeX} |
| 337 |
% or \hologo{pdfLaTeX} together with other packages that trigger the usage |
| 338 |
% of fully scalable fonts (practical examples may be \Lpack{newtx} or |
| 339 |
% \Lpack{mathptmx}, etc.). An even better alternative is to use modern |
| 340 |
% \TeX\ engines, as in \hologo{XeLaTeX} or \hologo{LuaLaTeX} with |
| 341 |
% \Lpack{fontspec}. In any case, recall that even with scalable fonts, |
| 342 |
% \hologo{LaTeX} may be unable to deal with extremely large font sizes |
| 343 |
% (e.g., $\gg 5\,\mathrm{cm}$). If really large letters are required for |
| 344 |
% the watermark, a suitable combination of |fontsize| and |scale| may be |
| 345 |
% needed. |
| 346 |
% |
| 347 |
% One can immediately realize when \hologo{LaTeX} is unable to deal with |
| 348 |
% the package default or selected |fontsize| from two things: (i) a font |
| 349 |
% warning from \LaTeX; and (ii) a tiny watermark text whose size seems not |
| 350 |
% to react to the |fontsize| option. In this case, either switch to |
| 351 |
% scalable fonts or select a small |fontsize| (e.g., |12pt|) together with |
| 352 |
% a |scale| significantly larger than |1|. |
| 353 |
% |
| 354 |
% \subsection{The watermark text} |
| 355 |
% \label{ssec:text} |
| 356 |
% |
| 357 |
% As previously noticed, the watermark text can be specified with the |
| 358 |
% |text| option. The value passed to the |text| option does not need to be |
| 359 |
% a plain string. Conversely, it may include formatting marks, such as |
| 360 |
% line break commands (e.g., |\\|) or commands to select font variants |
| 361 |
% (e.g., |\bfseries|). In fact, it is also possible to use a command to |
| 362 |
% include an image as the text. In case line breaks are present, the text |
| 363 |
% is left, right, center aligned according to the |alignment| option. A |
| 364 |
% word of caution is necessary, though. To use \hologo{LaTeX} commands in |
| 365 |
% the watermark text, please configure the latter via the |
| 366 |
% |\DraftwatermarkOptions| command. Trying to do so by passing options to |
| 367 |
% the \Lpack{draftwatermark} package via the |\usepackage| mechanism may |
| 368 |
% fail due to how \hologo{LaTeX} parses option strings. Also note that the |
| 369 |
% text may need to be surrounded by braces. |
| 370 |
% |
| 371 |
% If the watermark text includes line breaks, \Lpack{draftwatermark} will |
| 372 |
% use a very thin interline space, according to the fact that the |
| 373 |
% multi-line text is managed by surrounding the it with a \hologo{LaTeX} |
| 374 |
% |shortstack| command. |
| 375 |
% |
| 376 |
% Also, note that the watermark typesetting happens inside a \TeX\ group, |
| 377 |
% to make sure that any parameter setting you do in the |text| token list |
| 378 |
% can stay local. |
| 379 |
% |
| 380 |
% As a further remark, observe that in order to only put a watermark on |
| 381 |
% selected pages, an alternative to changing the |stamp| configuration |
| 382 |
% option at arbitrary points in the document can be to use conditional |
| 383 |
% expressions in the watermark text itself. |
| 384 |
% |
| 385 |
% \subsection{The watermark positioning} |
| 386 |
% |
| 387 |
% The watermark position is controlled via the |hpos| and |vpos| |
| 388 |
% configuration options (or alternatively, by the |pos| configuration |
| 389 |
% option). It is worth underlining that these configuration parameters |
| 390 |
% require \emph{lengths} not plain numbers. |
| 391 |
% |
| 392 |
% The coordinates used by the positioning parameters are measured from the |
| 393 |
% top left corner of the page. They work in conjunction with the anchoring |
| 394 |
% parameters (|hanchor|, |vanchor| and |anchor|). Specifically, the anchor |
| 395 |
% point of the watermark is placed at the specified position. The default |
| 396 |
% is to center the watermark on the page, but it is possible to choose |
| 397 |
% other positions by a smart choice of the positioning and anchoring |
| 398 |
% parameters. For instance, one may want to put the watermark on the top |
| 399 |
% right corner of each page, which can be easily done with an |rt| |
| 400 |
% anchoring. |
| 401 |
% |
| 402 |
% As a final remark, observe that the specification of the positioning |
| 403 |
% coordinates can be based on \hologo{LaTeX} macros. For instance, one can |
| 404 |
% set the horizontal position |hpos| at |0.5\paperwidth| (for centering) |
| 405 |
% or at |\dimexpr\paperwidth-5mm| (for placement at the right hand side of |
| 406 |
% the page). Interestingly, \Lpack{draftwatermark} re-evaluates the |
| 407 |
% positioning coordinates on every page. This means that positions based |
| 408 |
% on |\paperwidth| or |\paperheight| should dynamically adjust if the page |
| 409 |
% size is changed through the document. |
| 410 |
% \changes{R2.1}{2020/05/11}{Let anchor directives be re-evaluated on |
| 411 |
% every page.}^^A |
| 412 |
% To some extent, this is also true |
| 413 |
% of the anchor options. For instance, one may set the horizontal anchor |
| 414 |
% |hanchor| at |\ifodd\thepage r\else l\fi| causing the anchor point to |
| 415 |
% alternate between |r| and |l| at every new page. In conjunction with a |
| 416 |
% similarly conditional |hpos| setting, for instance |
| 417 |
% |\ifodd\thepage \dimexpr\paperwidth-5mm \else 5mm\fi|, this enables |
| 418 |
% interesting effects, like placing the watermark close to the right side |
| 419 |
% of the page on odd pages and to the left side of the page on even |
| 420 |
% pages. Obviously, this kind of setting is only applicable with the |
| 421 |
% |hanchor| and |vanchor| options, and not with the |anchor| shorthand. |
| 422 |
% |
| 423 |
% \section{The standard watermark and ways of overriding it} |
| 424 |
% \label{sec:markcmd} |
| 425 |
% |
| 426 |
% In order to simplify its usage as much as possible, the |
| 427 |
% \Lpack{draftwatermark} package is designed under the assumption that, |
| 428 |
% most of the time, the user will need just a \emph{textual} watermark and |
| 429 |
% some basic way to tune its visual aspect, such as choosing the text |
| 430 |
% font, font size, scale, rotation angle, etc. |
| 431 |
% |
| 432 |
% \DescribeMacro{\DraftwatermarkStdMark} To this aim, the macro |
| 433 |
% |\DraftwatermarkStdMark| is provided to do the standard job of |
| 434 |
% typesetting the watermark text according to the configuration-defined |
| 435 |
% font, color, angle, and so on. Then the package arranges so that this |
| 436 |
% macro is called whenever watermarking is needed. |
| 437 |
% |
| 438 |
% In case the facilities provided by |\DraftwatermarkStdMark| are |
| 439 |
% insufficient, the package user can set up his/her own macro to do the |
| 440 |
% watermark typesetting and instruct \Lpack{draftwatermark} to use it in |
| 441 |
% place of |\DraftwatermarkStdMark|. This is done by using the |
| 442 |
% configuration option |markcmd| that takes the new macro name as its |
| 443 |
% parameter. The advice is to always write a new macro rather than |
| 444 |
% redefining or patching |\DraftwatermarkStdMark|. Note that because |
| 445 |
% |markcmd| can be reconfigured multiple times, one may actually define |
| 446 |
% multiple macros to get different watermark layouts on different |
| 447 |
% pages of the same document. |
| 448 |
% |
| 449 |
% \begin{sloppy} It is worth recalling that when |markcmd| is set to |
| 450 |
% something different from |\DraftwatermarkStdMark|, the angle, font, |
| 451 |
% scale, color parameters will be ignored. In this case, the package |
| 452 |
% user is on his/her own if he/she wants to parametrize the watermark |
| 453 |
% appearance. |
| 454 |
% |
| 455 |
% \end{sloppy} |
| 456 |
% |
| 457 |
% \section{Compatibility notes} |
| 458 |
% |
| 459 |
% \subsection{Compatibility notes for package version 3.0 and later} |
| 460 |
% |
| 461 |
% \changes{R3.0}{2020/12/08}{Remove dependency on package |
| 462 |
% \Lpack{everypage}.}^^A |
| 463 |
% Version 3.0 of the package takes advantage of the new functionalities |
| 464 |
% introduced in \hologo{LaTeX} with the Fall 2020 release and gets rid of |
| 465 |
% its dependency on \Lpack{everypage}. In principle, this could result in |
| 466 |
% behavioral differences in corner cases. |
| 467 |
% |
| 468 |
% \changes{R3.0}{2020/12/08}{Automatically load legacy code for older |
| 469 |
% \hologo{LaTeX} formats.}^^A |
| 470 |
% For users of versions of \hologo{LaTeX} before Fall 2020, |
| 471 |
% \Lpack{draftwatermarks} falls back to its own legacy code base, now |
| 472 |
% packaged as \Lpack{draftwatermark-2x}. |
| 473 |
% |
| 474 |
% It is worth remarking that there is no advantage in trying to explicitly |
| 475 |
% load \Lpack{draftwatermark-2x} on a modern \hologo{LaTeX} to try to get |
| 476 |
% the past behavior. In fact, even if the old code base uses |
| 477 |
% \Lpack{everypage}, on modern \hologo{LaTeX} formats, the latter tries |
| 478 |
% itself to rely on the new \hologo{LaTeX} functionalities rather than its |
| 479 |
% own legacy mechanisms. |
| 480 |
% |
| 481 |
% \subsection{Compatibility notes for package version 2.0 and later} |
| 482 |
% |
| 483 |
% \changes{R2.0}{2020/03/08}{Complete package overhaul.} |
| 484 |
% Version 2.0 of the package is an almost complete rewrite with respect to |
| 485 |
% version 1.2. Specifically, all the configuration mechanism has been |
| 486 |
% overhauled, by moving to an interface based on configuration keys and |
| 487 |
% associated values. |
| 488 |
% |
| 489 |
% In principle, compatibility to the 1.x series should be fully preserved |
| 490 |
% by the provision of a \emph{legacy interface}. In case old documents are |
| 491 |
% broken by the 2.x series, please report it as a bug. |
| 492 |
% |
| 493 |
% The advice is not to use the legacy interface in new documents, unless |
| 494 |
% you know that they will need to be processed in environments lacking a |
| 495 |
% recent \Lpack{draftwatermark}. |
| 496 |
% |
| 497 |
% \subsection{The legacy interface} |
| 498 |
% |
| 499 |
% The legacy interface is composed by the following commands: |
| 500 |
% \begin{itemize} |
| 501 |
% \item \DescribeMacro{\SetWatermarkAngle}^^A |
| 502 |
% Command |\SetWatermarkAngle{<real>}| is the same as\\ |
| 503 |
% |\DraftwatermarkOptions{angle=<real>}|. |
| 504 |
% \item \DescribeMacro{\SetWatermarkColor}^^A |
| 505 |
% \changes{R1.1}{2012/01/06}{Add support for specifying color |
| 506 |
% of textual watermark.}^^A |
| 507 |
% Command |\SetWatermarkColor[<model>]{<color spec>}| is the same as\\ |
| 508 |
% |\DraftwatermarkOptions{color={[<model>]{<color spec>}}}|. |
| 509 |
% \item \DescribeMacro{\SetWatermarkLightness}^^A |
| 510 |
% Command |\SetWatermarkLightness{<real>}| is the same as\\ |
| 511 |
% |\DraftwatermarkOptions{color={[<gray>]{<real>}}}|. The real value |
| 512 |
% should be in between 0 (for black) and 1 (for white). |
| 513 |
% \item \DescribeMacro{\SetWatermarkFontSize}^^A |
| 514 |
% Command |\SetWatermarkFontSize{<length>}| is the same as\\ |
| 515 |
% |\DraftwatermarkOptions{fontsize=<length>}|. |
| 516 |
% \item \DescribeMacro{\SetWatermarkScale}^^A |
| 517 |
% Command |\SetWatermarkScale{<real>}| is the same as\\ |
| 518 |
% |\DraftwatermarkOptions{scale=<real>}|. |
| 519 |
% \item \DescribeMacro{\SetWatermarkHorCenter}^^A |
| 520 |
% \changes{R1.2}{2015/02/19}{Add support for specifying the watermark |
| 521 |
% horizontal position.}^^A |
| 522 |
% Command |\SetWatermarkHorCenter{<length>}| is the same as\\ |
| 523 |
% |\DraftwatermarkOptions{hpos=<length>, hanchor=c}|. |
| 524 |
% \item \DescribeMacro{\SetWatermarkVerCenter}^^A |
| 525 |
% \changes{R1.2}{2015/02/19}{Add support for specifying the watermark |
| 526 |
% vertical position.}^^A |
| 527 |
% Command |\SetWatermarkVerCenter{<length>}| is the same as\\ |
| 528 |
% |\DraftwatermarkOptions{vpos=<length>, vanchor=m}|. |
| 529 |
% \item \DescribeMacro{\SetWatermarkText}^^A |
| 530 |
% Command |\SetWatermarkText{<text>}| is the same as\\ |
| 531 |
% |\DraftwatermarkOptions{text={<text>}}|. |
| 532 |
% \end{itemize} |
| 533 |
% |
| 534 |
% Note that the legacy interface supports only a subset of what is |
| 535 |
% possible with the modern interface. |
| 536 |
% |
| 537 |
% \section{Examples} |
| 538 |
% \label{sec:examples} |
| 539 |
% |
| 540 |
% \subsection{Plain case, using the modern package interface} |
| 541 |
% |
| 542 |
% As an example, consider this first document source: |
| 543 |
% |
| 544 |
% \iffalse |
| 545 |
%<*samplecode-modern> |
| 546 |
% \fi |
| 547 |
% \begin{macrocode} |
| 548 |
\documentclass{article} |
| 549 |
\usepackage[svgnames]{xcolor} |
| 550 |
\usepackage[T1]{fontenc} |
| 551 |
\usepackage[firstpageonly, color={[gray]{0.5}}, |
| 552 |
text=DRAFT\\COPY]{draftwatermark} |
| 553 |
\usepackage{mathptmx} |
| 554 |
\usepackage{lipsum} |
| 555 |
\title{Sample document for the draftwatermark package} |
| 556 |
\author{} |
| 557 |
|
| 558 |
\begin{document} |
| 559 |
\maketitle |
| 560 |
|
| 561 |
\section{One} |
| 562 |
\lipsum[1-3] |
| 563 |
|
| 564 |
\section{Two} |
| 565 |
\lipsum[4-6] |
| 566 |
|
| 567 |
\end{document} |
| 568 |
% \end{macrocode} |
| 569 |
% \iffalse |
| 570 |
%</samplecode-modern> |
| 571 |
% \fi |
| 572 |
% |
| 573 |
% This produces a two pages document with placeholder content, putting a |
| 574 |
% page-centered watermark on the first page only. The watermark is made a |
| 575 |
% slightly darker toneof gray than the default. |
| 576 |
% |
| 577 |
% \subsection{Plain case, using the legacy interface} |
| 578 |
% |
| 579 |
% Using the legacy interface, the source for the same sample document as |
| 580 |
% above would look like: |
| 581 |
% \iffalse |
| 582 |
%<*samplecode-legacy> |
| 583 |
% \fi |
| 584 |
% \begin{macrocode} |
| 585 |
\documentclass{article} |
| 586 |
\usepackage[svgnames]{xcolor} |
| 587 |
\usepackage[T1]{fontenc} |
| 588 |
\usepackage[firstpage]{draftwatermark} |
| 589 |
\usepackage{mathptmx} |
| 590 |
\usepackage{lipsum} |
| 591 |
|
| 592 |
\SetWatermarkLightness{0.5} |
| 593 |
\SetWatermarkText{DRAFT\\COPY} |
| 594 |
|
| 595 |
\title{Sample document for the draftwatermark package} |
| 596 |
\author{} |
| 597 |
|
| 598 |
\begin{document} |
| 599 |
\maketitle |
| 600 |
|
| 601 |
\section{One} |
| 602 |
\lipsum[1-3] |
| 603 |
|
| 604 |
\section{Two} |
| 605 |
\lipsum[4-6] |
| 606 |
|
| 607 |
\end{document} |
| 608 |
% \end{macrocode} |
| 609 |
% \iffalse |
| 610 |
%</samplecode-legacy> |
| 611 |
% \fi |
| 612 |
% |
| 613 |
% \subsection{Things that cannot be done with the legacy interface} |
| 614 |
% |
| 615 |
% A major limitation of the legacy interface that has been removed with |
| 616 |
% the modern interface is the inability to control the watermark |
| 617 |
% anchoring. For instance, one may want the watermark to appear in the |
| 618 |
% right top angle of every page. With the modern interface, such a result |
| 619 |
% can be easily obtained as in the following sample code: |
| 620 |
% \iffalse |
| 621 |
%<*samplecode-anchor> |
| 622 |
% \fi |
| 623 |
% \begin{macrocode} |
| 624 |
\documentclass{article} |
| 625 |
\usepackage[svgnames]{xcolor} |
| 626 |
\usepackage[T1]{fontenc} |
| 627 |
\usepackage[firstpage, anchor=tr, color=red, |
| 628 |
pos={\dimexpr\paperwidth-5mm, 5mm}, |
| 629 |
angle=-45, fontsize=32pt]{draftwatermark} |
| 630 |
\usepackage{mathptmx} |
| 631 |
\usepackage{lipsum} |
| 632 |
\title{Sample document for the draftwatermark package} |
| 633 |
\author{} |
| 634 |
|
| 635 |
\DraftwatermarkOptions{text=\bfseries DRAFT} |
| 636 |
\begin{document} |
| 637 |
\maketitle |
| 638 |
|
| 639 |
\section{One} |
| 640 |
\lipsum[1-3] |
| 641 |
|
| 642 |
\section{Two} |
| 643 |
\lipsum[4-6] |
| 644 |
|
| 645 |
\end{document} |
| 646 |
% \end{macrocode} |
| 647 |
% \iffalse |
| 648 |
%</samplecode-anchor> |
| 649 |
% \fi |
| 650 |
% |
| 651 |
% Another interesting possibility of the modern interface derives from the |
| 652 |
% fact that the positioning and anchoring options are re-evaluated for |
| 653 |
% every page. This allows the positioning to dynamically change following |
| 654 |
% other parameters (for instance the |\paperwidth|) or to take advantage |
| 655 |
% of conditionals to achieve effects such as differentiating the watermark |
| 656 |
% for odd and even pages, as shown in the following code: |
| 657 |
% \iffalse |
| 658 |
%<*samplecode-dynamic> |
| 659 |
% \fi |
| 660 |
% \begin{macrocode} |
| 661 |
\documentclass{article} |
| 662 |
\usepackage[svgnames]{xcolor} |
| 663 |
\usepackage[T1]{fontenc} |
| 664 |
\usepackage[color=red, fontsize=32pt]{draftwatermark} |
| 665 |
\usepackage{mathptmx} |
| 666 |
\usepackage{lipsum} |
| 667 |
\title{Sample document for the draftwatermark package} |
| 668 |
\author{} |
| 669 |
|
| 670 |
\DraftwatermarkOptions{% |
| 671 |
angle=0, |
| 672 |
text={\ifodd\thepage ODD\else EVEN\fi}, |
| 673 |
hpos={\ifodd\thepage \dimexpr\paperwidth-5mm\else 5mm\fi}, |
| 674 |
vpos=5mm, |
| 675 |
vanchor=t, |
| 676 |
hanchor={\ifodd\thepage r\else l\fi} |
| 677 |
} |
| 678 |
|
| 679 |
\begin{document} |
| 680 |
\maketitle |
| 681 |
|
| 682 |
\section{One} |
| 683 |
\lipsum[1-3] |
| 684 |
|
| 685 |
\section{Two} |
| 686 |
\lipsum[4-6] |
| 687 |
|
| 688 |
\end{document} |
| 689 |
% \end{macrocode} |
| 690 |
% \iffalse |
| 691 |
%</samplecode-dynamic> |
| 692 |
% \fi |
| 693 |
% |
| 694 |
% \subsection{Maximum freedom with a custom watermarking command} |
| 695 |
% |
| 696 |
% Maximum freedom can be obtained with a custom watermarking command. The |
| 697 |
% following example shows how it can be used, once again differentiating |
| 698 |
% the watermark for odd and even pages. |
| 699 |
%\iffalse |
| 700 |
%<*samplecode-custom> |
| 701 |
% \fi |
| 702 |
% \begin{macrocode} |
| 703 |
\documentclass{article} |
| 704 |
\usepackage[svgnames]{xcolor} |
| 705 |
\usepackage[T1]{fontenc} |
| 706 |
\usepackage{draftwatermark} |
| 707 |
\usepackage{mathptmx} |
| 708 |
\usepackage[scaled]{helvet} |
| 709 |
\usepackage{lipsum} |
| 710 |
\title{Sample document for the draftwatermark package} |
| 711 |
\author{} |
| 712 |
|
| 713 |
\newsavebox\wmbox |
| 714 |
\savebox\wmbox{% |
| 715 |
{\color[rgb]{1,0.8,0.8}\sffamily \fbox{DRAFT}}} |
| 716 |
\newcommand\MyWM{% |
| 717 |
\ifodd\thepage |
| 718 |
\hspace*{\dimexpr \paperwidth -\wd\wmbox-10mm}% |
| 719 |
\usebox{\wmbox}% |
| 720 |
\else |
| 721 |
\usebox{\wmbox}% |
| 722 |
\fi} |
| 723 |
|
| 724 |
\DraftwatermarkOptions{anchor=lt, pos={5mm, 5mm}, markcmd=\MyWM} |
| 725 |
\begin{document} |
| 726 |
\maketitle |
| 727 |
|
| 728 |
\section{One} |
| 729 |
\lipsum[1-3] |
| 730 |
|
| 731 |
\section{Two} |
| 732 |
\lipsum[4-6] |
| 733 |
|
| 734 |
\end{document} |
| 735 |
% \end{macrocode} |
| 736 |
% \iffalse |
| 737 |
%</samplecode-custom> |
| 738 |
% \fi |
| 739 |
% |
| 740 |
% |
| 741 |
% \section{Development and support} |
| 742 |
% |
| 743 |
% The package is developed on \emph{github}: |
| 744 |
% \begin{quote} |
| 745 |
% \url{https://github.com/callegar/LaTeX-draftwatermark} |
| 746 |
% \end{quote} |
| 747 |
% Please, refer to that site for any bug report or development |
| 748 |
% information. Be so kind to refrain from opening bugs for enhancement |
| 749 |
% requests that, from the present document, would evidently require moving |
| 750 |
% against some fundamental design decisions. |
| 751 |
% |
| 752 |
% \StopEventually {} |
| 753 |
% |
| 754 |
% \section{Implementation} |
| 755 |
% \subsection{Implementation of \Lpack{draftwatermark}} |
| 756 |
% |
| 757 |
% Announce the name and version of the package, which requires |
| 758 |
% \LaTeXe. |
| 759 |
% \changes{R3.2}{2024/03/03}{Fix version number of main package.}^^A |
| 760 |
% \iffalse |
| 761 |
%<*draftwatermark> |
| 762 |
% \fi |
| 763 |
% \begin{macrocode} |
| 764 |
\NeedsTeXFormat{LaTeX2e} |
| 765 |
\ProvidesPackage{draftwatermark}% |
| 766 |
[2024/03/04 3.3 Put a gray textual watermark on document pages] |
| 767 |
% \end{macrocode} |
| 768 |
% \changes{R3.0}{2020/12/08}{Automatically load legacy code for older |
| 769 |
% \hologo{LaTeX} formats.}^^A |
| 770 |
% Depending on the actual functionalities provided by \hologo{LaTeX} |
| 771 |
% consider loading \Lpack{draftwatermark-2x}. If so doing, warn about this, |
| 772 |
% and hand over the operation to that package. |
| 773 |
% \begin{macrocode} |
| 774 |
\@ifundefined{AddToHook}{% |
| 775 |
\PackageWarningNoLine{draftwatermark}{% |
| 776 |
You appear to be running a version of LaTeX\MessageBreak |
| 777 |
unsupported by current draftwatermark.\MessageBreak |
| 778 |
Forcing fallback to `draftwatermark-2x` that\MessageBreak |
| 779 |
uses an older code base}% |
| 780 |
\RequirePackageWithOptions{draftwatermark-2x}% |
| 781 |
\endinput}{} |
| 782 |
% \end{macrocode} |
| 783 |
% |
| 784 |
% Require the needed packages. |
| 785 |
% \changes{R3.1}{2024/01/22}{Require `xcolor` instead of `color`.}% |
| 786 |
% \begin{macrocode} |
| 787 |
\RequirePackage{kvoptions} |
| 788 |
\RequirePackage{graphicx} |
| 789 |
\RequirePackage{xcolor} |
| 790 |
% \end{macrocode} |
| 791 |
% |
| 792 |
% Define the configuration options and default values. |
| 793 |
% \begin{macrocode} |
| 794 |
\DeclareBoolOption[false]{firstpageonly} |
| 795 |
\define@key{draftwatermark}{firstpage}[true]{% |
| 796 |
\csname draftwatermark@firstpageonly#1\endcsname} |
| 797 |
\DeclareBoolOption[true]{stamp} |
| 798 |
\DeclareComplementaryOption{nostamp}{stamp} |
| 799 |
\DeclareComplementaryOption{final}{stamp} |
| 800 |
\DeclareStringOption[45]{angle} |
| 801 |
\DeclareStringOption[1]{scale} |
| 802 |
\DeclareStringOption[DRAFT]{text} |
| 803 |
\DeclareStringOption[0.5\paperwidth]{hpos} |
| 804 |
\DeclareStringOption[0.5\paperheight]{vpos} |
| 805 |
\DeclareStringOption[0.25\paperwidth]{fontsize} |
| 806 |
\DeclareStringOption[gray]{colormodel} |
| 807 |
\DeclareStringOption[0.8]{colorspec} |
| 808 |
\DeclareStringOption[c]{hanchor} |
| 809 |
\DeclareStringOption[m]{vanchor} |
| 810 |
\DeclareStringOption[c]{alignment} |
| 811 |
\DeclareStringOption[\DraftwatermarkStdMark]{markcmd} |
| 812 |
\define@key{draftwatermark}{pos}{% |
| 813 |
\draftwatermark@processpos #1\@nil} |
| 814 |
\define@key{draftwatermark}{anchor}{% |
| 815 |
\draftwatermark@processanchor{#1}} |
| 816 |
\define@key{draftwatermark}{color}{% |
| 817 |
\draftwatermark@processcolor #1\@nil} |
| 818 |
% \end{macrocode} |
| 819 |
% |
| 820 |
% Set up some helper marcros to process the options. These should be |
| 821 |
% rather self-explanatory. |
| 822 |
% \begin{macrocode} |
| 823 |
\def\draftwatermark@processpos#1,#2\@nil{% |
| 824 |
\def\draftwatermark@hpos{#1}% |
| 825 |
\def\draftwatermark@vpos{#2}} |
| 826 |
|
| 827 |
\def\draftwatermark@processanchor#1{% |
| 828 |
\def\draftwatermark@tempa{#1} |
| 829 |
\@onelevel@sanitize \draftwatermark@tempa |
| 830 |
\expandafter \@tfor \expandafter \draftwatermark@tempb |
| 831 |
\expandafter :\expandafter =\draftwatermark@tempa |
| 832 |
\do |
| 833 |
{% |
| 834 |
\if \draftwatermark@tempb l% |
| 835 |
\def \draftwatermark@hanchor{l}% |
| 836 |
\else \if \draftwatermark@tempb c% |
| 837 |
\def \draftwatermark@hanchor{c}% |
| 838 |
\else \if \draftwatermark@tempb r% |
| 839 |
\def \draftwatermark@hanchor{r}% |
| 840 |
\else \if \draftwatermark@tempb t% |
| 841 |
\def \draftwatermark@vanchor{t}% |
| 842 |
\else \if \draftwatermark@tempb m% |
| 843 |
\def \draftwatermark@vanchor{m}% |
| 844 |
\else \if \draftwatermark@tempb b% |
| 845 |
\def \draftwatermark@vanchor{b} |
| 846 |
\else |
| 847 |
\PackageError{draftwatermark}{% |
| 848 |
Illegal anchor directive `\draftwatermark@tempb'}% |
| 849 |
{Directive has been ingnored.}% |
| 850 |
\fi\fi\fi\fi\fi\fi |
| 851 |
}} |
| 852 |
|
| 853 |
\def\draftwatermark@processcolor{% |
| 854 |
\@ifnextchar[ |
| 855 |
\draftwatermark@processcolor@ii\draftwatermark@processcolor@i} |
| 856 |
|
| 857 |
\def\draftwatermark@processcolor@i#1\@nil{% |
| 858 |
\def\draftwatermark@colormodel{}% |
| 859 |
\def\draftwatermark@colorspec{#1}} |
| 860 |
|
| 861 |
\def\draftwatermark@processcolor@ii[#1]#2\@nil{% |
| 862 |
\def\draftwatermark@colormodel{#1}% |
| 863 |
\def\draftwatermark@colorspec{#2}} |
| 864 |
|
| 865 |
% \end{macrocode} |
| 866 |
% |
| 867 |
% Process the package options\dots |
| 868 |
% \begin{macrocode} |
| 869 |
\ProcessKeyvalOptions* |
| 870 |
% \end{macrocode} |
| 871 |
% |
| 872 |
% \dots\, and then disable the |firstpageonly| and |firstpage| options, |
| 873 |
% that can only be used at the package loading time. |
| 874 |
% \begin{macrocode} |
| 875 |
\DisableKeyvalOption{draftwatermark}{firstpageonly} |
| 876 |
\DisableKeyvalOption{draftwatermark}{firstpage} |
| 877 |
|
| 878 |
% \end{macrocode} |
| 879 |
% |
| 880 |
% \begin{macro}{\DraftwatermarkOptions} |
| 881 |
% Set up a command to modify the configuration as needed. |
| 882 |
% \begin{macrocode} |
| 883 |
\newcommand\DraftwatermarkOptions[1]{\setkeys{draftwatermark}{#1}} |
| 884 |
|
| 885 |
% \end{macrocode} |
| 886 |
% \end{macro} |
| 887 |
% |
| 888 |
% Introduce the legacy interface. |
| 889 |
% \begin{macro}{\SetWatermarkAngle} |
| 890 |
% Legacy command to set the rotation angle for the standard watermark |
| 891 |
% \begin{macrocode} |
| 892 |
\newcommand\SetWatermarkAngle[1]{\DraftwatermarkOptions{angle=#1}} |
| 893 |
% \end{macrocode} |
| 894 |
% \end{macro} |
| 895 |
% \begin{macro}{\SetWatermarkFontSize} |
| 896 |
% Legacy command to set the font size for the standard watermark |
| 897 |
% \begin{macrocode} |
| 898 |
\newcommand\SetWatermarkFontSize[1]{\DraftwatermarkOptions{fontsize=#1}} |
| 899 |
% \end{macrocode} |
| 900 |
% \end{macro} |
| 901 |
% \begin{macro}{\SetWatermarkScale} |
| 902 |
% Legacy command to set the scale for the standard watermark |
| 903 |
% \begin{macrocode} |
| 904 |
\newcommand\SetWatermarkScale[1]{\DraftwatermarkOptions{scale=#1}} |
| 905 |
% \end{macrocode} |
| 906 |
% \end{macro} |
| 907 |
% \begin{macro}{\SetWatermarkHorCenter} |
| 908 |
% \begin{macro}{\SetWatermarkVerCenter} |
| 909 |
% Legacy commands to set the horizontal and vertical position for the |
| 910 |
% standard watermark, also forcing it to be centered there. |
| 911 |
% \begin{macrocode} |
| 912 |
\newcommand\SetWatermarkHorCenter[1]{% |
| 913 |
\DraftwatermarkOptions{hpos=#1, hanchor=c}} |
| 914 |
\newcommand\SetWatermarkVerCenter[1]{% |
| 915 |
\DraftwatermarkOptions{vpos=#1, vanchor=m}} |
| 916 |
% \end{macrocode} |
| 917 |
% \end{macro} |
| 918 |
% \end{macro} |
| 919 |
% \begin{macro}{\SetWatermarkText} |
| 920 |
% \changes{R2.3}{2020/12/06}{Fix legacy interface to accept |
| 921 |
% text including commas.}^^A |
| 922 |
% Legacy command to set the text of the standard watermark |
| 923 |
% \begin{macrocode} |
| 924 |
\newcommand\SetWatermarkText[1]{\DraftwatermarkOptions{text={#1}}} |
| 925 |
% \end{macrocode} |
| 926 |
% \end{macro} |
| 927 |
% \begin{macro}{\SetWatermarColor} |
| 928 |
% \begin{macro}{\SetWatermarkLightness} |
| 929 |
% Legacy commands to set the color for the |
| 930 |
% standard watermark. |
| 931 |
% \begin{macrocode} |
| 932 |
\newcommand\SetWatermarkColor[2][]{% |
| 933 |
\DraftwatermarkOptions{colormodel=#1, colorspec=#2}} |
| 934 |
\newcommand\SetWatermarkLightness[1]{% |
| 935 |
\DraftwatermarkOptions{colormodel=gray, colorspec=#1}} |
| 936 |
|
| 937 |
% \end{macrocode} |
| 938 |
% \end{macro} |
| 939 |
% \end{macro} |
| 940 |
% |
| 941 |
% \begin{macro}{\DraftwatermarkStdMark} |
| 942 |
% The command to generate the standard watermark |
| 943 |
% \changes{R2.2}{2020/06/29}{Wrap watermark text in a shortstack to make |
| 944 |
% line breaks possible.} |
| 945 |
% \begin{macrocode} |
| 946 |
\newcommand\DraftwatermarkStdMark{% |
| 947 |
\rotatebox{\draftwatermark@angle}{% |
| 948 |
\scalebox{\draftwatermark@scale}{% |
| 949 |
\begingroup |
| 950 |
\ifx\draftwatermark@colormodel\@empty |
| 951 |
\color{\draftwatermark@colorspec}% |
| 952 |
\else |
| 953 |
\color[\draftwatermark@colormodel]{\draftwatermark@colorspec}% |
| 954 |
\fi |
| 955 |
\setlength{\@tempdima}{\draftwatermark@fontsize}% |
| 956 |
\fontsize{\@tempdima}{1.2\@tempdima}\selectfont |
| 957 |
\shortstack[\draftwatermark@alignment]{\draftwatermark@text}% |
| 958 |
\endgroup}}} |
| 959 |
|
| 960 |
% \end{macrocode} |
| 961 |
% \end{macro} |
| 962 |
% |
| 963 |
% The code to actually print the watermark |
| 964 |
% \begin{macrocode} |
| 965 |
\newcommand\draftwatermark@printwm[1]{% |
| 966 |
\sbox\@tempboxa{\raisebox{\depth}{#1}}% |
| 967 |
\setlength{\@tempdima}{\draftwatermark@hpos}% |
| 968 |
\setlength{\@tempdimb}{-\draftwatermark@vpos}% |
| 969 |
\edef \draftwatermark@tempa{\draftwatermark@hanchor}% |
| 970 |
\@onelevel@sanitize \draftwatermark@tempa |
| 971 |
\expandafter\def\expandafter\draftwatermark@tempb |
| 972 |
\expandafter{\expandafter\@car \draftwatermark@tempa\@nil}% |
| 973 |
\if \draftwatermark@tempb r% |
| 974 |
\addtolength\@tempdima{-\wd\@tempboxa}% |
| 975 |
\else\if \draftwatermark@tempb c% |
| 976 |
\addtolength\@tempdima{-0.5\wd\@tempboxa}% |
| 977 |
\else\if \draftwatermark@tempb l% |
| 978 |
\relax |
| 979 |
\else |
| 980 |
\PackageError{draftwatermark}{% |
| 981 |
Illegal anchor directive `\draftwatermark@tempb'}% |
| 982 |
{Anchoring to left side.}% |
| 983 |
\fi\fi\fi |
| 984 |
\edef \draftwatermark@tempa{\draftwatermark@vanchor}% |
| 985 |
\@onelevel@sanitize \draftwatermark@tempa |
| 986 |
\expandafter\def\expandafter\draftwatermark@tempb |
| 987 |
\expandafter{\expandafter\@car \draftwatermark@tempa\@nil}% |
| 988 |
\if \draftwatermark@tempb b% |
| 989 |
\relax |
| 990 |
\else\if \draftwatermark@tempb m% |
| 991 |
\addtolength\@tempdimb{-0.5\ht\@tempboxa}% |
| 992 |
\else\if \draftwatermark@tempb t% |
| 993 |
\addtolength\@tempdimb{-\ht\@tempboxa}% |
| 994 |
\else |
| 995 |
\PackageError{draftwatermark}{% |
| 996 |
Illegal anchor directive `\draftwatermark@tempb'}% |
| 997 |
{Anchoring to top side.}% |
| 998 |
\fi\fi\fi |
| 999 |
\put(\@tempdima,\@tempdimb){\usebox\@tempboxa}% |
| 1000 |
} |
| 1001 |
|
| 1002 |
% \end{macrocode} |
| 1003 |
% |
| 1004 |
% A wrapper to make the watermark printing conditional |
| 1005 |
% \begin{macrocode} |
| 1006 |
\newcommand\draftwatermark@print[1]{% |
| 1007 |
\ifdraftwatermark@stamp |
| 1008 |
\draftwatermark@printwm{#1}% |
| 1009 |
\fi} |
| 1010 |
% \end{macrocode} |
| 1011 |
% |
| 1012 |
% \dots\, now, the code to set up the \Lpack{everypage} hooks to |
| 1013 |
% assure that the watermark printing commands are called when needed |
| 1014 |
% \begin{macrocode} |
| 1015 |
\ifdraftwatermark@firstpageonly |
| 1016 |
\AddToHookNext{shipout/background}{% |
| 1017 |
\draftwatermark@print{\draftwatermark@markcmd}}% |
| 1018 |
\else |
| 1019 |
\AddToHook{shipout/background}{% |
| 1020 |
\draftwatermark@print{\draftwatermark@markcmd}}% |
| 1021 |
\fi |
| 1022 |
% \end{macrocode} |
| 1023 |
% Finally, declare precedence rules with respect to shipout/background |
| 1024 |
% hooks that may be set up by other packages. These are important |
| 1025 |
% because they end up controlling the stacking of background |
| 1026 |
% artifacts. Specifically, the draft watermark should go below |
| 1027 |
% anything else. A notable package that must be considered is |
| 1028 |
% \Lpack{eso-pic}, particularly because it gets used by |
| 1029 |
% \Lpack{pdfpages} |
| 1030 |
% \changes{R3.3}{2024/03/04}{Declare precedence rules with respect to |
| 1031 |
% other users of the shipout/background hook. This fixes the |
| 1032 |
% background stacking order when using \Lpack{pdfpages}.}% |
| 1033 |
% \begin{macrocode} |
| 1034 |
\DeclareHookRule{shipout/background}{draftwatermark}{<}{eso-pic} |
| 1035 |
% \end{macrocode} |
| 1036 |
% \iffalse |
| 1037 |
%</draftwatermark> |
| 1038 |
% \fi |
| 1039 |
% |
| 1040 |
% \subsection{Implementation of \Lpack{draftwatermark-2x}} |
| 1041 |
% |
| 1042 |
% Announce the name and version of the package, which requires |
| 1043 |
% \LaTeXe. |
| 1044 |
% \changes{R3.2}{2024/03/03}{Fix name of legacy package.} |
| 1045 |
% \iffalse |
| 1046 |
%<*draftwatermark-2x> |
| 1047 |
% \fi |
| 1048 |
% \begin{macrocode} |
| 1049 |
\NeedsTeXFormat{LaTeX2e} |
| 1050 |
\ProvidesPackage{draftwatermark-2x}% |
| 1051 |
[2020/12/06 2.3 Put a gray textual watermark on document pages] |
| 1052 |
|
| 1053 |
% \end{macrocode} |
| 1054 |
% |
| 1055 |
% Require the needed packages. |
| 1056 |
% \begin{macrocode} |
| 1057 |
\RequirePackage{kvoptions} |
| 1058 |
\RequirePackage{everypage}[2007/06/20] |
| 1059 |
\RequirePackage{graphicx} |
| 1060 |
\RequirePackage{color} |
| 1061 |
|
| 1062 |
% \end{macrocode} |
| 1063 |
% Set up options and assumptions for the \Lpack{kvoptions} package |
| 1064 |
% \begin{macrocode} |
| 1065 |
\SetupKeyvalOptions{family=draftwatermark, prefix=draftwatermark@} |
| 1066 |
|
| 1067 |
% \end{macrocode} |
| 1068 |
% |
| 1069 |
% Define the configuration options and default values. |
| 1070 |
% \begin{macrocode} |
| 1071 |
\DeclareBoolOption[false]{firstpageonly} |
| 1072 |
\define@key{draftwatermark}{firstpage}[true]{% |
| 1073 |
\csname draftwatermark@firstpageonly#1\endcsname} |
| 1074 |
\DeclareBoolOption[true]{stamp} |
| 1075 |
\DeclareComplementaryOption{nostamp}{stamp} |
| 1076 |
\DeclareComplementaryOption{final}{stamp} |
| 1077 |
\DeclareStringOption[45]{angle} |
| 1078 |
\DeclareStringOption[1]{scale} |
| 1079 |
\DeclareStringOption[DRAFT]{text} |
| 1080 |
\DeclareStringOption[0.5\paperwidth]{hpos} |
| 1081 |
\DeclareStringOption[0.5\paperheight]{vpos} |
| 1082 |
\DeclareStringOption[0.25\paperwidth]{fontsize} |
| 1083 |
\DeclareStringOption[gray]{colormodel} |
| 1084 |
\DeclareStringOption[0.8]{colorspec} |
| 1085 |
\DeclareStringOption[c]{hanchor} |
| 1086 |
\DeclareStringOption[m]{vanchor} |
| 1087 |
\DeclareStringOption[c]{alignment} |
| 1088 |
\DeclareStringOption[\DraftwatermarkStdMark]{markcmd} |
| 1089 |
\define@key{draftwatermark}{pos}{% |
| 1090 |
\draftwatermark@processpos #1\@nil} |
| 1091 |
\define@key{draftwatermark}{anchor}{% |
| 1092 |
\draftwatermark@processanchor{#1}} |
| 1093 |
\define@key{draftwatermark}{color}{% |
| 1094 |
\draftwatermark@processcolor #1\@nil} |
| 1095 |
|
| 1096 |
% \end{macrocode} |
| 1097 |
% |
| 1098 |
% Set up some helper marcros to process the options. These should be |
| 1099 |
% rather self-explanatory. |
| 1100 |
% \begin{macrocode} |
| 1101 |
\def\draftwatermark@processpos#1,#2\@nil{% |
| 1102 |
\def\draftwatermark@hpos{#1}% |
| 1103 |
\def\draftwatermark@vpos{#2}} |
| 1104 |
|
| 1105 |
\def\draftwatermark@processanchor#1{% |
| 1106 |
\def\draftwatermark@tempa{#1} |
| 1107 |
\@onelevel@sanitize \draftwatermark@tempa |
| 1108 |
\expandafter \@tfor \expandafter \draftwatermark@tempb |
| 1109 |
\expandafter :\expandafter =\draftwatermark@tempa |
| 1110 |
\do |
| 1111 |
{% |
| 1112 |
\if \draftwatermark@tempb l% |
| 1113 |
\def \draftwatermark@hanchor{l}% |
| 1114 |
\else \if \draftwatermark@tempb c% |
| 1115 |
\def \draftwatermark@hanchor{c}% |
| 1116 |
\else \if \draftwatermark@tempb r% |
| 1117 |
\def \draftwatermark@hanchor{r}% |
| 1118 |
\else \if \draftwatermark@tempb t% |
| 1119 |
\def \draftwatermark@vanchor{t}% |
| 1120 |
\else \if \draftwatermark@tempb m% |
| 1121 |
\def \draftwatermark@vanchor{m}% |
| 1122 |
\else \if \draftwatermark@tempb b% |
| 1123 |
\def \draftwatermark@vanchor{b} |
| 1124 |
\else |
| 1125 |
\PackageError{draftwatermark}{% |
| 1126 |
Illegal anchor directive `\draftwatermark@tempb'}% |
| 1127 |
{Directive has been ingnored.}% |
| 1128 |
\fi\fi\fi\fi\fi\fi |
| 1129 |
}} |
| 1130 |
|
| 1131 |
\def\draftwatermark@processcolor{% |
| 1132 |
\@ifnextchar[ |
| 1133 |
\draftwatermark@processcolor@ii\draftwatermark@processcolor@i} |
| 1134 |
|
| 1135 |
\def\draftwatermark@processcolor@i#1\@nil{% |
| 1136 |
\def\draftwatermark@colormodel{}% |
| 1137 |
\def\draftwatermark@colorspec{#1}} |
| 1138 |
|
| 1139 |
\def\draftwatermark@processcolor@ii[#1]#2\@nil{% |
| 1140 |
\def\draftwatermark@colormodel{#1}% |
| 1141 |
\def\draftwatermark@colorspec{#2}} |
| 1142 |
|
| 1143 |
% \end{macrocode} |
| 1144 |
% |
| 1145 |
% Process the package options\dots |
| 1146 |
% \begin{macrocode} |
| 1147 |
\ProcessKeyvalOptions* |
| 1148 |
% \end{macrocode} |
| 1149 |
% |
| 1150 |
% \dots\, and then disable the |firstpageonly| and |firstpage| options, |
| 1151 |
% that can only be used at the package loading time. |
| 1152 |
% \begin{macrocode} |
| 1153 |
\DisableKeyvalOption{draftwatermark}{firstpageonly} |
| 1154 |
\DisableKeyvalOption{draftwatermark}{firstpage} |
| 1155 |
|
| 1156 |
% \end{macrocode} |
| 1157 |
% |
| 1158 |
% \begin{macro}{\DraftwatermarkOptions} |
| 1159 |
% Set up a command to modify the configuration as needed. |
| 1160 |
% \begin{macrocode} |
| 1161 |
\newcommand\DraftwatermarkOptions[1]{\setkeys{draftwatermark}{#1}} |
| 1162 |
|
| 1163 |
% \end{macrocode} |
| 1164 |
% \end{macro} |
| 1165 |
% |
| 1166 |
% Introduce the legacy interface. |
| 1167 |
% \begin{macro}{\SetWatermarkAngle} |
| 1168 |
% Legacy command to set the rotation angle for the standard watermark |
| 1169 |
% \begin{macrocode} |
| 1170 |
\newcommand\SetWatermarkAngle[1]{\DraftwatermarkOptions{angle=#1}} |
| 1171 |
% \end{macrocode} |
| 1172 |
% \end{macro} |
| 1173 |
% \begin{macro}{\SetWatermarkFontSize} |
| 1174 |
% Legacy command to set the font size for the standard watermark |
| 1175 |
% \begin{macrocode} |
| 1176 |
\newcommand\SetWatermarkFontSize[1]{\DraftwatermarkOptions{fontsize=#1}} |
| 1177 |
% \end{macrocode} |
| 1178 |
% \end{macro} |
| 1179 |
% \begin{macro}{\SetWatermarkScale} |
| 1180 |
% Legacy command to set the scale for the standard watermark |
| 1181 |
% \begin{macrocode} |
| 1182 |
\newcommand\SetWatermarkScale[1]{\DraftwatermarkOptions{scale=#1}} |
| 1183 |
% \end{macrocode} |
| 1184 |
% \end{macro} |
| 1185 |
% \begin{macro}{\SetWatermarkHorCenter} |
| 1186 |
% \begin{macro}{\SetWatermarkVerCenter} |
| 1187 |
% Legacy commands to set the horizontal and vertical position for the |
| 1188 |
% standard watermark, also forcing it to be centered there. |
| 1189 |
% \begin{macrocode} |
| 1190 |
\newcommand\SetWatermarkHorCenter[1]{% |
| 1191 |
\DraftwatermarkOptions{hpos=#1, hanchor=c}} |
| 1192 |
\newcommand\SetWatermarkVerCenter[1]{% |
| 1193 |
\DraftwatermarkOptions{vpos=#1, vanchor=m}} |
| 1194 |
% \end{macrocode} |
| 1195 |
% \end{macro} |
| 1196 |
% \end{macro} |
| 1197 |
% \begin{macro}{\SetWatermarkText} |
| 1198 |
% \changes{R2.3}{2020/12/06}{Fix legacy interface to accept |
| 1199 |
% text including commas.}^^A |
| 1200 |
% Legacy command to set the text of the standard watermark |
| 1201 |
% \begin{macrocode} |
| 1202 |
\newcommand\SetWatermarkText[1]{\DraftwatermarkOptions{text={#1}}} |
| 1203 |
% \end{macrocode} |
| 1204 |
% \end{macro} |
| 1205 |
% \begin{macro}{\SetWatermarColor} |
| 1206 |
% \begin{macro}{\SetWatermarkLightness} |
| 1207 |
% Legacy commands to set the color for the |
| 1208 |
% standard watermark. |
| 1209 |
% \begin{macrocode} |
| 1210 |
\newcommand\SetWatermarkColor[2][]{% |
| 1211 |
\DraftwatermarkOptions{colormodel=#1, colorspec=#2}} |
| 1212 |
\newcommand\SetWatermarkLightness[1]{% |
| 1213 |
\DraftwatermarkOptions{colormodel=gray, colorspec=#1}} |
| 1214 |
|
| 1215 |
% \end{macrocode} |
| 1216 |
% \end{macro} |
| 1217 |
% \end{macro} |
| 1218 |
% |
| 1219 |
% \begin{macro}{\DraftwatermarkStdMark} |
| 1220 |
% The command to generate the standard watermark |
| 1221 |
% \begin{macrocode} |
| 1222 |
\newcommand\DraftwatermarkStdMark{% |
| 1223 |
\rotatebox{\draftwatermark@angle}{% |
| 1224 |
\scalebox{\draftwatermark@scale}{% |
| 1225 |
\begingroup |
| 1226 |
\ifx\draftwatermark@colormodel\@empty |
| 1227 |
\color{\draftwatermark@colorspec}% |
| 1228 |
\else |
| 1229 |
\color[\draftwatermark@colormodel]{\draftwatermark@colorspec}% |
| 1230 |
\fi |
| 1231 |
\setlength{\@tempdima}{\draftwatermark@fontsize}% |
| 1232 |
\fontsize{\@tempdima}{1.2\@tempdima}\selectfont |
| 1233 |
\shortstack[\draftwatermark@alignment]{\draftwatermark@text}% |
| 1234 |
\endgroup}}} |
| 1235 |
|
| 1236 |
% \end{macrocode} |
| 1237 |
% \end{macro} |
| 1238 |
% |
| 1239 |
% The code to actually print the watermark |
| 1240 |
% \begin{macrocode} |
| 1241 |
\newcommand\draftwatermark@printwm[1]{% |
| 1242 |
\sbox\@tempboxa{#1}% |
| 1243 |
\setlength{\@tempdima}{\draftwatermark@hpos}% |
| 1244 |
\setlength{\@tempdimb}{\draftwatermark@vpos}% |
| 1245 |
\edef \draftwatermark@tempa{\draftwatermark@hanchor}% |
| 1246 |
\@onelevel@sanitize \draftwatermark@tempa |
| 1247 |
\expandafter\def\expandafter\draftwatermark@tempb |
| 1248 |
\expandafter{\expandafter\@car \draftwatermark@tempa\@nil}% |
| 1249 |
\if \draftwatermark@tempb r% |
| 1250 |
\addtolength\@tempdima{-\wd\@tempboxa}% |
| 1251 |
\else\if \draftwatermark@tempb c% |
| 1252 |
\addtolength\@tempdima{-0.5\wd\@tempboxa}% |
| 1253 |
\else\if \draftwatermark@tempb l% |
| 1254 |
\relax |
| 1255 |
\else |
| 1256 |
\PackageError{draftwatermark}{% |
| 1257 |
Illegal anchor directive `\draftwatermark@tempb'}% |
| 1258 |
{Anchoring to left side.}% |
| 1259 |
\fi\fi\fi |
| 1260 |
\edef \draftwatermark@tempa{\draftwatermark@vanchor}% |
| 1261 |
\@onelevel@sanitize \draftwatermark@tempa |
| 1262 |
\expandafter\def\expandafter\draftwatermark@tempb |
| 1263 |
\expandafter{\expandafter\@car \draftwatermark@tempa\@nil}% |
| 1264 |
\if \draftwatermark@tempb b% |
| 1265 |
\addtolength\@tempdimb{-\ht\@tempboxa}% |
| 1266 |
\addtolength\@tempdimb{-\dp\@tempboxa}% |
| 1267 |
\else\if \draftwatermark@tempb m% |
| 1268 |
\addtolength\@tempdimb{-0.5\ht\@tempboxa}% |
| 1269 |
\addtolength\@tempdimb{-0.5\dp\@tempboxa}% |
| 1270 |
\else\if \draftwatermark@tempb t% |
| 1271 |
\relax |
| 1272 |
\else |
| 1273 |
\PackageError{draftwatermark}{% |
| 1274 |
Illegal anchor directive `\draftwatermark@tempb'}% |
| 1275 |
{Anchoring to top side.}% |
| 1276 |
\fi\fi\fi |
| 1277 |
\vbox to 0pt {% |
| 1278 |
\vspace*{-1in}% |
| 1279 |
\vspace*{\@tempdimb}% |
| 1280 |
\hbox to 0pt {% |
| 1281 |
\hspace*{-1in}% |
| 1282 |
\hspace*{\@tempdima}% |
| 1283 |
\usebox\@tempboxa |
| 1284 |
\hss}% |
| 1285 |
\vss}} |
| 1286 |
|
| 1287 |
% \end{macrocode} |
| 1288 |
% |
| 1289 |
% A wrapper to make the watermark printing conditional |
| 1290 |
% \begin{macrocode} |
| 1291 |
\newcommand\draftwatermark@print[1]{% |
| 1292 |
\ifdraftwatermark@stamp |
| 1293 |
\draftwatermark@printwm{#1}% |
| 1294 |
\fi} |
| 1295 |
% \end{macrocode} |
| 1296 |
% |
| 1297 |
% \dots\, and finally the code to set up the \Lpack{everypage} hooks to |
| 1298 |
% assure that the watermark printing commands are called when needed |
| 1299 |
% \begin{macrocode} |
| 1300 |
\ifdraftwatermark@firstpageonly |
| 1301 |
\AddThispageHook{\draftwatermark@print{\draftwatermark@markcmd}} |
| 1302 |
\else |
| 1303 |
\AddEverypageHook{\draftwatermark@print{\draftwatermark@markcmd}} |
| 1304 |
\fi |
| 1305 |
% \end{macrocode} |
| 1306 |
% \iffalse |
| 1307 |
%</draftwatermark-2x> |
| 1308 |
% \fi |
| 1309 |
% |
| 1310 |
% |
| 1311 |
% \Finale |
| 1312 |
% \PrintChanges |
| 1313 |
% \pagebreak[1] |
| 1314 |
% \PrintIndex |
| 1315 |
% |
| 1316 |
% \CharacterTable |
| 1317 |
% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z |
| 1318 |
% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z |
| 1319 |
% Digits \0\1\2\3\4\5\6\7\8\9 |
| 1320 |
% Exclamation \! Double quote \" Hash (number) \# |
| 1321 |
% Dollar \$ Percent \% Ampersand \& |
| 1322 |
% Acute accent \' Left paren \( Right paren \) |
| 1323 |
% Asterisk \* Plus \+ Comma \, |
| 1324 |
% Minus \- Point \. Solidus \/ |
| 1325 |
% Colon \: Semicolon \; Less than \< |
| 1326 |
% Equals \= Greater than \> Question mark \? |
| 1327 |
% Commercial at \@ Left bracket \[ Backslash \\ |
| 1328 |
% Right bracket \] Circumflex \^ Underscore \_ |
| 1329 |
% Grave accent \` Left brace \{ Vertical bar \| |
| 1330 |
% Right brace \} Tilde \~} |
| 1331 |
\endinput |
| 1332 |
|
| 1333 |
%%% Local Variables: |
| 1334 |
%%% mode: doctex |
| 1335 |
%%% TeX-master: t |
| 1336 |
%%% End: |