summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/draftwatermark
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2020-05-12 03:03:03 +0000
committerNorbert Preining <norbert@preining.info>2020-05-12 03:03:03 +0000
commit675bcc9067ccef91624a9eca025506a4ce1d37b3 (patch)
tree03c68d83f091c038ad751310955938e407b46ff4 /macros/latex/contrib/draftwatermark
parentfd95e879442e050790f06552eb074eeb7c5b4cab (diff)
CTAN sync 202005120303
Diffstat (limited to 'macros/latex/contrib/draftwatermark')
-rw-r--r--macros/latex/contrib/draftwatermark/README34
-rw-r--r--macros/latex/contrib/draftwatermark/README.md33
-rw-r--r--macros/latex/contrib/draftwatermark/draftwatermark.dtx105
-rw-r--r--macros/latex/contrib/draftwatermark/draftwatermark.ins36
-rw-r--r--macros/latex/contrib/draftwatermark/draftwatermark.pdfbin182386 -> 264359 bytes
5 files changed, 130 insertions, 78 deletions
diff --git a/macros/latex/contrib/draftwatermark/README b/macros/latex/contrib/draftwatermark/README
deleted file mode 100644
index 9d68bbedc5..0000000000
--- a/macros/latex/contrib/draftwatermark/README
+++ /dev/null
@@ -1,34 +0,0 @@
-The "draftwatermark" package extends LaTeX providing a means to add a textual
-gray or colored watermark on every page or on the first page of a
-document. Typical usage may consist in writing words such as "DRAFT" or
-"CONFIDENTIAL" across document pages. The package may remind in some sense
-"draftcopy" by Dr. Juergen Vollmer, but its implementation is lighter (as the
-reduced code footprint shows) and does not rely on postscript specials, making
-the package fully compatible with pdfLaTeX, xelatex and lualatex. The package
-depends on package "everypage" by the same author.
-
-The package focus is on simplicity, for complex layouts please consider
-scrlayer.sty in the KOMA script bundle.
-
-The "draftwatermark" package is copyright 2006, 2012, 2020 by Sergio Callegari
-<sergio.callegari@gmail.com>
-
-It comprises this README file, as well as files
-draftwatermark.dtx
-draftwatermark.ins
-
-To install the package, run LaTeX on the installation script
-draftwatermark.ins and follow the instructions provided by the script
-itself.
-
-"draftwatermark" may be distributed and/or modified under the
-conditions of the LaTeX Project Public License, either version 1.3 of
-this licence, or any later version. The latest version of this license
-is at http://www.latex-project.org/lppl.txt and version 1.3 is part of
-all distributions of LaTeX version 2003/06/01 or later.
-
-This work has the LPPL maintenance status "author-maintained".
-
-Development happens on github at
- https://github.com/callegar/LaTeX-draftwatermark
-Please refer to that site for bug tracking. \ No newline at end of file
diff --git a/macros/latex/contrib/draftwatermark/README.md b/macros/latex/contrib/draftwatermark/README.md
new file mode 100644
index 0000000000..7b22c3a1fc
--- /dev/null
+++ b/macros/latex/contrib/draftwatermark/README.md
@@ -0,0 +1,33 @@
+# The `draftwatermark` LaTeX package
+
+The `draftwatermark` package extends LaTeX providing a means to add a textual
+gray or colored watermark on every page or on the first page of a
+document. Typical usage may consist in writing words such as "DRAFT" or
+"CONFIDENTIAL" across document pages. The package may remind in some sense
+`draftcopy` by Dr. Juergen Vollmer, but its implementation is lighter (as the
+reduced code footprint shows) and does not rely on postscript specials, making
+the package fully compatible with pdfLaTeX, XeLaTeX and LuaLaTeX. The package
+depends on `everypage.sty` by the same author.
+
+The package focus is on simplicity, for complex layouts please consider
+`scrlayer.sty` in the KOMA script bundle.
+
+The `draftwatermark` package is copyright 2006, 2012, 2020 by Sergio Callegari
+<sergio.callegari@gmail.com>.
+
+This work consists of this `README.md` file, as well as files `draftwatermark.dtx`,
+`draftwatermark.ins` and the derived file `draftwatermark.sty`.
+
+To install the package, run LaTeX on the installation script
+`draftwatermark.ins` and follow the instructions provided by the script itself.
+
+This work may be distributed and/or modified under the conditions of the LaTeX
+Project Public License version 1.3. This license is available at
+<https://www.latex-project.org/lppl/> and it is part of all distributions of
+LaTeX version 2005/12/01 or later.
+
+This work has the LPPL maintenance status "author-maintained".
+
+Development happens on github at
+<https://github.com/callegar/LaTeX-draftwatermark>. Please refer to that site
+for bug tracking.
diff --git a/macros/latex/contrib/draftwatermark/draftwatermark.dtx b/macros/latex/contrib/draftwatermark/draftwatermark.dtx
index 2cd35a1bbd..ab5cb3b948 100644
--- a/macros/latex/contrib/draftwatermark/draftwatermark.dtx
+++ b/macros/latex/contrib/draftwatermark/draftwatermark.dtx
@@ -9,10 +9,9 @@
% ---------------------------------------------
%
% It may be distributed and/or modified under the conditions of the
-% LaTeX Project Public License, either version 1.3 of this licence, or
-% any later version. The latest version of this license is at
-% http://www.latex-project.org/lppl.txt and version 1.3 is part
-% of all distributions of LaTeX version 2003/06/01 or later.
+% LaTeX Project Public License, version 1.3. This license is at
+% https://www.latex-project.org/lppl/ and is part
+% of all distributions of LaTeX version 2005/12/01 or later.
%
% This work has the LPPL maintenance status "author-maintained".
%
@@ -45,7 +44,7 @@
\DoNotIndex{\DeclareBoolOption, \DeclareComplementaryOption,
\DeclareStringOption, \def, \define@key, \dimexpr, \DisableKeyvalOption,
\do, \documentclass, \dp}
-\DoNotIndex{\expandafter}
+\DoNotIndex{\edef, \expandafter}
\DoNotIndex{\fbox, \fontsize}
\DoNotIndex{\hbox, \hspace, \hss, \ht}
\DoNotIndex{\let, \lipsum}
@@ -73,9 +72,9 @@
% \CheckSum{288}
%
% \def\filename{draftwatermark.dtx}
-% \def\fileversion{2.0}
-% \def\filedate{2020/03/14}
-% \def\docdate{2020/03/14}
+% \def\fileversion{2.1}
+% \def\filedate{2020/05/11}
+% \def\docdate{2020/05/11}
%
% \newcommand*{\Lpack}[1]{\textsf {#1}} ^^A typeset a package
% \newcommand*{\Lopt}[1]{\texttt {#1}} ^^A typeset an option
@@ -245,8 +244,8 @@
% Defines the horizontal position of the watermark anchor
% point. Specifically, |l| stands for \emph{left}, |c| for \emph{center}
% and |r| for \emph{right}. See also the |anchor| option.
-% \item \verb!hanchor=t|m|b!\\
-% Default is |c|.\\
+% \item \verb!vanchor=t|m|b!\\
+% Default is |m|.\\
% Defines the vertical position of the watermark anchor
% point. Specifically, |t| stands for \emph{top}, |m| for \emph{middle}
% and |b| for \emph{bottom}. See also the |anchor| option.
@@ -385,13 +384,22 @@
%
% As a final remark, observe that the specification of the positioning
% coordinates can be based on \LaTeX\ macros. For instance, one can set
-% the horizontal position at |0.5\paperwidth| (for centering) or at
+% the horizontal position |hpos| at |0.5\paperwidth| (for centering) or at
% |\dimexpr\paperwidth-5mm| (for placement at the right hand side of the
% page). Interestingly, \Lpack{draftwatermark} re-evaluates the
% positioning coordinates on every page. This means that positions based
% on |\paperwidth| or |\paperheight| should dynamically adjust if the page
-% size is changed through the document.
-%
+% size is changed through the document. To some extent, this is also true
+% of the anchor options. For instance, one may set the horizontal anchor
+% |hanchor| at |\ifodd\thepage r\else l\fi| causing the anchor point to
+% alternate between |r| and |l| at every new page. In conjunction with a
+% similarly conditional |hpos| setting, for instance
+% |\ifodd\thepage \dimexpr\paperwidth-5mm\else 5mm\fi|, this enables
+% interesting effects, like placing the watermark close to the right side
+% of the page on odd pages and to the left side of the page on even
+% pages. Obviously, this kind of setting is only applicable with the
+% |hanchor| and |vanchor| options, and not with the |anchor| shorthand.
+%
% \section{The standard watermark and ways of overriding it}
% \label{sec:markcmd}
%
@@ -426,8 +434,7 @@
%
% \end{sloppy}
%
-% \section{Compatibility notes for version 2.0 of the package and later
-% versions}
+% \section{Compatibility notes for package version 2.0 and later}
%
% Version 2.0 of the package is an almost complete rewrite with respect to
% version 1.2. Specifically, all the configuration mechanism has been
@@ -477,6 +484,7 @@
% possible with the modern interface.
%
% \section{Examples}
+% \label{sec:examples}
%
% \subsection{Plain case, using the modern package interface}
%
@@ -590,13 +598,56 @@
% \fi
% \makeatletter \c@CodelineNo\z@ \makeatother
%
+% Another interesting possibility of the modern interface derives from the
+% fact that the positioning and anchoring options are re-evaluated for
+% every page. This allows the positioning to dynamically change following
+% other parameters (for instance the |\paperwidth|) or to take advantage
+% of conditionals to achieve effects such as differentiating the watermark
+% for odd and even pages, as shown in the following code:
+% \iffalse
+%<*samplecode-dynamic>
+% \fi
+% \begin{macrocode}
+\documentclass{article}
+\usepackage[named]{xcolor}
+\usepackage[T1]{fontenc}
+\usepackage[color=red, fontsize=32pt]{draftwatermark}
+\usepackage{mathptmx}
+\usepackage{lipsum}
+\title{Sample document for the draftwatermark package}
+\author{}
+
+\DraftwatermarkOptions{%
+ angle=0,
+ text={\ifodd\thepage ODD\else EVEN\fi},
+ hpos={\ifodd\thepage \dimexpr\paperwidth-5mm\else 5mm\fi},
+ vpos=5mm,
+ vanchor=t,
+ hanchor={\ifodd\thepage r\else l\fi}
+}
+
+\begin{document}
+\maketitle
+
+\section{One}
+\lipsum[1-3]
+
+\section{Two}
+\lipsum[4-6]
+
+\end{document}
+% \end{macrocode}
+% \iffalse
+%</samplecode-dynamic>
+% \fi
+% \makeatletter \c@CodelineNo\z@ \makeatother
+%
% \subsection{Maximum freedom with a custom watermarking command}
%
-% As a final example, see how maximum freedom can be obtained with a
-% custom watermarking command. The following document source lets one have
-% a watermark on the top right corner of odd pages and on the top left
-% corner of even pages.
-% \iffalse
+% Maximum freedom can be obtained with a custom watermarking command. The
+% following example shows how it can be used, once again differentiating
+% the watermark for odd and even pages.
+%\iffalse
%<*samplecode-custom>
% \fi
% \begin{macrocode}
@@ -659,6 +710,8 @@
% \item[1.2 - 2015/02/19] Add support for watermark position.
% \item[2.0 - 2020/03/08] Configuration management overhaul; introduction
% of a legacy interface for compatibility.
+% \item[2.1 - 2020/05/11] Allow anchor information to be re-evaluated on
+% every page
% \end{description}
%
% \StopEventually {}
@@ -673,7 +726,7 @@
% \begin{macrocode}
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{draftwatermark}%
- [2020/03/14 2.0 Put a gray textual watermark on document pages]
+ [2020/05/11 2.1 Put a gray textual watermark on document pages]
% \end{macrocode}
%
@@ -859,10 +912,10 @@
\sbox\@tempboxa{#1}%
\setlength{\@tempdima}{\draftwatermark@hpos}%
\setlength{\@tempdimb}{\draftwatermark@vpos}%
- \let \draftwatermark@tempa \draftwatermark@hanchor
+ \edef \draftwatermark@tempa{\draftwatermark@hanchor}%
\@onelevel@sanitize \draftwatermark@tempa
\expandafter\def\expandafter\draftwatermark@tempb
- \expandafter{\expandafter\@car \draftwatermark@tempa\@nil}
+ \expandafter{\expandafter\@car \draftwatermark@tempa\@nil}%
\if \draftwatermark@tempb r%
\addtolength\@tempdima{-\wd\@tempboxa}%
\else\if \draftwatermark@tempb c%
@@ -874,10 +927,10 @@
Illegal anchor directive `\draftwatermark@tempb'}%
{Anchoring to left side.}%
\fi\fi\fi
- \let \draftwatermark@tempa \draftwatermark@vanchor
+ \edef \draftwatermark@tempa{\draftwatermark@vanchor}%
\@onelevel@sanitize \draftwatermark@tempa
\expandafter\def\expandafter\draftwatermark@tempb
- \expandafter{\expandafter\@car \draftwatermark@tempa\@nil}
+ \expandafter{\expandafter\@car \draftwatermark@tempa\@nil}%
\if \draftwatermark@tempb b%
\addtolength\@tempdimb{-\ht\@tempboxa}%
\addtolength\@tempdimb{-\dp\@tempboxa}%
@@ -891,7 +944,7 @@
Illegal anchor directive `\draftwatermark@tempb'}%
{Anchoring to top side.}%
\fi\fi\fi
- \vbox to 0pt {
+ \vbox to 0pt {%
\vspace*{-1in}%
\vspace*{\@tempdimb}%
\hbox to 0pt {%
diff --git a/macros/latex/contrib/draftwatermark/draftwatermark.ins b/macros/latex/contrib/draftwatermark/draftwatermark.ins
index f1ec2f8ded..1365e64ebf 100644
--- a/macros/latex/contrib/draftwatermark/draftwatermark.ins
+++ b/macros/latex/contrib/draftwatermark/draftwatermark.ins
@@ -1,5 +1,5 @@
%% draftwatermark.ins
-%% Copyright 2006
+%% Copyright 2006-2020
%% Sergio Callegari <sergio.callegari@gmail.com>
%%
%% ---------------------------------------------
@@ -7,15 +7,14 @@
%% a contribution to the LaTeX2e system.
%% ---------------------------------------------
%%
-%% It may be distributed and/or modified under the conditions of the
-%% LaTeX Project Public License, either version 1.3 of this licence, or
-%% any later version. The latest version of this license is at
-%% http://www.latex-project.org/lppl.txt and version 1.3 is part
-%% of all distributions of LaTeX version 2003/06/01 or later.
+%% It may be distributed and/or modified under the conditions of the LaTeX
+%% Project Public License, version 1.3. The license is at
+%% https://www.latex-project.org/lppl/ and is part of all distributions of
+%% LaTeX version 2005/12/01 or later.
%%
%% This work has the LPPL maintenance status "author-maintained".
%%
-%% This program consists of the files listed in the README file
+%% This program consists of the files listed in the README.md file
%% included in the package.
%%
%% This file will generate fast loadable files and documentation
@@ -36,24 +35,23 @@
Copyright 2006, 2020
Sergio Callegari <sergio.callegari@gmail.com>
----------------------------------------------
+------------------------------------------------
This file is part of the draftwatermark package,
a contribution to the LaTeX2e system.
----------------------------------------------
+------------------------------------------------
-This program consists of the files listed in the README file included
+This program consists of the files listed in the README.md file included
in the package.
-Any modified versions of this file must be renamed with new filenames
-distinct from draftwatermark.sty.
+Any modified versions of this file must be renamed with new filenames distinct
+from draftwatermark.sty.
-For distribution of the original source see the terms
-for copying and modification in the file draftwatermark.dtx.
+For distribution of the original source see the terms for copying and
+modification in the file draftwatermark.dtx.
-This generated file may be distributed as long as the
-original source files, as listed above, are part of the
-same distribution. (The sources need not necessarily be
-in the same archive or directory.)
+This generated file may be distributed as long as the original source files, as
+listed above, are part of the same distribution. (The sources need not
+necessarily be in the same archive or directory.)
\endpreamble
@@ -72,6 +70,8 @@ in the same archive or directory.)
\generate{\file{test_draftwatermark3.tex}{%
\from{draftwatermark.dtx}{samplecode-anchor}}}
\generate{\file{test_draftwatermark4.tex}{%
+ \from{draftwatermark.dtx}{samplecode-dynamic}}}
+\generate{\file{test_draftwatermark5.tex}{%
\from{draftwatermark.dtx}{samplecode-custom}}}
%\ReportTotals
diff --git a/macros/latex/contrib/draftwatermark/draftwatermark.pdf b/macros/latex/contrib/draftwatermark/draftwatermark.pdf
index 41c67efb51..059d0262dc 100644
--- a/macros/latex/contrib/draftwatermark/draftwatermark.pdf
+++ b/macros/latex/contrib/draftwatermark/draftwatermark.pdf
Binary files differ