summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/draftwatermark
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2020-05-11 20:42:09 +0000
committerKarl Berry <karl@freefriends.org>2020-05-11 20:42:09 +0000
commit6770f17a2f7fa550295689a526e402c30e1eec23 (patch)
tree7d40e3d73db84a354b54111cb1950c372d96013b /Master/texmf-dist/source/latex/draftwatermark
parent84f8b847502b28b3479b816502152a0a627c87ed (diff)
draftwatermark (11may20)
git-svn-id: svn://tug.org/texlive/trunk@55096 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/draftwatermark')
-rw-r--r--Master/texmf-dist/source/latex/draftwatermark/draftwatermark.dtx105
-rw-r--r--Master/texmf-dist/source/latex/draftwatermark/draftwatermark.ins36
2 files changed, 97 insertions, 44 deletions
diff --git a/Master/texmf-dist/source/latex/draftwatermark/draftwatermark.dtx b/Master/texmf-dist/source/latex/draftwatermark/draftwatermark.dtx
index 2cd35a1bbd5..ab5cb3b948e 100644
--- a/Master/texmf-dist/source/latex/draftwatermark/draftwatermark.dtx
+++ b/Master/texmf-dist/source/latex/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/Master/texmf-dist/source/latex/draftwatermark/draftwatermark.ins b/Master/texmf-dist/source/latex/draftwatermark/draftwatermark.ins
index f1ec2f8ded5..1365e64ebf6 100644
--- a/Master/texmf-dist/source/latex/draftwatermark/draftwatermark.ins
+++ b/Master/texmf-dist/source/latex/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