The draftcopy package^{∗}

Dr. Jürgen Vollmer Viktoriastraße 15 D-76133 Karlsruhe, Germany

Juergen.Vollmer@acm.org

September 7, 2001; Version 2.15

Abstract

This package is used to print on some pages the word DRAFT (or the language dependend analogon) “behind” the intended stuff.

1 Introduction

Before releasing a document you may wish to give it to others to proof read it. But it should be clear to the reader that it is still a draft version of that document. To mark this, so it could not be overseen, you can print the word DRAFT with big and light grey letters onto some pages. This can be done with this package.

You can specify the intensity of the gray, the range of pages onto which the word DRAFT is printed and where it is printed (across the page or at the bottom). The word DRAFT is replaced according to the language you are using, e.g. in german you get ENTWURF. You may also specify any word to be used instead of DRAFT. From now on in this document DRAFT stands for that word.

Credits go the the Unkown, who started this as a L^{A}TEX style file containing only the central special Postscript command printing english word DRAFT on each page of the document. Credits also to those, who send me translations of the word DRAFT and bug-reports and bug-fixes as well ideas for more functionality (see in the sources).

For italian, dutch, finnish and french two proposals exists. Have a look and change it (in the file draftcopy.sty, or by using \draftcopyName) according to your mind.

2 User Interface

2.1 Options

Options for this package are: english, german, … This package accepts the language options of the babel

∗This not a DRAFT version of this document. Its simply documentation and demonstration of the package in one document.

package^{1}. The babel package is not loaded by draftcopy.

none Don’t print DRAFT across of any page. first Prints DRAFT across only on the first page. firsttwo Prints DRAFT across only on the first two pages. all Prints DRAFT across on all pages of the document. bottom Prints DRAFT on all pages at the bottom of the page. bottomafter Prints DRAFT at the bottom of the pages following the

pages which have DRAFT across them.

outline The word DRAFT is printed with outlined letters. light The word DRAFT is printed with a light grey. dark The word DRAFT is printed with a dark grey. dvips, vtex, textures, … This package accepts the options of the graphics package^{2}.

The graphics package is not loaded by draftcopy.

portrait Page is in portrait shape. landscape Page is in landscape shape. conditional Obey the (global) draft and final options. If conditional

and draft are given, then the DRAFT text is printed. If conditional and final are given, DRAFT is not printed. Only conditional is given, DRAFT is not printed. If conditional is not given then draft and final are ignored, and the DRAFT text is printed always.

draft Print the DRAFT text. final Don’t print any DRAFT text. timestamp Print together with the word DRAFT a timestamp and the

text given by the draftcopyVersion macro.

The default options are: dvips,english,all,dark,portrait, which corresponds to the behaviour of the old implementation of this package. The file draftcopy.cfg specifies the default Postscript driver. This specification is overruled, if the driver option is given explicitly.

2.2 Commands

Additionally to the options, each feature may be set by commands, which must be placed in the preamble of the document.

\draftcopySetGrey • Set the intensity of the gray. The argument value range from 0.0 to 1.0, where the smaller values darker.

\draftcopyFirstPage • The argument specifies the first page onto which DRAFT will be printed. This is the physical page number.

\draftcopyLastPage • The argument specifies the last page onto which DRAFT will be printed. This is the physical page number.

\draftcopyName • The first argument specifies the word to be printed instead of DRAFT, the second, gives the scale factor for the font to be used. E.g. the english word DRAFT needs 215, the german ENTWURF needs 155. To add spaces in the word use the \space macro.

1Currently not all languages are supported, I still need volunteers to send me translation of the word DRAFT into the other languages L^{A}TEX2e with its babel package supports.

2Currently only dvips, dvipsone, dvipswindo, and textures are supported. All others are mapped to dvips. If you are using another driver, let me know what to.

\draftcopySetScale • Change the default size of the word DRAFT.

\draftcopySetScaleFactor • Change the multipiler of the scale.

\draftcopyPageTransform • and

\draftcopyBottomTransform • take raw PostScript to set the LL-corner of the DRAFT string Use them before the \begin{document}. For code examples: Have a look to the definition of the portrait and landscape options.

\draftcopyPageX  • and

\draftcopyPageY • are integer values specifying the coorinates starting the DRAFT string on the page (default 0).

\draftcopyBottomX  • and

\draftcopyBottomY • are integer values specifying the coorinates starting the DRAFT string on the bootom line (default 0).

\draftcopyVersion • The argument is printed together with the timestamp.

3 A Few Warnings

The result of printing DRAFT onto the page will be visible only in the Postscript output, not in the DVI output. The other text will be visible always. Sometimes ghostview has problems in presenting the correct result, use ghostscript (gs) instead. The printed result should always meet your intension.

Currently this package works only for Postscript and not for PDF, sorry.

4 Copyright

Copyright (C) 1995 Dr. Juergen Vollmer, Karlsruhe, Germany

Juergen.Vollmer@acm.org

This program can be redistributed and/or modified under the terms of the LaTeX Project Public License Distributed from CTAN archives in directory macros/latex/base/lppl.txt; either version 1 of the License, or any later version.

If you find this software useful, please send me a postcard.

5 The Documentation Driver File

The next bit of code contains the documentation driver file for TEX, i.e., the file that will produce the documentation you are currently reading. It will be extracted from this file by the docstrip program.

1 ⟨∗driver⟩

 2 \documentclass[english,a4paper]{article}
 3 \usepackage{doc}

 4 \usepackage[latin1]{inputenc}
 5 \usepackage{babel}
 6 \usepackage[light,first,bottomafter]{draftcopy}
 7 \RecordChanges
 8 \EnableCrossrefs
 9 \CodelineIndex
10 \begin{document}
11 \DocInput{draftcopy.doc}
12 \PrintChanges
13 \setcounter{IndexColumns}{2}
14 \PrintIndex
15 \end{document}

16 ⟨/driver⟩

6 Configuration

You should set up the default Postscript driver in the file draftcopy.cfg. For a reasonable value have a look to the file graphics.cfg from the graphics package. The distributed default is dvips.

17 ⟨∗config⟩

18 \ifx\OpMode\undefined
19 \ExecuteOptions{dvips}
20 \else
21 \ExecuteOptions{vtex}
22 \fi

23 ⟨/config⟩

7 The Implementation

The implementation is based on manipulating the Postscript output, using the special command.

What do we need, and who we are:

24 ⟨∗package⟩

25 \NeedsTeXFormat{LaTeX2e}
26 \ProvidesPackage{draftcopy}[2001/09/07 v2.15]

Declaration of the conditional handling options (based on an idea of Warren

Smith <wds@research.nj.nec.com>).
27 \newif\ifdraftcopy@conditional
28 \newif\ifdraftcopy@draft
29 \newif\ifdraftcopy@final
30 \DeclareOption{conditional}{
31 \draftcopy@conditionaltrue

32 }

33 \DeclareOption{draft}{
34 \draftcopy@drafttrue

35 }

36 \DeclareOption{final}{
37 \draftcopy@finaltrue

38 }

Declaration of the the timestamp option.

39 %␣Compute␣the␣timestamp␣based␣on␣an␣idea␣of
40 %␣Tim␣Piessens␣\texttt{<Tim.Piessens@esat.kuleuven.ac.be>}.
41 %␣␣␣␣\begin{macrocode*}
42 \def\draftcopy@Timestamp{}
43 \def\draftcopy@version{}
44 \newcount\draftcopy@hour␣\newcount\draftcopy@minute
45 \draftcopy@hour=\time␣\divide␣\draftcopy@hour␣by␣60
46 \draftcopy@minute=\time
47 \count99=\draftcopy@hour␣\multiply␣\count99␣by␣-60
48 \advance␣\draftcopy@minute␣by␣\count99
49 \newcommand{\draftcopy@daytime}{%
50 ␣␣␣\ifnum\draftcopy@hour=0␣00\else\ifnum\draftcopy@hour<10␣0\fi%
51 ␣␣␣\number\draftcopy@hour\fi:%
52 ␣␣\ifnum\draftcopy@minute<10␣0\fi\number\draftcopy@minute%

53 }

54

55 \DeclareOption{timestamp}{
56 ␣␣␣\def\draftcopy@Timestamp{%
57 ␣␣␣\draftcopy@Show
58 ␣␣␣\draftcopy@PageX␣\draftcopy@PageY␣-40␣add␣moveto
59 ␣␣␣/Times-Roman␣findfont␣50␣\draftcopy@ScaleFactor␣mul␣scalefont␣setfont
60 ␣␣␣(\draftcopy@version␣\today␣--␣\draftcopy@daytime)
61 ␣␣␣}

62 }

Declaration of various graphic driver options. Different DVI driver use different names :-(

63 % VTEX-support: Thanks to "MicroPress Inc." <support@micropress-inc.com>
64 \let\immediate@special=\special
65 \DeclareOption{vtex}{
66 \def\immediate@special{\immediate\special}
67 \immediate@special{!bophook bop-hook}
68 \def\draftcopy@BOPhook{/bop-hook}
69 \def\draftcopy@UserDictCmd{pS: userdict }
70 % MV & AK <mv@micropress-inc.com>

71 }

72 \DeclareOption{dvips}{
73 \def\draftcopy@BOPhook{/bop-hook}
74 \def\draftcopy@UserDictCmd{! userdict }

75 }

76 \DeclareOption{dvipsone}{
77 % thanks to V. P. Stokes <virgil.stokes@neuro.ki.se>
78 % thanks to Y&Y Help Line <support@YandY.com>
79 % thanks to "H. Salehfar" <hsalehfa@sage.und.nodak.edu>
80 \def\draftcopy@BOPhook{/bphook}
81 \def\draftcopy@UserDictCmd{! dvidict}

82 }

83 \DeclareOption{textures}{
84 % thanks to Jerome LAURENS \texttt{laurens@u-bourgogne.fr>
85 \def\draftcopy@BOPhook{/bop-hook}
86 \def\draftcopy@UserDictCmd{prepostscript userdict}

87 }

88

89 \DeclareOption{dviwindo}{\ExecuteOptions{dvipsone}}

 91 % For the following |dvips| will be used. I don't know it better.
 92 \DeclareOption{xdvi}{\ExecuteOptions{dvips}}
 93 \DeclareOption{dvi2ps}{\ExecuteOptions{dvips}}
 94 \DeclareOption{dvialw}{\ExecuteOptions{dvips}}
 95 \DeclareOption{dvilaser}{\ExecuteOptions{dvips}}
 96 \DeclareOption{dvitops}{\ExecuteOptions{dvips}}
 97 \DeclareOption{emtex}{\ExecuteOptions{dvips}}
 98 \DeclareOption{dviwin}{\ExecuteOptions{dvips}}
 99 \DeclareOption{oztex}{\ExecuteOptions{dvips}}
100 \DeclareOption{psprint}{\ExecuteOptions{dvips}}
101 \DeclareOption{pubps}{\ExecuteOptions{dvips}}
102 \DeclareOption{pctexps}{\ExecuteOptions{dvips}}
103 \DeclareOption{pctexwin}{\ExecuteOptions{dvips}}
104 \DeclareOption{pctexhp}{\ExecuteOptions{dvips}}
105 \DeclareOption{ln}{\ExecuteOptions{dvips}}

To printed the word DRAFT in outlined letter or normal letters we use different methods of showing text: Normal letters are printed using the PostScript show command. Outlined letters are printed using charpath and stroke (See the example in the red PostScipt book). The idea for this option is from Harriet

 B. Borton <bortonh@rpi.edu>
106 \def\draftcopy@Show{show␣}
107 \DeclareOption{outline}{
108 ␣␣\def\draftcopy@Show{false␣charpath␣2␣setlinewidth␣stroke␣}

109 }

Here we define the options for setting the intensity of the gray. Smaller values mean darker.

110 \DeclareOption{light}{
111  \def\draftcopy@GrayValue{0.90}

112 }

113

114 \DeclareOption{dark}{
115  \def\draftcopy@GrayValue{0.85}

116 }

Here we define the options, which specify the range of pages where DRAFT will be printed across pages. We use the Postcript variable draftcopy-LastPage to store the number.

117 \DeclareOption{none}{
118 \def\draftcopy@LastPage{0}

119 }

120 \DeclareOption{first}{
121 \def\draftcopy@LastPage{1}

122 }

123 \DeclareOption{firsttwo}{
124 \def\draftcopy@LastPage{2}

125 }

126 \DeclareOption{all}{
127 \def\draftcopy@LastPage{99999}

128 }

The option to print DRAFT at the bottom of all pages. The idea for the bottom options and the corresponding PostScript code is from Paolo Ienne

 <Paolo.Ienne@di.epfl.ch>.
129 \newif\ifdraftcopy@bottom
130 \DeclareOption{bottom}{
131 \draftcopy@bottomtrue

132 }

The option to print DRAFT at the bottom of the page, after the initial pages containing DRAFT printed across of a page.

133 \newif\ifdraftcopy@bottomAfter
134 \DeclareOption{bottomafter}{
135 \draftcopy@bottomAftertrue

136 }

Define the word DRAFT and its scaling, in case no language option is given. The Postscript variable draftcopy@Name holds the word for DRAFT of that language and draftcopy@Scale is a font scale factor, it must be determined empirically.

137 \def\draftcopy@Name{DRAFT}\def\draftcopy@Scale{215}

The babel language options are honored, even currently not all of them have a translation for the word DRAFT. Most of them use latin characters, hence we use Times-Roman. The macro draftcopy@Font holds the font name.

138 \def\draftcopy@Font{/Times-Roman}
139 \DeclareOption{american}{
140 ␣␣\def\draftcopy@Name{DRAFT}\def\draftcopy@Scale{215}

141 }

142 \DeclareOption{austrian}{
143 ␣␣\def\draftcopy@Name{ENTWURF}\def\draftcopy@Scale{155}

144 }

145 \DeclareOption{bahasa}{
146 ␣␣%␣thanks␣to␣Glenn␣G.␣Chappell␣<gchappell@semovm.semo.edu>
147 ␣␣\def\draftcopy@Name{DRAF}\def\draftcopy@Scale{217}

148 }

149 \DeclareOption{brazil}{
150 ␣␣\def\draftcopy@Name{DRAFT}\def\draftcopy@Scale{215}

151 }

152 \DeclareOption{brazilian}{
153 ␣␣\def\draftcopy@Name{DRAFT}\def\draftcopy@Scale{215}

154 }

155 \DeclareOption{breton}{
156 ␣␣\def\draftcopy@Name{DRAFT}\def\draftcopy@Scale{215}

157 }

158 \DeclareOption{british}{
159 ␣␣\def\draftcopy@Name{DRAFT}\def\draftcopy@Scale{215}

160 }

161 \DeclareOption{catalan}{
162 ␣␣%␣thanks␣to␣Dav␣<davpuig@mx3.redestb.es>
163 ␣␣%␣thanks␣to␣Xavier␣<xml@mat.upc.es>
164 ␣␣\def\draftcopy@Name{ESBORRANY}\def\draftcopy@Scale{110}

165 }

166 \DeclareOption{croatian}{
167 ␣␣\def\draftcopy@Name{DRAFT}\def\draftcopy@Scale{215}

168 }

169 \DeclareOption{czech}{
170 ␣␣\def\draftcopy@Name{DRAFT}\def\draftcopy@Scale{215}

172 \DeclareOption{danish}{
173 ␣␣%␣thanks␣to␣Ejnar␣Zacho␣Rath␣<ezr@md-oss.dk>,
174 ␣␣%␣thanks␣to␣Bjarne␣Vestergaard␣<bvbruder@dfi.aau.dk>
175 ␣␣%␣thanks␣to␣Joergen␣Larsen␣<JL@mmf.ruc.dk>
176 ␣␣\def\draftcopy@Name{UDKAST}\def\draftcopy@Scale{175}

177 }

178 \DeclareOption{dutch}{
179 ␣␣%␣thanks␣to␣Kees␣Leune␣<C.J.Leune@kub.nl>
180 ␣␣%␣\def\draftcopy@Name{CONCEPT}\def\draftcopy@Scale{150}
181 ␣␣%␣thanks␣to␣Anton␣Stoorvogel␣<wscoas@as.win.tue.nl>␣porposed
182 ␣␣\def\draftcopy@Name{ONTWERP}\def\draftcopy@Scale{150}

183 }

184 \DeclareOption{english}{
185 ␣␣\def\draftcopy@Name{DRAFT}\def\draftcopy@Scale{215}

186 }

187 \DeclareOption{esperanto}{
188 ␣␣%␣thanks␣to␣Stephan␣B.␣Webanck␣<webanck@mpiz-koeln.mpg.de>
189 ␣␣\def\draftcopy@Name{MALNETO}\def\draftcopy@Scale{160}

190 }

191 \DeclareOption{estonian}{
192 ␣␣%␣thanks␣to␣DAVID␣FEEST␣<mirka!mausgoe.central.de!
193 ␣␣%␣gOe.maus.de!David_Feest@uranus.central.de>
194 ␣␣\def\draftcopy@Name{VISAND}\def\draftcopy@Scale{215}

195 }

196 \DeclareOption{finnish}{
197 ␣␣%␣thanks␣to␣Jaakko␣Ruohio␣<jjruohio@boojum.hut.fi>
198 ␣␣\def\draftcopy@Name{LUONNOS}\def\draftcopy@Scale{200}
199 ␣␣%␣thanks␣to␣Mika␣Grundstroem␣<mikagr@spittari.cs.tut.fi>
200 ␣␣\def\draftcopy@Name{VEDOS}\def\draftcopy@Scale{220}

201 }

202 \DeclareOption{francais}{
203 ␣␣%␣thanks␣to␣Christophe␣Couvreur␣<couvreur@Thor.fpms.ac.be>
204 ␣␣\def\draftcopy@Name{BROUILLON}\def\draftcopy@Scale{120}

205 }

206 \DeclareOption{french}{
207 ␣␣%␣thanks␣to␣Christophe␣Couvreur␣<couvreur@Thor.fpms.ac.be>
208 ␣␣\def\draftcopy@Name{BROUILLON}\def\draftcopy@Scale{120}
209 ␣␣%␣thanks␣to␣Marc␣Torzynski␣<marc@snoopy.u-strasbg.fr>
210 ␣␣%\def\draftcopy@Name{EPREUVE}\def\draftcopy@Scale{120}

211 }

212 \DeclareOption{galician}{
213 ␣␣\def\draftcopy@Name{DRAFT}\def\draftcopy@Scale{215}

214 }

215 \DeclareOption{german}{
216 ␣␣\def\draftcopy@Name{ENTWURF}\def\draftcopy@Scale{155}

217 }

218 \DeclareOption{germanb}{
219 ␣␣\def\draftcopy@Name{ENTWURF}\def\draftcopy@Scale{155}

220 }

221 \DeclareOption{greek}{
222 ␣␣%␣thanks␣to␣␣Apostolos␣Syropoulos␣<apostolo@ocean1.ee.duth.gr>
223 ␣␣\def\draftcopy@Name{PROSCEDIO}\def\draftcopy@Scale{85}
224 ␣␣\def\draftcopy@Font{/Symbol}

226 \DeclareOption{hungarian}{
227 ␣␣\def\draftcopy@Name{DRAFT}\def\draftcopy@Scale{215}

228 }

229 \DeclareOption{icelandic}{
230 ␣␣\def\draftcopy@Name{DRAFT}\def\draftcopy@Scale{215}
231 ␣␣%␣DRÖG
232 ␣␣%␣Erlendur␣S␣Thorsteinsson␣<esth@cmu.edu>
233 ␣␣%␣does␣anybody␣knows␣how␣to␣create␣PostScript␣for␣that␣letter␣Ö?

234 }

235 \DeclareOption{irish}{
236 ␣␣\def\draftcopy@Name{DRAFT}\def\draftcopy@Scale{215}
237 ␣␣%␣DRÉACHT
238 ␣␣%␣Breanndán␣Ó␣Nualláin␣<bon@kotona.demon.nl>
239 ␣␣%␣does␣anybody␣knows␣how␣to␣create␣PostScript␣for␣that␣letter␣É?

240 }

241 \DeclareOption{italian}{
242 ␣␣%␣thanks␣to␣Fabio␣Massacci␣<Fabio.Massacci@cl.cam.ac.uk>
243 ␣␣%␣thanks␣to␣Paolo␣Dell'Aquila␣<dlle07k1@mo.nettuno.it>
244 ␣␣\def\draftcopy@Name{BOZZA}\def\draftcopy@Scale{215}
245 ␣␣%␣thanks␣to␣Giuseppe␣De␣Arcangelis␣<gdearc@serifos.caspur.it>
246 ␣␣%␣\def\draftcopy@Name{brutta␣copia}\def\draftcopy@Scale{80}

247 }

248 \DeclareOption{lowersorbian}{
249 ␣␣\def\draftcopy@Name{DRAFT}\def\draftcopy@Scale{215}

250 }

251 \DeclareOption{magyar}{
252 ␣␣\def\draftcopy@Name{DRAFT}\def\draftcopy@Scale{215}

253 }

254 \DeclareOption{norsk}{
255 ␣␣%␣thanks␣to:␣Dag␣Langmyhr␣<dag@ifi.uio.no>
256 ␣␣\def\draftcopy@Name{UTKAST}\def\draftcopy@Scale{178}

257 }

258 \DeclareOption{nynorsk}{
259 ␣␣%␣thanks␣to:␣Dag␣Langmyhr␣<dag@ifi.uio.no>
260 ␣␣\def\draftcopy@Name{FRAMLEGG}\def\draftcopy@Scale{129}

261 }

262 \DeclareOption{polish}{
263 ␣␣%␣thanks␣to␣Piotr␣Chrusciel␣<piotr@gargan.math.univ-tours.fr>
264 ␣␣\def\draftcopy@Name{BRUDNOPIS}\def\draftcopy@Scale{120}

265 }

266 \DeclareOption{portuges}{
267 ␣␣\def\draftcopy@Name{DRAFT}\def\draftcopy@Scale{215}

268 }

269 \DeclareOption{portuguese}{
270 ␣␣\def\draftcopy@Name{DRAFT}\def\draftcopy@Scale{215}

271 }

272 \DeclareOption{romanian}{
273 ␣␣\def\draftcopy@Name{DRAFT}\def\draftcopy@Scale{215}

274 }

275 \DeclareOption{scottish}{
276 ␣␣\def\draftcopy@Name{DRAFT}\def\draftcopy@Scale{215}

277 }

278 \DeclareOption{spanish}{

279 ␣␣%␣thanks␣to:␣Tomas␣Bautista␣<bautista@cma.ulpgc.es>
280 ␣␣\def\draftcopy@Name{BORRADOR}\def\draftcopy@Scale{120}

281 }

282 \DeclareOption{slovak}{
283 ␣␣\def\draftcopy@Name{DRAFT}\def\draftcopy@Scale{215}

284 }

285 \DeclareOption{slovene}{
286 ␣␣%␣thanks␣to␣brodnik@pegam.mat.uni-lj.si␣<Andrej␣Brodnik>
287 ␣␣\def\draftcopy@Name{OSNUTEK}\def\draftcopy@Scale{120}

288 }

289 \DeclareOption{swedish}{
290 ␣␣%␣thanks␣to␣<matsd@physchem.kth.se>
291 ␣␣\def\draftcopy@Name{UTKAST}\def\draftcopy@Scale{185}

292 }

293 \DeclareOption{turkish}{
294 ␣␣\def\draftcopy@Name{DRAFT}\def\draftcopy@Scale{215}

295 }

296 \DeclareOption{uppersorbian}{
297 ␣␣\def\draftcopy@Name{DRAFT}\def\draftcopy@Scale{215}

298 }

Declare the page orientation options.

299 \DeclareOption{portrait}{
300 % thanks to Ross MOORE \texttt{ross@maths.mq.edu.au>}
301 \def\draftcopy@PageTranslate{200 70 translate 65 rotate}
302 \def\draftcopy@BottomTranslate{0 25 translate}
303 \def\draftcopy@ScaleFactor{1 }

304 }

305 \DeclareOption{landscape}{
306 % thanks to Ross MOORE \texttt{ross@maths.mq.edu.au>}
307 \def\draftcopy@PageTranslate{70 450 translate 25 neg rotate}
308 \def\draftcopy@BottomTranslate{25 650 translate 90 neg rotate}
309 \def\draftcopy@ScaleFactor{0.6 }

310 }

Use these default options,

311 \ExecuteOptions{dark,all,english,portrait}

instead of dvips use the graphics driver specified in the configuration file,

312 \input{draftcopy.cfg}

and the process the user options.

313 \ProcessOptions

Tell the user what’s ongoing.

314 \typeout{Prints \draftcopy@Name\space on pages;
315 does not show in your DVI viewer}

\draftcopyVersion Set the Version text to be printed together with a timestamp

316 \newcommand{\draftcopyVersion}[1]{
317 \def\draftcopy@version{#1}

318 }

\draftcopySetGrey Set the intensity of the gray, values range from 0.0 to 1.0, where the smaller values darker. If used, it must be conatined in the preamble of the document.

319 \newcommand{\draftcopySetGrey}[1]{

320 \def\draftcopy@GrayValue{#1}

321 }

\draftcopySetScale Set the size (scale) of the word DRAFT. You may need this, if you use another paper format. The default scales are for A4 paper. If used, it must be conatined in the preamble of the document.

322 \newcommand{\draftcopySetScale}[1]{
323 \def\draftcopy@Scale{#1}

324 }

\draftcopySetScaleFactor Set the scale muliplier of the scale.

325 \newcommand{\draftcopySetScaleFactor}[1]{
326 ␣␣\def\draftcopy@ScaleFactor{#1␣}

327 }

\draftcopyFirstPage The argument specifies the first page onto which DRAFT will be printed. This is the physical page number. If used, it must be conatined in the preamble of the document.

328 \def\draftcopy@FirstPage{0}
329 \newcommand{\draftcopyFirstPage}[1]{
330 \def\draftcopy@FirstPage{#1}

331 }

\draftcopyLastPage The argument specifies the last page onto which DRAFT will be printed. This is the physical page number. If used, it must be conatined in the preamble of the document.

332 \newcommand{\draftcopyLastPage}[1]{
333 \def\draftcopy@LastPage{#1}

334 }

\draftcopyName The first argument specifies the word to be printed instead of DRAFT, the second, gives the scale factor for the font to be used. E.g. the english word DRAFT needs 215, the german ENTWURF needs 155. Note we need the blank after the #2. If used, it must be conatined in the preamble of the document.

335 \newcommand{\draftcopyName}[2]{
336 ␣␣\def\draftcopy@Name{#1}
337 ␣␣\def\draftcopy@Scale{#2}

338 }

\@draftcopyTilde If a ĩs used as argument of \draftcopyName, we have to supress expansion of it. We replace it by a simple space. Here we store the original meaning of ˜, so that it can be restored after setting up the Postscript code.

339 \let\@draftcopyTilde~

\draftcopyPageTransform These next 2 commands take raw PostScript to set the LL-corner of the DRAFT string

340 \newcommand{\draftcopyPageTransform}[1]{%
341 ␣\def\draftcopy@PageTranslate{#1}%

342 }

\draftcopyBottomTransform
343 \newcommand{\draftcopyBottomTransform}[1]{%
344 ␣\def\draftcopy@BottomTranslate{#1}%

345 }

Based on an idea or Sergio Polini <s.polini@mclink.it>:

\draftcopyPageX
346 \def\draftcopy@PageX{0␣}
347 \newcommand{\draftcopyPageX}[1]{%
348 ␣\def\draftcopy@PageX{#1␣}%

349 }

\draftcopyPageY
350 \def\draftcopy@PageY{0␣}
351 \newcommand{\draftcopyPageY}[1]{%
352 ␣\def\draftcopy@PageY{#1␣}%

353 }

\draftcopyBottomX
354 \def\draftcopy@BottomX{0␣}
355 \newcommand{\draftcopyBottomX}[1]{%
356 ␣\def\draftcopy@BottomX{#1␣}%

357 }

\draftcopyBottomY
358 \def\draftcopy@BottomY{0␣}
359 \newcommand{\draftcopyBottomY}[1]{%
360 ␣\def\draftcopy@BottomY{#1␣}%

361 }

Compute, wether we should show the DRAFT text:

362 \newif\ifdraftcopy@showit
363 \ifdraftcopy@conditional
364 ␣␣\ifdraftcopy@draft
365 ␣␣␣␣␣\draftcopy@showittrue
366 ␣␣\else
367 ␣␣␣␣␣␣\draftcopy@showitfalse
368 ␣␣\fi
369 ␣␣\ifdraftcopy@final
370 ␣␣␣␣\draftcopy@showitfalse
371 ␣␣\fi
372 \else
373 ␣␣\draftcopy@showittrue
374 \fi

Here we introduce some Postscript code. The dictionary userdict is extended with the page counter draftcopy-CurrentPage. Printing of DRAFT starts after page \draftcopy@FirstPage. Each time a new page starts \draftcopy@BOPhook is called (if it’s defined). Hence we define it. First we increment the current page counter. If then the current page counter is smaller than the last page counter \draftcopy@LastPage we print the word contained in the L^{A}TEXmacro draftcopy@Name with the font scaled with L^{A}TEXmacro

draftcopy@Scale.

This must be done at the beginning of the document \AtBeginDocument, so that the preamble commands take effect.

We redfefine and restore the meaning of ˜, which may be used in the

\draftcopy@Name, using \let. This allows to use \today as \draftcopy@Name

for languages like e.g. german, which separates the day and the month by ˜.

The size of the word DRAFT is given by \draftcopy@Scale and multiplied by \draftcopy@ScaleFactor, which is needed to different page hights of cover landscape and portrait orientation.

Thanks to Glenn G. Chappell gchappell@semovm.semo.edu for providing the /draftcopy-old-BOPhook suggestion, which saves a previous definition of

 \draftcopy@BOPhook and executes it too.
375 % Thanks to Ross Moore \texttt{ross@ics.mq.edu.au} for adding the code to
376 % preserve kine-end in the PostScript file.
377 %    \begin{macrocode}
378 \ifdraftcopy@showit
379 {\obeyspaces
380 \ifdraftcopy@bottomAfter
381 \AtBeginDocument{
382  \let~\space
383  \immediate@special{\draftcopy@UserDictCmd
384  begin
385  /draftcopy-CurrentPage 0 def
386  /draftcopy-old-BOPhook { } def
387  currentdict \draftcopy@BOPhook\space known{
388  /draftcopy-old-BOPhook \draftcopy@BOPhook\space load def
389  } if
390  \draftcopy@BOPhook{
391  draftcopy-old-BOPhook
392  /draftcopy-CurrentPage draftcopy-CurrentPage 1 add def
393  draftcopy-CurrentPage \draftcopy@FirstPage ge
394  draftcopy-CurrentPage \draftcopy@LastPage le
395  and
396  { gsave \draftcopy@PageTranslate
397  \draftcopy@Font findfont
398  \draftcopy@Scale \draftcopy@ScaleFactor mul scalefont setfont
399  \draftcopy@PageX \draftcopy@PageY moveto
400  \draftcopy@GrayValue setgray
401  (\draftcopy@Name) \draftcopy@Timestamp \draftcopy@Show
402  grestore
403  } if
404  draftcopy-CurrentPage \draftcopy@LastPage gt
405  { gsave \draftcopy@BottomTranslate
406  \draftcopy@Font findfont
407  25 scalefont setfont
408  \draftcopy@BottomX \draftcopy@BottomY moveto
409  \draftcopy@GrayValue setgray
410  (\draftcopy@Name\space\space--\space\space)
411  0 1 15 { pop dup show } for
412  grestore
413  } if
414  } def
415  end

416 }

417  \let~\@draftcopyTilde

418 }

419 \else\ifdraftcopy@bottom
420 \AtBeginDocument{
421  \let~\space

422  \immediate@special{\draftcopy@UserDictCmd
423  begin
424  /draftcopy-CurrentPage 0 def
425  /draftcopy-old-BOPhook { } def
426  currentdict \draftcopy@BOPhook\space known{
427  /draftcopy-old-BOPhook \draftcopy@BOPhook\space load def
428  } if
429  \draftcopy@BOPhook{
430  draftcopy-old-BOPhook
431  /draftcopy-CurrentPage draftcopy-CurrentPage 1 add def
432  draftcopy-CurrentPage \draftcopy@FirstPage ge
433  draftcopy-CurrentPage \draftcopy@LastPage  le
434  and
435  { gsave \draftcopy@PageTranslate
436  \draftcopy@Font findfont
437  \draftcopy@Scale \draftcopy@ScaleFactor mul scalefont setfont
438  \draftcopy@PageX \draftcopy@PageY moveto
439  \draftcopy@GrayValue setgray
440  (\draftcopy@Name) \draftcopy@Timestamp \draftcopy@Show
441  grestore
442  }if
443  gsave \draftcopy@BottomTranslate
444  \draftcopy@Font findfont
445  25 scalefont setfont
446  \draftcopy@BottomX \draftcopy@BottomY moveto
447  \draftcopy@GrayValue setgray
448  (\draftcopy@Name\space\space--\space\space)
449  0 1 15 { pop dup show } for
450  grestore
451  } def
452  end

453 }

454  \let~\@draftcopyTilde

455 }

456 \else
457 \AtBeginDocument{
458  \let~\space
459  \immediate@special{\draftcopy@UserDictCmd
460  begin
461  /draftcopy-CurrentPage 0 def
462  /draftcopy-old-BOPhook { } def
463  currentdict \draftcopy@BOPhook\space known{
464  /draftcopy-old-BOPhook \draftcopy@BOPhook\space load def
465  } if
466  \draftcopy@BOPhook{
467  draftcopy-old-BOPhook
468  /draftcopy-CurrentPage draftcopy-CurrentPage 1 add def
469  draftcopy-CurrentPage \draftcopy@FirstPage ge
470  draftcopy-CurrentPage \draftcopy@LastPage  le
471  and
472  { gsave \draftcopy@PageTranslate
473  \draftcopy@Font findfont
474  \draftcopy@Scale \draftcopy@ScaleFactor mul scalefont setfont
475  \draftcopy@PageX \draftcopy@PageY moveto

476  \draftcopy@GrayValue setgray
477  (\draftcopy@Name) \draftcopy@Timestamp \draftcopy@Show
478  grestore
479  } if
480  } def
481  end

482 }

483  \let~\@draftcopyTilde

484 }

485 \fi\fi

486 }

487 \fi

488 ⟨/package⟩

8 Some Test Input Files

The next bit of code contains the some L^{A}TEX input files with various options set. They will be extracted from this file by the docstrip program, using the

 test1, ...  test12 option.

489 ⟨∗test1⟩

490 \documentclass[a4paper]{article}
491 \usepackage{draftcopy}
492 \newcommand{\xx}{
493 Test 1\\This is a test page \thepage \vfill
494 This is a testpage \thepage \newpage

495 }

496 \begin{document}
497 Should print DRAFT over all pages, quite dark.\\
498 \verb|\usepackage{draftcopy}|\\
499 \xx\xx\xx\xx
500 \end{document}

501 ⟨/test1⟩

502 ⟨∗test2⟩

503 \documentclass[a4paper,german]{article}
504 \usepackage[light,first]{draftcopy}
505 \newcommand{\xx}{
506 Test2: Should print ENTWURF on the first page, light.\\
507 This is a test page \thepage \vfill
508 This is a testpage \thepage \newpage

509 }

510 \begin{document}
511 \verb|\usepackage[light,first]{draftcopy}|\\
512 \xx\xx\xx\xx
513 \end{document}

514 ⟨/test2⟩

515 ⟨∗test3⟩

516 \documentclass[a4paper,french]{article}
517 \usepackage[light,firsttwo]{draftcopy}
518 \newcommand{\xx}{
519 Test3: This is a test page \thepage \vfill
520 This is a testpage \thepage \newpage

521 }

522 \begin{document}
523 Should print BROUILLON on the first two pages, light.\\
524 \verb|\usepackage[light,firsttwo]{draftcopy}|\\
525 \xx\xx\xx\xx
526 \end{document}

527 ⟨/test3⟩

528 ⟨∗test4⟩

529 \documentclass[a4paper,danish]{article}
530 \usepackage[light,firsttwo]{draftcopy}
531 \newcommand{\xx}{
532 Test4: This is a test page \thepage \vfill
533 This is a testpage \thepage \newpage

534 }

535 \draftcopyFirstPage{2}
536 \draftcopyLastPage{3}
537 \begin{document}
538 Should print UDKAST on the second and third pages, light.\\
539 \verb|\usepackage[light,firsttwo]{draftcopy}|\\
540 \verb|\draftcopyFirstPage{2}|\\
541 \verb|\draftcopyLastPage{3}|\\
542 \xx\xx\xx\xx
543 \end{document}

544 ⟨/test4⟩

545 ⟨∗test5⟩

546 \documentclass[a4paper,dutch]{article}
547 \usepackage[none,bottom]{draftcopy}
548 \newcommand{\xx}{
549 Test5: This is a test page \thepage \vfill
550 This is a testpage \thepage \newpage

551 }

552 \begin{document}
553 Should print ONTWERP only at the bottom each page.\\
554 \verb|\usepackage[none,bottom]{draftcopy}|\\
555 \xx\xx\xx\xx
556 \end{document}

557 ⟨/test5⟩

558 ⟨∗test6⟩

559 \documentclass[a4paper,finnish]{article}
560 \usepackage[firsttwo,light,bottom]{draftcopy}
561 \newcommand{\xx}{
562 test6: This is a test page \thepage \vfill
563 This is a testpage \thepage \newpage

564 }

565 \begin{document}
566 Should print VEDOS on the first two pages, light.\\
567 Should print VEDOS at the bottom each page.\\
568 \verb|\usepackage[firsttwo,light,bottom]{draftcopy}|\\
569 \xx\xx\xx\xx
570 \end{document}

571 ⟨/test6⟩

572 ⟨∗test7⟩

573 \documentclass[a4paper,norsk]{article}
574 \usepackage[light,bottomafter]{draftcopy}

575 \newcommand{\xx}{
576 Test7: This is a test page \thepage \vfill
577 This is a testpage \thepage \newpage

578 }

579 \draftcopyFirstPage{2}
580 \draftcopyLastPage{3}
581 \begin{document}
582 Should print UTKAST on the on the pages 2 and 3, light.\\
583 Should print UTKAST on bottom of the page after the third page.\\
584 \verb|\usepackage[light,bottomafter]{draftcopy}|\\
585 \verb|\draftcopyFirstPage{2}|\\
586 \verb|\draftcopyLastPage{3}|\\
587 \xx\xx\xx\xx
588 \end{document}

589 ⟨/test7⟩

590 ⟨∗test8⟩

591 \documentclass[a4paper,nynorsk]{article}
592 \usepackage[light,firsttwo,outline,bottomafter]{draftcopy}
593 \newcommand{\xx}{
594 Test8: This is a test page \thepage \vfill
595 This is a testpage \thepage \newpage

596 }

597 \begin{document}
598 Should print FRAMLEGG on the first two pages, light, outlined.\\
599 Should print FRAMLEGG on bottom of the page after the second page.\\
600 \verb|\usepackage[light,firsttwo,outline,bottomafter]{draftcopy}|\\
601 \xx\xx\xx\xx
602 \end{document}

603 ⟨/test8⟩

604 ⟨∗test9⟩

605 \documentclass{article}
606 \usepackage[light,firsttwo,outline,bottomafter]{draftcopy}
607 \newcommand{\xx}{
608 Test9: This is a test page \thepage\\
609 test~the~tilde~tilde~tilde (1 fixed space (\~{})  between the words)\\
610 test~~the~~tilde~~tilde~~tilde (2 fixed spaces (\~{}) between the words)\\
611 test~~~the~~~tilde~~~tilde~~~tilde (3 fixed spaces (\~{}) between the words)
612 \vfill
613 This is a testpage \thepage \newpage

614 }

615 \draftcopyName{Release\space\space\space\today}{130}
616 \draftcopySetScale{80}
617 \begin{document}
618 Should print the word \verb+Release+  and the current date \verb|\today|
619 (in english) on the first two pages, light, outlined.\\
620 Should print the word \verb+Release+  and current date \verb|\today|
621 (in english) on bottom of the page after the second page.\\
622 Check that the lines with \~{} have correct spacing.\\
623 \verb|\usepackage[light,firsttwo,outline,bottomafter]{draftcopy}|\\
624 and \\
625 \verb|\draftcopyName{Release\space\space\space\today}{130}|\\
626 \verb|\draftcopySetScale{80}|\\
627 in the preamble

628 \xx\xx\xx\xx
629 \end{document}

630 ⟨/test9⟩

631 ⟨∗test10⟩

632 \documentclass[german]{article}
633 \usepackage{babel}
634 \usepackage[light,firsttwo,outline,bottomafter]{draftcopy}
635 \newcommand{\xx}{
636 Test10: This is a test page \thepage \\
637 test~the~tilde~tilde~tilde (1 fixed space (\~{}) between the words)\\
638 test~~the~~tilde~~tilde~~tilde (2 fixed spaces (\~{}) between the words)\\
639 test~~~the~~~tilde~~~tilde~~~tilde (3 fixed spaces (\~{}) between the words)
640 \vfill
641 This is a testpage \thepage \newpage

642 }

643 \draftcopyName{\today}{130}
644 \draftcopySetScale{80}
645 \begin{document}
646 Should print the current date \verb|\today| (in german) on the first two pages,
647 light, outlined.\\
648 Should print the current date \verb|\today| (in german) on bottom of the page
649 after the second page.\\
650 Check that the lines with \~{}) have correct spacing.\\
651 \verb|\usepackage[light,firsttwo,outline,bottomafter]{draftcopy}|\\
652 and \\
653 \verb|\draftcopyName{\today}{130}|\\
654 \verb|\draftcopySetScale{80}|\\
655 in the preamble
656 \xx\xx\xx\xx
657 \end{document}

658 ⟨/test10⟩

659 ⟨∗test11⟩

660 \documentclass[landscape,a4paper]{article}
661 \usepackage[landscape]{draftcopy}
662 \newcommand{\xx}{
663 Test 11\\This is a test page with landscape option \thepage \vfill
664 This is a testpage \thepage \newpage

665 }

666 \begin{document}
667 Should print DRAFT over all pages, quite dark.\\
668 \verb|\usepackage[landscape]{draftcopy}|\\
669 \xx\xx\xx\xx
670 \end{document}

671 ⟨/test11⟩

672 ⟨∗test12⟩

673 \documentclass[landscape,german,a4paper]{article}
674 \usepackage[landscape,bottom]{draftcopy}
675 \newcommand{\xx}{
676 Test 12\\This is a test page \thepage \vfill
677 This is a testpage \thepage \newpage

678 }

679 \begin{document}
680 Should print ENTWURF over all pages, quite dark and on the bottom and with

681 landscape orientation.\\
682 \verb|\usepackage[landscape,bottom]{draftcopy}|\\
683 \xx\xx\xx\xx
684 \end{document}

685 ⟨/test12⟩

686 ⟨∗test13⟩

687 \documentclass[a4paper]{article}
688 \usepackage[conditional]{draftcopy}
689 \newcommand{\xx}{
690 Test 13\\This is a test page \thepage \vfill
691 This is a testpage \thepage \newpage

692 }

693 \begin{document}
694 Should \emph{NOT} print DRAFT since, conditional is used.\\
695 \verb|\usepackage[conditional]{draftcopy}|\\
696 \xx\xx\xx\xx
697 \end{document}

698 ⟨/test13⟩

699 ⟨∗test14⟩

700 \documentclass[draft,a4paper]{article}
701 \usepackage[conditional]{draftcopy}
702 \newcommand{\xx}{
703 Test 14\\This is a test page \thepage \vfill
704 This is a testpage \thepage \newpage

705 }

706 \begin{document}
707 Should print DRAFT since, conditional and draft are used.\\
708 \verb|\usepackage[conditional]{draftcopy}|\\
709 \xx\xx\xx\xx
710 \end{document}

711 ⟨/test14⟩

712 ⟨∗test15⟩

713 \documentclass[final,a4paper]{article}
714 \usepackage[conditional]{draftcopy}
715 \newcommand{\xx}{
716 Test 15\\This is a test page \thepage \vfill
717 This is a testpage \thepage \newpage

718 }

719 \begin{document}
720 Should \emph{NOT} print DRAFT since, final is used (as global option).\\
721 \verb|\usepackage{draftcopy}|\\
722 \xx\xx\xx\xx
723 \end{document}

724 ⟨/test15⟩

725 ⟨∗test16⟩

726 \documentclass[a4paper,greek]{article}
727 \usepackage[timestamp,bottom]{draftcopy}
728 \newcommand{\xx}{
729 Test 16\\This is a test page \thepage \vfill
730 This is a testpage \thepage \newpage

731 }

732 \draftcopyPageX{300}
733 \draftcopyPageY{100}

734 \draftcopyBottomX{300}
735 \draftcopyBottomY{100}
736 \draftcopySetScaleFactor{0.5}
737 \draftcopyVersion{Version 2.14: }
738 \begin{document}
739 Should print DRAFT (in greek translation and greek letters)
740 on a moved position.\\
741 \verb|\usepackage[timestamp,bottom,greek]{draftcopy}|\\
742 \xx\xx\xx\xx
743 \end{document}

744 ⟨/test16⟩