summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2012-01-07 22:38:54 +0000
committerKarl Berry <karl@freefriends.org>2012-01-07 22:38:54 +0000
commitb046744bca2935037aca08e50dd3f3c3144c6b4a (patch)
tree3afa39918e7bd56359b2d2b50eee8cf686aba0a6 /Master/texmf-dist/source
parent08586a5439b9e8085cb17971b217c8a3b00dd8c3 (diff)
draftwatermark (7jan12)
git-svn-id: svn://tug.org/texlive/trunk@25045 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source')
-rw-r--r--Master/texmf-dist/source/latex/draftwatermark/draftwatermark.dtx250
-rw-r--r--Master/texmf-dist/source/latex/draftwatermark/draftwatermark.ins39
2 files changed, 221 insertions, 68 deletions
diff --git a/Master/texmf-dist/source/latex/draftwatermark/draftwatermark.dtx b/Master/texmf-dist/source/latex/draftwatermark/draftwatermark.dtx
index 48d6458be6c..b3ac3454415 100644
--- a/Master/texmf-dist/source/latex/draftwatermark/draftwatermark.dtx
+++ b/Master/texmf-dist/source/latex/draftwatermark/draftwatermark.dtx
@@ -1,6 +1,6 @@
% \iffalse meta-comment
%
-% Copyright 2006
+% Copyright 2006, 2012
% Sergio Callegari <sergio.callegari@gmail.com>
%
% ---------------------------------------------
@@ -22,14 +22,31 @@
%<*driver>
\documentclass{ltxdoc}
\usepackage{mathptmx, helvet, courier}
+\usepackage[utf8]{inputenc}
+\usepackage[T1]{fontenc}
+\usepackage{textcomp}
+\usepackage{url}
\EnableCrossrefs
\DoNotIndex{\def,\gdef,\let,\NeedsTeXFormat,\newcommand}
\DoNotIndex{\ProvidesPackage,\endinput}
\DoNotIndex{\box,\dp,\fontsize,\ifx,\else,\fi}
\DoNotIndex{\hbox,\hss,\makebox,\moveleft,\newif,\newlength}
\DoNotIndex{\ProcessOptions,\vbox,\vss,\z@}
+\DoNotIndex{\AddEverypageHook,\AddThispageHook}
+\DoNotIndex{\@tempboxa,\@tempdimb,\@tempdimc}
+\DoNotIndex{\begin}
+\DoNotIndex{\DeclareOption,\documentclass}
+\DoNotIndex{\end,\expandafter}
+\DoNotIndex{\maketitle}
+\DoNotIndex{\paperheight,\paperwidth,\put}
+\DoNotIndex{\RequirePackage,\rotatebox}
+\DoNotIndex{\scalebox,\section,\selectfont,\setbox,\setlength}
+\DoNotIndex{\strip@pt}
+\DoNotIndex{\textcolor,\title}
+\DoNotIndex{\usepackage}
+\DoNotIndex{\vskip}
\CodelineIndex
-\RecordChanges
+%\RecordChanges
\begin{document}
\DocInput{draftwatermark.dtx}
\end{document}
@@ -37,12 +54,12 @@
%
% \fi
%
-% \CheckSum{96}
+% \CheckSum{125}
%
% \def\filename{draftwatermark.dtx}
-% \def\fileversion{1.0}
-% \def\filedate{2006/06/30}
-% \def\docdate{2006/06/30}
+% \def\fileversion{1.1}
+% \def\filedate{2012/01/06}
+% \def\docdate{2012/01/06}
%
% \newcommand*{\Lpack}[1]{\textsf {#1}} ^^A typeset a package
% \newcommand*{\Lopt}[1]{\textsf {#1}} ^^A typeset an option
@@ -57,34 +74,33 @@
%
% \author{%
% Sergio Callegari\thanks{Sergio Callegari can be reached at
-% \texttt{sergio.callegar at gmail dot com}}}
+% \texttt{sergio.callegari at gmail dot com}}}
%
% \date{\docdate}
%
% \maketitle
%
% \begin{abstract}
-% The \Lpack{draftwatermark} package extends \LaTeX\ providing a
-% means to add a textual, light gray watermark on every page or on
-% the first page of a document. Typical usage may consist in writing
-% words such as \emph{DRAFT} or \emph{CONFIDENTIAL} across document
-% pages. The package may remind in some sense \Lpack{draftcopy} by
-% Dr. Juergen Vollmer, but its implementation is much lighter (as
-% the reduced code footprint shows) and does not rely on postscript
-% specials, making the package fully compatible with pdf\LaTeX. The
-% package depends on \Lpack{everypage} by the same author.
+% The \Lpack{draftwatermark} package extends \LaTeX\ providing a means
+% to add a textual (usually light gray, but possibly colored) watermark
+% on every page or on the first page of a document. Typical usage may
+% consist in writing words such as \emph{DRAFT} or \emph{CONFIDENTIAL}
+% across document pages. The package may remind in some sense
+% \Lpack{draftcopy} by Dr.~Juergen Vollmer, but its implementation is
+% much lighter (as the reduced code footprint shows) and does not rely
+% on postscript specials, making the package fully compatible with
+% pdf\LaTeX. The package depends on \Lpack{everypage} by the same
+% author.
% \end{abstract}
%
% \section{Introduction}
%
% This program extends \LaTeX\ providing a means to add a textual,
-% light gray watermark on every page or on the first page of a
-% document. Typical usage may consist in writing words such as
-% \emph{DRAFT} or \emph{CONFIDENTIAL} across document pages. Typical
-% usage may consist in writing words such as \emph{DRAFT} or
-% \emph{CONFIDENTIAL} across document pages. The package may remind in
-% some sense \Lpack{draftcopy} by Dr. Juergen Vollmer, but its
-% implementation differs by a few points:
+% (usually light gray, but possibly colored) watermark on every page or on
+% the first page of a document. Typical usage may consist in writing words
+% such as \emph{DRAFT} or \emph{CONFIDENTIAL} across document pages. The
+% package may remind in some sense \Lpack{draftcopy} by Dr.~Juergen
+% Vollmer, but its implementation differs by a few points:
% \begin{enumerate}
% \item Code footprint is much, much smaller (about one order of
% magnitude smaller), although this does not mean much on modern
@@ -108,13 +124,11 @@
% EYES ONLY'', etc.).
% \item No possibility to put the watermark at the bottom of the page.
% Watermarks are placed at the center of the page.
-% \item No possibility to selectively activate or disactivate
-% operation depending on the global draft and final options.
-% No possibility to watermark only the first \emph{two} pages of a
-% document. However, it is possible to watermark only the first.
+% \item No possibility to watermark only the first \emph{two} pages of a
+% document. However, it is possible to watermark only the first.
% \end{itemize}
% Other features available as options in \Lpack{draftcopy} (e.g., the
-% possibility of time-stamping the watermark text) can qbe obtained
+% possibility of time-stamping the watermark text) can be obtained
% working on the watermark text itself.
% \item Dependence on the \Lpack{everypage} package by the same
% author.
@@ -123,7 +137,10 @@
% \section{User interface}
% When loaded, \Lpack{draftwatermark} sets up a number of defaults
% (detailed later and modifiable by specific commands) and immediately
-% becomes active. If loaded as
+% becomes active.
+%
+% \subsection{Package options}
+% If loaded as
% \begin{quote}
% |\usepackage{draftwatermark}|
% \end{quote}
@@ -135,6 +152,19 @@
% the package sets up itself to put a background text only on the
% first page.
%
+% If loaded as
+% \begin{quote}
+% |\usepackage[nostamp]{draftwatermark}|
+% \end{quote}
+% the package does not print any watermark even if it is loaded and
+% configured to do so. This is handy for quickly removing the ``draft''
+% status from a document. Option \Lopt{final} is a synonym for
+% \Lopt{nostamp}. This can be handy because \Lopt{final} is a commonly
+% used global option that can be simultaneously obeyed by many packages
+% (e.g., to include figures, remove marks, and so on). The option
+% \Lopt{stamp} can be used to override a global \Lopt{final} option and to
+% recover the watermarking.
+%
% \subsection{Default behavior and commands to modify it}
% The package defaults are illustrated in table~\ref{tbl:defaults}.
%
@@ -146,8 +176,8 @@
% \MakeShortVerb{\|}
% Behavior & Default value\\
% \hline\hline
-% Angle at which the watermark text is drawn & 45°\\
-% Lightness of the watermark text (1=white, 0=black) & 0.8\\
+% Angle at which the watermark text is drawn & 45°\\
+% Color of the watermark text & gray 80\%\\
% Font size of the watermark text & 5$\;$cm\\
% Scaling of the watermark text & 1.2\\
% Watermark text & DRAFT\\
@@ -160,24 +190,22 @@
%
% With reference to the defaults, note that:
% \begin{enumerate}
-% \item the watermark text is always in gray;
% \item the watermark font size cannot exceed a maximum value that is
% about 5$\;$cm.
% \item the watermark scale can be any value. Using the default, the
-% word ``DRAFT'' at 45° uses up all the space on an A4 paper. To have
+% word ``DRAFT'' at 45° uses up all the space on an A4 paper. To have
% a good looking large text, it is better to enlarge the font size as
% much as possibile, rather than using a small font size and pumping
% up the scale.
% \end{enumerate}
%
% \DescribeMacro{\SetWatermarkAngle}
-% \DescribeMacro{\SetWatermarkLightness}
+% \DescribeMacro{\SetWatermarkColor}
% \DescribeMacro{\SetWatermarkFontSize}
% \DescribeMacro{\SetWatermarkScale}
% \DescribeMacro{\SetWatermarkText}
% Table~\ref{tbl:commands} illustrates the commands used to modify the
-% package behaviour. Note that there is exactly one command per
-% function and that every command takes a single argument.
+% package behaviour.
%
% \begin{table}[ht]
% \begin{center}
@@ -189,14 +217,16 @@
% \hline\hline
% Angle at which the watermark text is drawn &
% |\SetWatermarkAngle{|\meta{real}|}|\\
+% Color of the watermark &
+% |\SetWatermarkColor|$\;$\meta{col\_spec}\\
% Lightness of the watermark text (1=white, 0=black) &
% |\SetWatermarkLightness{|\meta{real}|}|\\
% Font size of the watermark text &
-% |\SetWatermarkFontSize{|\meta{lenght}|}|\\
+% |\SetWatermarkFontSize{|\meta{length}|}|\\
% Scaling of the watermark text &
% |\SetWatermarkScale{|\meta{real}|}|\\
% Watermark text &
-% |\SetWatermarkScale{|\meta{text}|}|\\
+% |\SetWatermarkText{|\meta{text}|}|\\
% \hline
% \end{tabular}
% \end{center}
@@ -204,7 +234,22 @@
% \label{tbl:commands}
% \end{table}
%
-% Observe that the |\SetWatermarkFontSize| command takes a lenght
+% Note that \meta{col\_spec} can be either a named color such as
+% |{|\meta{name}|}| or a color specification such as
+% |[|\meta{model}|]{|\meta{specs}|}|. For instance
+% \begin{quote}
+% |\SetWatermarkColor{red}|\\
+% |\SetWatermarkColor[rgb]{0,1,0}|
+% \end{quote}
+% \DescribeMacro{\SetWatermarkLightness}
+% are both valid colors. Also note that the command
+% \begin{quote}
+% |\SetWatermarkLightness{|\meta{real}|}|
+% \end{quote}
+% is provided as a conveniency (and for backward compatibility) to select
+% gray watermarks (1=white, 0=black).
+%
+% Observe that the |\SetWatermarkFontSize| command takes a length
% rather than a simple number. Also observe that multiline textual
% watermarks can easily be obtained by the |\shortstack| command and
% that there is the possibility of using an image rather than a text
@@ -222,12 +267,84 @@
% Obviously, the final compatibility with the different output drivers
% depends on the actual code that is placed in the textual watermark.
%
+% \section{Example}
+%
+% As an example, consider the following code snippet:
+% \iffalse
+%<*samplecode>
+% \fi
+% \begin{macrocode}
+\documentclass{article}
+\usepackage[utf8]{inputenc}
+\usepackage[T1]{fontenc}
+\usepackage{mathptmx}
+\usepackage{draftwatermark}
+\title{Sample document for the draftwatermark package}
+
+\begin{document}
+\maketitle
+
+\section{One}
+This text is here just to fill in some space. This text is here just to
+fill in some space. This text is here just to fill in some space. This
+text is here just to fill in some space. This text is here just to fill in
+some space. This text is here just to fill in some space. This text is
+here just to fill in some space. This text is here just to fill in some
+space. This text is here just to fill in some space. This text is here
+just to fill in some space. This text is here just to fill in some
+space. This text is here just to fill in some space. This text is here
+just to fill in some space. This text is here just to fill in some
+space. This text is here just to fill in some space. This text is here
+just to fill in some space. This text is here just to fill in some
+space. This text is here just to fill in some space. This text is here
+just to fill in some space. This text is here just to fill in some
+space. This text is here just to fill in some space.
+
+\section{Two}
+
+Also this text is here just to fill in some space. Also this text is here
+just to fill in some space. Also this text is here just to fill in some
+space. Also this text is here just to fill in some space. Also this text
+is here just to fill in some space. Also this text is here just to fill in
+some space. Also this text is here just to fill in some space. Also this
+text is here just to fill in some space. Also this text is here just to
+fill in some space. Also this text is here just to fill in some
+space. Also this text is here just to fill in some space. Also this text
+is here just to fill in some space. Also this text is here just to fill in
+some space. Also this text is here just to fill in some space. Also this
+text is here just to fill in some space. Also this text is here just to
+fill in some space. Also this text is here just to fill in some space.
+
+\end{document}
+% \end{macrocode}
+% \iffalse
+%</samplecode>
+% \fi
+%
+% \section{Development and support}
+%
+% The package is developed at \emph{github}:
+% \begin{quote}
+% \url{https://github.com/callegar/LaTeX-draftwatermark}
+% \end{quote}
+% Please refer to that site for any bug report or development information.
+%
+% \section{Changelog}
+% \begin{description}
+% \item[1.0 - 2006/06/30] Initial version.
+% \item[1.1 - 2012/01/06] Add support for colored watermarks; Options to
+% disable watermarking; Many small fixes in the documentation.
+% \end{description}
+%
% \StopEventually {}
%
% \section{Implementation}
%
% Announce the name and version of the package, which requires
% \LaTeXe.
+% \iffalse
+%<*draftwatermark>
+% \fi
% \begin{macrocode}
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{draftwatermark}%
@@ -239,7 +356,7 @@
% preset behavior for a desired output driver, this is used also
% here.
% \begin{macrocode}
-\RequirePackage{everypage}
+\RequirePackage{everypage}[2007/06/20]
\RequirePackage{graphicx}
\RequirePackage{color}
% \end{macrocode}
@@ -253,15 +370,30 @@
% \end{macrocode}
% \end{macro}
%
+% \begin{macro}{\if@sc@wm@stamp}
+% Set up the conditional to store whether to stamp the watermark or not.
+% \begin{macrocode}
+\newif\if@sc@wm@stamp
+\@sc@wm@stamptrue
+% \end{macrocode}
+% \end{macro}
+%
% Declare the package options.
% \begin{macrocode}
\DeclareOption{firstpage}{%
\@sc@wm@firsttrue}
+\DeclareOption{nostamp}{%
+ \@sc@wm@stampfalse}
+\DeclareOption{final}{%
+ \@sc@wm@stampfalse}
+\DeclareOption{stamp}{%
+ \@sc@wm@stamptrue}
\ProcessOptions
% \end{macrocode}
-%
+%
% \begin{macro}{\sc@wm@angle}
-% \begin{macro}{\sc@wm@lightness}
+% \begin{macro}{\sc@wm@colormodel}
+% \begin{macro}{\sc@wm@colorspecs}
% \begin{macro}{\sc@wm@scale}
% \begin{macro}{\sc@wm@fontsize}
% \begin{macro}{\sc@wm@text}
@@ -270,7 +402,8 @@
\newlength\sc@wm@fontsize
%% defaults
\def\sc@wm@angle{45}
-\def\sc@wm@lightness{0.8}
+\def\sc@wm@colormodel{[gray]}
+\def\sc@wm@colorspecs{0.8}
\def\sc@wm@scale{1}
\setlength\sc@wm@fontsize{5cm}
\def\sc@wm@text{DRAFT}
@@ -280,8 +413,10 @@
% \end{macro}
% \end{macro}
% \end{macro}
+% \end{macro}
%
% \begin{macro}{\SetWatermarkAngle}
+% \begin{macro}{\SetWatermarkColor}
% \begin{macro}{\SetWatermarkLightness}
% \begin{macro}{\SetWatermarkFontSize}
% \begin{macro}{\SetWatermarkScale}
@@ -290,8 +425,13 @@
% \begin{macrocode}
\newcommand\SetWatermarkAngle[1]{%
\def\sc@wm@angle{#1}}
+\newcommand\SetWatermarkColor{}
+\def\SetWatermarkColor#1#{\sc@setWatermarkColor{#1}}
+\def\sc@setWatermarkColor#1#2{%
+ \def\sc@wm@colormodel{#1}%
+ \def\sc@wm@colorspecs{#2}}
\newcommand\SetWatermarkLightness[1]{%
- \def\sc@wm@lightness{#1}}
+ \SetWatermarkColor[gray]{#1}}
\newcommand\SetWatermarkFontSize[1]{%
\setlength\sc@wm@fontsize{#1}}
\newcommand\SetWatermarkScale[1]{%
@@ -304,7 +444,8 @@
% \end{macro}
% \end{macro}
% \end{macro}
-%
+% \end{macro}
+%
%\begin{macro}{\sc@watermark}
% The command to draw the watermark\ldots This assumes an origin in
% the left top corner of the page (and also assumes that |\paperwidth|
@@ -320,10 +461,11 @@
\put(\strip@pt\@tempdimb,\strip@pt\@tempdimc){%
\makebox(0,0){\rotatebox{\sc@wm@angle}{%
\scalebox{\sc@wm@scale}{%
- \textcolor[gray]{\sc@wm@lightness}{
- \fontsize{\sc@wm@fontsize}{1.2\sc@wm@fontsize}
- \selectfont
- \sc@wm@text}}}}}}
+ \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}}}}}}
% \end{macrocode}
% \end{macro}
%
@@ -336,12 +478,14 @@
% corner of the page.
% \begin{macrocode}
\newcommand\sc@wm@print[1]{%
+ \if@sc@wm@stamp
\setbox\@tempboxa\vbox to \z@{%
\vskip -1in \moveleft 1in \vbox{%
\hbox to \z@{%
#1\hss}}\vss}
\dp\@tempboxa\z@
- \box\@tempboxa}
+ \box\@tempboxa
+ \fi}
% \end{macrocode}
% \end{macro}
%
@@ -355,6 +499,9 @@
\fi
\endinput
% \end{macrocode}
+% \iffalse
+%</draftwatermark>
+% \fi
%
% \Finale
% \PrintIndex
@@ -379,5 +526,4 @@
%%% Local Variables:
%%% mode: doctex
%%% TeX-master: t
-%%% End:
-
+%%% End: \ No newline at end of file
diff --git a/Master/texmf-dist/source/latex/draftwatermark/draftwatermark.ins b/Master/texmf-dist/source/latex/draftwatermark/draftwatermark.ins
index 56d092696d4..751b99ccf75 100644
--- a/Master/texmf-dist/source/latex/draftwatermark/draftwatermark.ins
+++ b/Master/texmf-dist/source/latex/draftwatermark/draftwatermark.ins
@@ -25,15 +25,13 @@
%% --------------- start of docstrip commands ------------------
%%
\input docstrip.tex
-\preamble
-This is file `draftwatermark.sty',
-generated with the docstrip utility.
-The original source files were:
+\keepsilent
+%\showprogress
-draftwatermark.dtx
+\preamble
- IMPORTANT NOTICE:
+ IMPORTANT NOTICE:
Copyright 2006
Sergio Callegari <sergio.callegari@gmail.com>
@@ -59,10 +57,18 @@ in the same archive or directory.)
\endpreamble
-\keepsilent
\Msg{*** Generating the LaTeX2e package files ***}
-\generate{\file{draftwatermark.sty}{\from{draftwatermark.dtx}{}}}
-\ReportTotals
+\generate{\file{draftwatermark.sty}{%
+ \from{draftwatermark.dtx}{draftwatermark}}}
+
+\preamble
+\endpreamble
+
+\Msg{*** Generating the example files ***}
+\generate{\file{test_draftwatermark.tex}{%
+ \from{draftwatermark.dtx}{samplecode}}}
+
+%\ReportTotals
\Msg{***********************************************************}
\Msg{*}
@@ -72,13 +78,14 @@ in the same archive or directory.)
\Msg{* \space\space draftwatermark.sty}
\Msg{*}
\Msg{*}
-\Msg{* To produce the documentation run the files ending with}
-\Msg{* `.dtx' through LaTeX (or maybe pdfLaTeX).}
-\Msg{* Process any name.idx file by:}
-\Msg{* \space\space\space\space makeindex -s gind.ist name}
-\Msg{* Process any name.glo file by:}
-\Msg{* \space\space\space\space makeindex -s gglo.ist -o name.gls name.glo}
-\Msg{* Re run through LaTeX the .dtx files as necessary}
+\Msg{* To produce the documentation run draftwatermark.dtx}
+\Msg{* through LaTeX (or maybe pdfLaTeX).}
+\Msg{* Process draftwatermark.idx file by:}
+\Msg{* \space\space\space\space makeindex -s gind.ist draftwatermark}
+\Msg{* Process draftwatermark.glo file by:}
+\Msg{* \space\space\space\space makeindex -s gglo.ist -o draftwatermark.gls
+ draftwatermark.glo}
+\Msg{* Re run through LaTeX the draftwatermark.dtx file as necessary}
\Msg{*}
\Msg{***********************************************************}